changeset 4:09b89b345de2

Update
author Ira Cooke <iracooke@gmail.com>
date Sun, 09 Jun 2013 08:16:08 -0500
parents 463328a6967f
children df8b867ab71a
files datatypes_conf.xml proteomics.py
diffstat 2 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/datatypes_conf.xml	Mon Mar 04 19:00:50 2013 -0500
+++ b/datatypes_conf.xml	Sun Jun 09 08:16:08 2013 -0500
@@ -3,7 +3,10 @@
   <datatype_files>
     <datatype_file name="proteomics.py"/>
   </datatype_files>		
-  <registration display_path="display_applications">	
+  <registration display_path="display_applications">
+    <datatype extension="prot_gff" type="galaxy.datatypes.proteomics:ProtGff" mimetype="application/xml" display_in_upload="true">
+       <display file="proteomics/ProtGff.xml" />
+    </datatype>	
     <datatype extension="pepxml" type="galaxy.datatypes.proteomics:PepXml" mimetype="application/xml" display_in_upload="true">
       <display file="proteomics/PepXml.xml" />
     </datatype>
@@ -35,6 +38,7 @@
     <datatype extension="hlf" type="galaxy.datatypes.proteomics:XHunterAslFormat" display_in_upload="true" />
   </registration>
   <sniffers>
+    <sniffer type="galaxy.datatypes.proteomics:ProtGff"/>
     <sniffer type="galaxy.datatypes.proteomics:MzML"/>        
     <sniffer type="galaxy.datatypes.proteomics:PepXml"/>
     <sniffer type="galaxy.datatypes.proteomics:Mgf"/>
--- a/proteomics.py	Mon Mar 04 19:00:50 2013 -0500
+++ b/proteomics.py	Sun Jun 09 08:16:08 2013 -0500
@@ -7,9 +7,34 @@
 from galaxy.datatypes.xml import *
 from galaxy.datatypes.sniff import *
 from galaxy.datatypes.binary import *
+from galaxy.datatypes.interval import *
 
 log = logging.getLogger(__name__)
 
+class ProtGff( Gff ):
+    """Tab delimited data in Gff format"""
+    file_ext = "prot_gff"
+    def set_peek( self, dataset, is_multi_byte=False ):
+        """Set the peek and blurb text"""
+        if not dataset.dataset.purged:
+            dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+            dataset.blurb = 'Proteogenomics GFF'
+        else:
+            dataset.peek = 'file does not exist'
+            dataset.blurb = 'file purged from disk'
+
+    def sniff( self, filename ):
+        handle = open(filename)
+        xmlns_re = re.compile("^##gff-version")
+        for i in range(3):
+            line = handle.readline()
+            if xmlns_re.match(line.strip()):
+                handle.close()
+                return True
+
+        handle.close()
+        return False
+
 
 class Xls( Binary ):
     """Class describing a binary excel spreadsheet file"""