changeset 2:d150ac3d853d draft

"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/split_file_to_collection commit 06ffe450bafa280eee8a4331c9cfc9e1ece7c522"
author bgruening
date Wed, 28 Aug 2019 10:55:25 -0400
parents 750c1684d47c
children 2ddc36385d7a
files split_file_to_collection.py split_file_to_collection.xml test-data/3_molecules.sdf test-data/mol_0.sdf test-data/mol_1.sdf test-data/mol_2.sdf
diffstat 4 files changed, 844 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/split_file_to_collection.py	Mon Feb 18 15:20:56 2019 -0500
+++ b/split_file_to_collection.py	Wed Aug 28 10:55:25 2019 -0400
@@ -15,6 +15,7 @@
 FILETYPES = {'fasta': '^>',
              'fastq': '^@',
              'tabular': '^.*',
+             'txt': '^.*',
              'mgf': '^BEGIN IONS'}
 
 
@@ -37,6 +38,8 @@
 
     ftype = args["ftype"]
 
+    assert ftype != "generic" or args["generic_re"] != None, "--generic_re needs to be given for generic input"
+
     if args["ftype"] == "tabular" and args["by"] == "col":
         args["match"] = replace_mapped_chars(args["match"])
         args["sub"] = replace_mapped_chars(args["sub"])
@@ -56,7 +59,8 @@
     parser.add_argument('--file_ext', '-e', help="If not splitting by column," +
                                                  " the extension of the new files (without a period)")
     parser.add_argument('--ftype', '-f', help="The type of the file to split", required = True,
-        choices=["mgf", "fastq", "fasta", "tabular"])
+        choices=["mgf", "fastq", "fasta", "tabular", "txt", "generic"])
+    parser.add_argument('--generic_re', '-g', help="Regular expression indicating the start of a new record (only for generic)", required = False)
     parser.add_argument('--by', '-b', help="Split by line or by column (tabular only)",
         default = "row", choices = ["col", "row"])
     parser.add_argument('--top', '-t', type=int, default=0, help="Number of header lines to carry over to new files. " +
@@ -96,7 +100,7 @@
 
 def split_by_record(args, in_file, out_dir, top, ftype):
     # get record separator for given filetype
-    sep = re.compile(FILETYPES[ftype])
+    sep = re.compile(FILETYPES.get(ftype, args["generic_re"]))
 
     numnew = args["numnew"]
 
--- a/split_file_to_collection.xml	Mon Feb 18 15:20:56 2019 -0500
+++ b/split_file_to_collection.xml	Wed Aug 28 10:55:25 2019 -0400
@@ -1,6 +1,19 @@
-<tool id="split_file_to_collection" name="Split file" version="0.1.1">
+<tool id="split_file_to_collection" name="Split file" version="0.2.0">
     <description>to dataset collection</description>
     <macros>
+        <xml name="regex_sanitizer">
+            <sanitizer>
+                <valid>
+                    <add preset="string.printable"/>
+                    <remove value="&#92;" />
+                    <remove value="&apos;" />
+                </valid>
+                <mapping initial="none">
+                    <add source="&#92;" target="__backslash__" />
+                    <add source="&apos;" target="__sq__"/>
+                </mapping>
+            </sanitizer>
+        </xml>
         <xml name="numnew_fname">
             <param name="numnew" type="integer" label="Number of new files" min="1" value="1"/>
             <param name="newfilenames" type="text" label="Base name for new files in collection"
@@ -48,6 +61,9 @@
                     #end if
                 #end if
             #else
+                #if $split_parms.select_ftype == "generic"
+                    --generic_re '$split_parms.generic_regex'
+                #end if
                 --numnew '$split_parms.numnew'
                 #if $split_parms.select_allocate.allocate == "random":
                     --rand
@@ -63,7 +79,11 @@
         #end if
         #if $split_parms.select_ftype != "tabular":
             --file_names '$split_parms.newfilenames'
-            --file_ext '$split_parms.select_ftype'
+            #if $split_parms.select_ftype == "generic"
+                --file_ext '$split_parms.input.ext'
+            #else
+                --file_ext '$split_parms.select_ftype'
+            #end if
         #end if
     ]]></command>
     <inputs>
@@ -73,6 +93,8 @@
                 <option value="fastq">FASTQ</option>
                 <option value="tabular">Tabular</option>
                 <option value="fasta">FASTA</option>
+                <option value="txt">Text files</option>
+                <option value="generic">Generic</option>
             </param>
             <when value="tabular">
                 <param name="input" type="data" format="tabular" label="Tabular file to split"/>
@@ -85,30 +107,10 @@
                     <when value="col">
                         <param name="id_col" type="data_column" label="Column to split on" data_ref="input"/>
                         <param name="match_regex" type="text" label="Regex to match contents of id column" value="(.*)">
-	 		                <sanitizer>
-          		                <valid>
-            		                <add preset="string.printable"/>
-            		                <remove value="&#92;" />
-           		                    <remove value="&apos;" />
-          			            </valid>
-          		                <mapping initial="none">
-            		                <add source="&#92;" target="__backslash__" />
-            		                <add source="&apos;" target="__sq__"/>
-          		                </mapping>
-			                </sanitizer>
-		                </param>
+                            <expand macro="regex_sanitizer"/>
+                        </param>
                         <param name="sub_regex" type="text" label="Pattern to replace match with" value="\1">
-                            <sanitizer>
-                                <valid>
-                                    <add preset="string.printable"/>
-                                    <remove value="&#92;" />
-                                    <remove value="&apos;" />
-                                </valid>
-                                <mapping initial="none">
-                                    <add source="&#92;" target="__backslash__" />
-                                    <add source="&apos;" target="__sq__"/>
-                                </mapping>
-			                </sanitizer>
+                            <expand macro="regex_sanitizer"/>
                         </param>
                     </when>
                     <when value="row">
@@ -128,25 +130,44 @@
                 <param name="input" type="data" format="fasta" label="FASTA file to split"/>
                 <expand macro="numnew_fname"/>
             </when>
+            <when value="txt">
+                <param name="input" type="data" format="txt" label="Text file to split"/>
+                <expand macro="numnew_fname"/>
+            </when>
+            <when value="generic">
+                <param name="input" type="data" format="txt" label="File to split"/>
+                <param name="generic_regex" type="text" label="Regex to match record separator" value="^.*">
+                    <expand macro="regex_sanitizer"/>
+                </param>
+                <expand macro="numnew_fname"/>
+            </when>
         </conditional>
     </inputs>
     <outputs>
-        <collection name="list_output_tab" type="list" label="${tool.name} on ${on_string}: output collection">
+        <collection name="list_output_tab" type="list" label="${tool.name} on ${on_string}">
             <discover_datasets pattern="__name__" directory="out" visible="false" format="tabular"/>
             <filter>split_parms['select_ftype'] == "tabular"</filter>
         </collection>
-        <collection name="list_output_mgf" type="list" label="${tool.name} on ${on_string}: output collection">
+        <collection name="list_output_mgf" type="list" label="${tool.name} on ${on_string}">
             <discover_datasets pattern="__name__" directory="out" visible="false" format="mgf"/>
             <filter>split_parms['select_ftype'] == "mgf"</filter>
         </collection>
-        <collection name="list_output_fasta" type="list" label="${tool.name} on ${on_string}: output collection">
+        <collection name="list_output_fasta" type="list" label="${tool.name} on ${on_string}">
             <discover_datasets pattern="__name__" directory="out" visible="false" format="fasta"/>
             <filter>split_parms['select_ftype'] == "fasta"</filter>
         </collection>
-        <collection name="list_output_fastq" type="list" label="${tool.name} on ${on_string}: output collection">
+        <collection name="list_output_fastq" type="list" label="${tool.name} on ${on_string}">
             <discover_datasets pattern="__name__" directory="out" visible="false" format="fastq"/>
             <filter>split_parms['select_ftype'] == "fastq"</filter>
         </collection>
+        <collection name="list_output_txt" type="list" label="${tool.name} on ${on_string}">
+            <discover_datasets pattern="__name__" directory="out" visible="false" format="txt"/>
+            <filter>split_parms['select_ftype'] == "txt"</filter>
+        </collection>
+        <collection name="list_output_generic" type="list" label="${tool.name} on ${on_string}">
+            <discover_datasets pattern="__name_and_ext__" directory="out" visible="false"/>
+            <filter>split_parms['select_ftype'] == "generic"</filter>
+        </collection>
     </outputs>
     <tests>
         <test>
@@ -257,21 +278,101 @@
                 <element name="fasta_batch_1.fasta" file="fasta_batch_1.fasta" ftype="fasta"/>
             </output_collection>
         </test> 
+        <test>
+            <param name="input" value="test.tabular" ftype="txt"/>
+            <param name="select_ftype" value="txt"/>
+            <param name="numnew" value="2"/>
+            <param name="newfilenames" value="test"/> 
+            <output_collection name="list_output_txt" type="list">
+                <element name="test_0.txt" file="test_0.tabular" ftype="txt" lines_diff="1"/>
+                <element name="test_1.txt" file="test_1.tabular" ftype="txt" lines_diff="1"/>
+            </output_collection>
+        </test>
+        <test>
+            <param name="input" value="test.tabular" ftype="txt"/>
+            <param name="select_ftype" value="generic"/>
+            <param name="generic_regex" value="^.*"/>
+            <param name="numnew" value="2"/>
+            <param name="newfilenames" value="test"/> 
+            <output_collection name="list_output_generic" type="list">
+                <element name="test_0" file="test_0.tabular" ftype="txt" lines_diff="1"/>
+                <element name="test_1" file="test_1.tabular" ftype="txt" lines_diff="1"/>
+            </output_collection>
+        </test>
+        <test>
+            <param name="input" value="test.fasta" ftype="fasta"/>
+            <param name="select_ftype" value="generic"/>
+            <param name="generic_regex" value="^>.*"/>
+            <param name="numnew" value="2"/>
+            <param name="newfilenames" value="rand"/>
+            <param name="allocate" value="random"/>
+            <param name="seed" value="1010"/> 
+            <output_collection name="list_output_generic" type="list">
+                <element name="rand_0" file="rand_0.fasta" ftype="fasta"/>
+                <element name="rand_1" file="rand_1.fasta" ftype="fasta"/>
+            </output_collection>
+        </test>
+        <test>
+            <param name="input" value="3_molecules.sdf" ftype="sdf"/>
+            <param name="select_ftype" value="generic"/>
+            <param name="generic_regex" value="^\$\$\$\$.*"/>
+            <param name="numnew" value="1000"/>
+            <param name="newfilenames" value="mol"/>
+            <param name="allocate" value="batch"/>
+            <output_collection name="list_output_generic" type="list">
+                <element name="mol_0" file="mol_0.sdf" ftype="sdf"/>
+                <element name="mol_1" file="mol_1.sdf" ftype="sdf"/>
+                <element name="mol_2" file="mol_2.sdf" ftype="sdf"/>
+            </output_collection>
+        </test>
     </tests>
     <help><![CDATA[
 **Split file into a dataset collection**
 
-This tool can split five types of files into a separate files within a dataset collection: MGF, FASTA, FASTQ, and tabular.
+This tool splits a data sets consisting of records into multiple data sets within a collection. 
+A record can be for instance simply a line, a FASTA sequence (header + sequence), a FASTQ sequence
+(headers + sequence + qualities), etc. The important property is that the begin of a new record
+can be speciefied by a regular expression, e.g. ".*" for lines, ">.*" for FASTA, or "@.*" for FASTQ. 
+The tool has presets for text, tabular data sets (which are split by line), FASTA, FASTQ, and MGF. 
+For other data types the text delimiting records can be specified manually using the generic splitter. 
+
+If splitting by line (or by some other item, like a FASTA entry or an MGF record, the splitting can be either done alternating, in original record order, or at random. 
+
+If t records are to be distributed to n new data sets, then the i-th record goes to data set
+
+* floor(i / t * n) (for batch), 
+* i % n (for alternating), or
+* a random data set
+
+For instance, t=5 records are distributed as follows on n=2 data sets
+
+= === === ====
+i bat alt rand
+= === === ====
+0 0   0   0
+1 0   1   1
+2 0   0   1
+3 1   1   0
+4 1   0   0
+= === === ====
+
+If the five records are distributed on n=3 data sets:
+
+= === === ====
+i bat alt rand
+= === === ====
+0 0   0   0
+1 0   1   1
+2 1   2   2
+3 1   0   0
+4 2   1   1
+= === === ====
+
+Note that there are no guarantees when splitting at random that every result file will be non-empty, so downstream tools should be able to gracefully handle empty files. 
+
 If a tabular file is used as input, you may choose to split by line or by column. If split by column, a new file is created for each unique value in the column.
 In addition, (Python) regular expressions may be used to transform the value in the column to a new value. Caution should be used with this feature, as it could transform all values to the same value, or other unexpected behavior.
 The default regular expression uses each value in the column without modifying it. 
-
-If splitting by line (or by some other item, like a FASTA entry or an MGF section), the splitting can be either done sequentially or at random. 
-Note that there are no guarantees when splitting at random that every result file will be non-empty, so downstream tools should be able to gracefully handle empty files. 
-
-**Note**
-
-Due to current limitations with dataset collections, a log file is produced when running this tool. It will usually be empty, but if the tool fails, any errors will be printed to the log file. 
     ]]></help>
     <citations>
         <citation type="bibtex">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/3_molecules.sdf	Wed Aug 28 10:55:25 2019 -0400
@@ -0,0 +1,350 @@
+
+ Chemfp
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+>  <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+11
+10
+3
+15
+17
+13
+5
+16
+7
+14
+9
+8
+4
+18
+6
+12
+2
+
+>  <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+18
+1 -0.23
+10 -0.15
+11 0.63
+12 0.66
+13 0.06
+14 0.15
+15 0.15
+16 0.15
+17 0.15
+2 -0.65
+21 0.5
+3 -0.57
+4 -0.57
+5 0.08
+6 0.09
+7 -0.15
+8 -0.15
+9 -0.15
+
+>  <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+3
+
+>  <PUBCHEM_CONFORMER_ID>
+000008C400000001
+
+>  <PUBCHEM_MMFF94_ENERGY>
+39.5952
+
+>  <PUBCHEM_FEATURE_SELFOVERLAP>
+25.432
+
+>  <PUBCHEM_SHAPE_FINGERPRINT>
+1 1 18265615372930943622
+100427 49 16967750034970055351
+12138202 97 18271247217817981012
+12423570 1 16692715976000295083
+12524768 44 16753525617747228747
+12716758 59 18341332292274886536
+13024252 1 17968377969333732145
+14181834 199 17830728755827362645
+14614273 12 18262232214645093005
+15207287 21 17703787037639964108
+15775835 57 18340488876329928641
+16945 1 18271533103414939405
+193761 8 17907860604865584321
+20645476 183 17677348215414174190
+20871998 184 18198632231250704846
+21040471 1 18411412921197846465
+21501502 16 18123463883164380929
+23402539 116 18271795865171824860
+23419403 2 13539898140662769886
+23552423 10 18048876295495619569
+23559900 14 18272369794190581304
+241688 4 16179044415907240795
+257057 1 17478316999871287486
+2748010 2 18339085878070479087
+305870 269 18263645056784260212
+528862 383 18117272558388284091
+53812653 8 18410289211719108569
+7364860 26 17910392788380644719
+81228 2 18050568744116491203
+
+>  <PUBCHEM_SHAPE_MULTIPOLES>
+244.06
+3.86
+2.45
+0.89
+1.95
+1.58
+0.15
+-1.85
+0.38
+-0.61
+-0.02
+0.29
+0.01
+-0.33
+
+>  <PUBCHEM_SHAPE_SELFOVERLAP>
+513.037
+
+>  <PUBCHEM_SHAPE_VOLUME>
+136
+
+>  <PUBCHEM_COORDINATE_TYPE>
+2
+5
+10
+
+$$$$
+2244
+ OpenBabel09021316243D
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+>  <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+11
+10
+3
+15
+17
+13
+5
+16
+7
+14
+9
+8
+4
+18
+6
+12
+2
+
+>  <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+18
+1 -0.23
+10 -0.15
+11 0.63
+12 0.66
+13 0.06
+14 0.15
+15 0.15
+16 0.15
+17 0.15
+2 -0.65
+21 0.5
+3 -0.57
+4 -0.57
+5 0.08
+6 0.09
+7 -0.15
+8 -0.15
+9 -0.15
+
+>  <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+3
+
+>  <PUBCHEM_PHARMACOPHORE_FEATURES>
+5
+1 2 acceptor
+1 3 acceptor
+1 4 acceptor
+3 2 3 11 anion
+6 5 6 7 8 9 10 rings
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_CONFORMER_ID>
+000008C400000001
+
+>  <PUBCHEM_COORDINATE_TYPE>
+2
+5
+10
+
+$$$$
+
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+$$$$
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/mol_0.sdf	Wed Aug 28 10:55:25 2019 -0400
@@ -0,0 +1,350 @@
+
+ Chemfp
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+>  <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+11
+10
+3
+15
+17
+13
+5
+16
+7
+14
+9
+8
+4
+18
+6
+12
+2
+
+>  <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+18
+1 -0.23
+10 -0.15
+11 0.63
+12 0.66
+13 0.06
+14 0.15
+15 0.15
+16 0.15
+17 0.15
+2 -0.65
+21 0.5
+3 -0.57
+4 -0.57
+5 0.08
+6 0.09
+7 -0.15
+8 -0.15
+9 -0.15
+
+>  <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+3
+
+>  <PUBCHEM_CONFORMER_ID>
+000008C400000001
+
+>  <PUBCHEM_MMFF94_ENERGY>
+39.5952
+
+>  <PUBCHEM_FEATURE_SELFOVERLAP>
+25.432
+
+>  <PUBCHEM_SHAPE_FINGERPRINT>
+1 1 18265615372930943622
+100427 49 16967750034970055351
+12138202 97 18271247217817981012
+12423570 1 16692715976000295083
+12524768 44 16753525617747228747
+12716758 59 18341332292274886536
+13024252 1 17968377969333732145
+14181834 199 17830728755827362645
+14614273 12 18262232214645093005
+15207287 21 17703787037639964108
+15775835 57 18340488876329928641
+16945 1 18271533103414939405
+193761 8 17907860604865584321
+20645476 183 17677348215414174190
+20871998 184 18198632231250704846
+21040471 1 18411412921197846465
+21501502 16 18123463883164380929
+23402539 116 18271795865171824860
+23419403 2 13539898140662769886
+23552423 10 18048876295495619569
+23559900 14 18272369794190581304
+241688 4 16179044415907240795
+257057 1 17478316999871287486
+2748010 2 18339085878070479087
+305870 269 18263645056784260212
+528862 383 18117272558388284091
+53812653 8 18410289211719108569
+7364860 26 17910392788380644719
+81228 2 18050568744116491203
+
+>  <PUBCHEM_SHAPE_MULTIPOLES>
+244.06
+3.86
+2.45
+0.89
+1.95
+1.58
+0.15
+-1.85
+0.38
+-0.61
+-0.02
+0.29
+0.01
+-0.33
+
+>  <PUBCHEM_SHAPE_SELFOVERLAP>
+513.037
+
+>  <PUBCHEM_SHAPE_VOLUME>
+136
+
+>  <PUBCHEM_COORDINATE_TYPE>
+2
+5
+10
+
+$$$$
+2244
+ OpenBabel09021316243D
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+>  <PUBCHEM_COMPOUND_CID>
+2244
+
+>  <PUBCHEM_CONFORMER_RMSD>
+0.6
+
+>  <PUBCHEM_CONFORMER_DIVERSEORDER>
+1
+11
+10
+3
+15
+17
+13
+5
+16
+7
+14
+9
+8
+4
+18
+6
+12
+2
+
+>  <PUBCHEM_MMFF94_PARTIAL_CHARGES>
+18
+1 -0.23
+10 -0.15
+11 0.63
+12 0.66
+13 0.06
+14 0.15
+15 0.15
+16 0.15
+17 0.15
+2 -0.65
+21 0.5
+3 -0.57
+4 -0.57
+5 0.08
+6 0.09
+7 -0.15
+8 -0.15
+9 -0.15
+
+>  <PUBCHEM_EFFECTIVE_ROTOR_COUNT>
+3
+
+>  <PUBCHEM_PHARMACOPHORE_FEATURES>
+5
+1 2 acceptor
+1 3 acceptor
+1 4 acceptor
+3 2 3 11 anion
+6 5 6 7 8 9 10 rings
+
+>  <PUBCHEM_HEAVY_ATOM_COUNT>
+13
+
+>  <PUBCHEM_ATOM_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ATOM_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_DEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_BOND_UDEF_STEREO_COUNT>
+0
+
+>  <PUBCHEM_ISOTOPIC_ATOM_COUNT>
+0
+
+>  <PUBCHEM_COMPONENT_COUNT>
+1
+
+>  <PUBCHEM_CACTVS_TAUTO_COUNT>
+1
+
+>  <PUBCHEM_CONFORMER_ID>
+000008C400000001
+
+>  <PUBCHEM_COORDINATE_TYPE>
+2
+5
+10
+
+$$$$
+
+
+ 21 21  0  0  0  0  0  0  0  0999 V2000
+    1.2333    0.5540    0.7792 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.6952   -2.7148   -0.7502 O   0  0  0  0  0  0  0  0  0  0  0  0
+    0.7958   -2.1843    0.8685 O   0  0  0  0  0  0  0  0  0  0  0  0
+    1.7813    0.8105   -1.4821 O   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.0857    0.6088    0.4403 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7927   -0.5515    0.1244 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.7288    1.8464    0.4133 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.1426   -0.4741   -0.2184 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.0787    1.9238    0.0706 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7855    0.7636   -0.2453 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1409   -1.8536    0.1477 C   0  0  0  0  0  0  0  0  0  0  0  0
+    2.1094    0.6715   -0.3113 C   0  0  0  0  0  0  0  0  0  0  0  0
+    3.5305    0.5996    0.1635 C   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.1851    2.7545    0.6593 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.7247   -1.3605   -0.4564 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -2.5797    2.8872    0.0506 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -3.8374    0.8238   -0.5090 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7290    1.4184    0.8593 H   0  0  0  0  0  0  0  0  0  0  0  0
+    4.2045    0.6969   -0.6924 H   0  0  0  0  0  0  0  0  0  0  0  0
+    3.7105   -0.3659    0.6426 H   0  0  0  0  0  0  0  0  0  0  0  0
+   -0.2555   -3.5916   -0.7337 H   0  0  0  0  0  0  0  0  0  0  0  0
+  1  5  1  0  0  0  0
+  1 12  1  0  0  0  0
+  2 11  1  0  0  0  0
+  2 21  1  0  0  0  0
+  3 11  2  0  0  0  0
+  4 12  2  0  0  0  0
+  5  6  1  0  0  0  0
+  5  7  2  0  0  0  0
+  6  8  2  0  0  0  0
+  6 11  1  0  0  0  0
+  7  9  1  0  0  0  0
+  7 14  1  0  0  0  0
+  8 10  1  0  0  0  0
+  8 15  1  0  0  0  0
+  9 10  2  0  0  0  0
+  9 16  1  0  0  0  0
+ 10 17  1  0  0  0  0
+ 12 13  1  0  0  0  0
+ 13 18  1  0  0  0  0
+ 13 19  1  0  0  0  0
+ 13 20  1  0  0  0  0
+M  END
+$$$$