# HG changeset patch # User bgruening # Date 1391782883 18000 # Node ID df8b867ab71ad767d7519ab3bfc3326583c77a36 # Parent 09b89b345de2ecf2cd39399d17c42d22334062a6 Uploaded diff -r 09b89b345de2 -r df8b867ab71a datatypes_conf.xml --- a/datatypes_conf.xml Sun Jun 09 08:16:08 2013 -0500 +++ b/datatypes_conf.xml Fri Feb 07 09:21:23 2014 -0500 @@ -2,7 +2,7 @@ - + @@ -22,16 +22,23 @@ + + + - + + - + + + + @@ -39,7 +46,7 @@ - + diff -r 09b89b345de2 -r df8b867ab71a proteomics.py --- a/proteomics.py Sun Jun 09 08:16:08 2013 -0500 +++ b/proteomics.py Fri Feb 07 09:21:23 2014 -0500 @@ -3,11 +3,14 @@ """ import logging import re -from galaxy.datatypes.data import * -from galaxy.datatypes.xml import * +import binascii + from galaxy.datatypes.sniff import * -from galaxy.datatypes.binary import * -from galaxy.datatypes.interval import * +from galaxy.datatypes.data import Text +from galaxy.datatypes.xml import GenericXml +from galaxy.datatypes.binary import Binary +from galaxy.datatypes.tabular import Tabular +from galaxy.datatypes.interval import Gff log = logging.getLogger(__name__) @@ -53,13 +56,46 @@ except: return "Binary xls file (%s)" % ( data.nice_size( dataset.get_size() ) ) -class ProteomicsXml(GenericXml): +class IdpDB( Binary ): + file_ext = "idpDB" + +if hasattr(Binary, 'register_unsniffable_binary_ext'): + Binary.register_unsniffable_binary_ext('idpDB') + + +class PepXmlReport( Tabular ): + """pepxml converted to tabular report""" + file_ext = "tsv" + + def __init__(self, **kwd): + Tabular.__init__( self, **kwd ) + self.column_names = ['Protein', 'Peptide', 'Assumed Charge', 'Neutral Pep Mass (calculated)', 'Neutral Mass', 'Retention Time', 'Start Scan', 'End Scan', 'Search Engine', 'PeptideProphet Probability', 'Interprophet Probabaility'] + + def display_peek( self, dataset ): + """Returns formated html of peek""" + return Tabular.make_html_table( self, dataset, column_names=self.column_names ) + + +class ProtXmlReport( Tabular ): + """protxml converted to tabular report""" + file_ext = "tsv" + comment_lines = 1 + + def __init__(self, **kwd): + Tabular.__init__( self, **kwd ) + self.column_names = ["Entry Number", "Group Probability", "Protein", "Protein Link", "Protein Probability", "Percent Coverage", "Number of Unique Peptides", "Total Independent Spectra", "Percent Share of Spectrum ID's", "Description", "Protein Molecular Weight", "Protein Length", "Is Nondegenerate Evidence", "Weight", "Precursor Ion Charge", "Peptide sequence", "Peptide Link", "NSP Adjusted Probability", "Initial Probability", "Number of Total Termini", "Number of Sibling Peptides Bin", "Number of Instances", "Peptide Group Designator", "Is Evidence?"] + + def display_peek( self, dataset ): + """Returns formated html of peek""" + return Tabular.make_html_table( self, dataset, column_names=self.column_names ) + +class ProteomicsXml( GenericXml ): """ An enhanced XML datatype used to reuse code across several proteomic/mass-spec datatypes. """ def sniff(self, filename): """ Determines whether the file is the correct XML type. """ - with open(filename, 'r') as contents: + with open(filename, 'r') as contents: while True: line = contents.readline() if line == None or not line.startswith('max_lines: return False - - + + class MascotDat( Text ): """Mascot search results """ file_ext = "mascotdat" @@ -206,10 +260,10 @@ if hasattr(Binary, 'register_sniffable_binary_format'): - Binary.register_sniffable_binary_format('RAW', 'RAW', RAW) + Binary.register_sniffable_binary_format('raw', 'raw', RAW) -class Msp(Text): +class Msp( Text ): """ Output of NIST MS Search Program chemdata.nist.gov/mass-spc/ftp/mass-spc/PepLib.pdf """ file_ext = "msp" @@ -267,10 +321,9 @@ return True # unsniffable binary format, should do something about this -class XHunterAslFormat(Binary): +class XHunterAslFormat( Binary ): """ Annotated Spectra in the HLF format http://www.thegpm.org/HUNTER/format_2006_09_15.html """ file_ext = "hlf" - if hasattr(Binary, 'register_unsniffable_binary_ext'): Binary.register_unsniffable_binary_ext('hlf') diff -r 09b89b345de2 -r df8b867ab71a proteomics_datatypes.diff --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/proteomics_datatypes.diff Fri Feb 07 09:21:23 2014 -0500 @@ -0,0 +1,209 @@ +diff -r 09b89b345de2 datatypes_conf.xml +--- a/datatypes_conf.xml Sun Jun 09 08:16:08 2013 -0500 ++++ b/datatypes_conf.xml Fri Feb 07 00:05:57 2014 +0100 +@@ -2,7 +2,7 @@ + + + +- ++ + + + +@@ -22,16 +22,22 @@ + + + ++ ++ + + + ++ + +- ++ + + + + +- ++ ++ ++ ++ + + + +@@ -39,7 +45,7 @@ + + + +- ++ + + + +diff -r 09b89b345de2 proteomics.py +--- a/proteomics.py Sun Jun 09 08:16:08 2013 -0500 ++++ b/proteomics.py Fri Feb 07 00:05:57 2014 +0100 +@@ -3,11 +3,13 @@ + """ + import logging + import re ++import binascii ++ + from galaxy.datatypes.data import * + from galaxy.datatypes.xml import * + from galaxy.datatypes.sniff import * + from galaxy.datatypes.binary import * +-from galaxy.datatypes.interval import * ++from galaxy.datatypes.tabular import Tabular + + log = logging.getLogger(__name__) + +@@ -53,13 +55,45 @@ + except: + return "Binary xls file (%s)" % ( data.nice_size( dataset.get_size() ) ) + ++class IdpDB(Binary): ++ file_ext = "idpDB" ++ ++if hasattr(Binary, 'register_unsniffable_binary_ext'): ++ Binary.register_unsniffable_binary_ext('idpDB') ++ ++class PepXmlReport(Tabular): ++ """pepxml converted to tabular report""" ++ file_ext = "tsv" ++ ++ def __init__(self, **kwd): ++ Tabular.__init__( self, **kwd ) ++ self.column_names = ['Protein', 'Peptide', 'Assumed Charge', 'Neutral Pep Mass (calculated)', 'Neutral Mass', 'Retention Time', 'Start Scan', 'End Scan', 'Search Engine', 'PeptideProphet Probability', 'Interprophet Probabaility'] ++ ++ def display_peek( self, dataset ): ++ """Returns formated html of peek""" ++ return Tabular.make_html_table( self, dataset, column_names=self.column_names ) ++ ++ ++class ProtXmlReport(Tabular): ++ """protxml converted to tabular report""" ++ file_ext = "tsv" ++ comment_lines = 1 ++ ++ def __init__(self, **kwd): ++ Tabular.__init__( self, **kwd ) ++ self.column_names = ["Entry Number", "Group Probability", "Protein", "Protein Link", "Protein Probability", "Percent Coverage", "Number of Unique Peptides", "Total Independent Spectra", "Percent Share of Spectrum ID's", "Description", "Protein Molecular Weight", "Protein Length", "Is Nondegenerate Evidence", "Weight", "Precursor Ion Charge", "Peptide sequence", "Peptide Link", "NSP Adjusted Probability", "Initial Probability", "Number of Total Termini", "Number of Sibling Peptides Bin", "Number of Instances", "Peptide Group Designator", "Is Evidence?"] ++ ++ def display_peek( self, dataset ): ++ """Returns formated html of peek""" ++ return Tabular.make_html_table( self, dataset, column_names=self.column_names ) ++ + class ProteomicsXml(GenericXml): + """ An enhanced XML datatype used to reuse code across several + proteomic/mass-spec datatypes. """ + + def sniff(self, filename): + """ Determines whether the file is the correct XML type. """ +- with open(filename, 'r') as contents: ++ with open(filename, 'r') as contents: + while True: + line = contents.readline() + if line == None or not line.startswith('max_lines: + return False +- +- ++ ++ + class MascotDat( Text ): + """Mascot search results """ + file_ext = "mascotdat" +@@ -206,7 +257,7 @@ + + + if hasattr(Binary, 'register_sniffable_binary_format'): +- Binary.register_sniffable_binary_format('RAW', 'RAW', RAW) ++ Binary.register_sniffable_binary_format('raw', 'raw', RAW) + + + class Msp(Text): +@@ -267,10 +318,9 @@ + return True + + # unsniffable binary format, should do something about this +-class XHunterAslFormat(Binary): ++class XHunterAslFormat( Binary ): + """ Annotated Spectra in the HLF format http://www.thegpm.org/HUNTER/format_2006_09_15.html """ + file_ext = "hlf" + +- + if hasattr(Binary, 'register_unsniffable_binary_ext'): + Binary.register_unsniffable_binary_ext('hlf')