Mercurial > repos > bgruening > chemical_datatypes
diff molecules.py @ 2:bc6a7eeb7c32 draft
Uploaded
author | bgruening |
---|---|
date | Fri, 26 Apr 2013 09:58:33 -0400 |
parents | dbf93116a809 |
children | 31d2baa37efe |
line wrap: on
line diff
--- a/molecules.py Tue Mar 26 13:00:19 2013 -0400 +++ b/molecules.py Fri Apr 26 09:58:33 2013 -0400 @@ -70,6 +70,19 @@ def get_mime(self): return 'text/plain' +class MOL( GenericMolFile ): + file_ext = "mol" + def sniff( self, filename ): + if count_special_lines("^M\s*END", filename) = 1: + return True + else: + return False + + def set_meta( self, dataset, **kwd ): + """ + Set the number molecules, in the case of MOL its always one. + """ + dataset.metadata.number_of_molecules = 1 class SDF( GenericMolFile ): @@ -82,9 +95,9 @@ def set_meta( self, dataset, **kwd ): """ - Set the number of lines of data in dataset. + Set the number of molecules in dataset. """ - dataset.metadata.number_of_molecules = count_special_lines("^\$\$\$\$", dataset.file_name)#self.count_data_lines(dataset.file_name) + dataset.metadata.number_of_molecules = count_special_lines("^\$\$\$\$", dataset.file_name) def split( cls, input_datasets, subdir_generator_function, split_params): """