diff --git a/config/datatypes_conf.xml.sample b/config/datatypes_conf.xml.sample index 02ab894525b..da8c9ef7e0c 100644 --- a/config/datatypes_conf.xml.sample +++ b/config/datatypes_conf.xml.sample @@ -167,6 +167,7 @@ + @@ -422,6 +423,7 @@ + diff --git a/lib/galaxy/datatypes/proteomics.py b/lib/galaxy/datatypes/proteomics.py index c505197c58d..020a35a9a5d 100644 --- a/lib/galaxy/datatypes/proteomics.py +++ b/lib/galaxy/datatypes/proteomics.py @@ -398,3 +398,28 @@ class XHunterAslFormat(Binary): class Sf3(Binary): """Class describing a Scaffold SF3 files""" file_ext = "sf3" + +class MzSQLite( SQlite ): + """Class describing a Proteomics Sqlite database """ + file_ext = "mz.sqlite" + + def set_meta( self, dataset, overwrite = True, **kwd ): + super( MzSQLite, self ).set_meta( dataset, overwrite = overwrite, **kwd ) + + def sniff( self, filename ): + if super( MzSQLite, self ).sniff( filename ): + mz_table_names = [ "DBSequence", "Modification", "Peaks", "Peptide", "PeptideEvidence", "Score", "SearchDatabase", "Source", "SpectraData", "Spectrum", "SpectrumIdentification] + try: + conn = sqlite.connect( filename ) + c = conn.cursor() + tables_query = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name" + result = c.execute( tables_query ).fetchall() + result = map( lambda x: x[0], result ) + for table_name in mz_table_names: + if table_name not in result: + return False + return True + except Exception, e: + log.warn( '%s, sniff Exception: %s', self, e ) + return False +