mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-24 12:13:33 +08:00
Add datatype: galaxy.datatypes.proteomics:MzSQlite extension: mz.sqlite
This is a SQLite schema for representing Peptide Spectral Matches from mzid and mzML datatypes.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user