mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
This commit is contained in:
@@ -117,8 +117,8 @@
|
||||
<datatype extension="taxonomy" type="galaxy.datatypes.tabular:Taxonomy" display_in_upload="true"/>
|
||||
<datatype extension="tabular" type="galaxy.datatypes.tabular:Tabular" display_in_upload="true"/>
|
||||
<datatype extension="txt" type="galaxy.datatypes.data:Text" display_in_upload="true"/>
|
||||
<datatype extension="memexml" type="galaxy.datatypes.xml:MEMEXml" display_in_upload="true"/>
|
||||
<datatype extension="blastxml" type="galaxy.datatypes.xml:BlastXml" display_in_upload="true"/>
|
||||
<datatype extension="memexml" type="galaxy.datatypes.xml:MEMEXml" mimetype="application/xml" display_in_upload="true"/>
|
||||
<datatype extension="blastxml" type="galaxy.datatypes.xml:BlastXml" mimetype="application/xml" display_in_upload="true"/>
|
||||
<datatype extension="vcf" type="galaxy.datatypes.tabular:Vcf" display_in_upload="true">
|
||||
<converter file="vcf_to_bgzip_converter.xml" target_datatype="bgzip"/>
|
||||
<converter file="vcf_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/>
|
||||
|
||||
@@ -187,7 +187,7 @@ class Registry( object ):
|
||||
'axt' : 'text/plain',
|
||||
'bam' : 'application/octet-stream',
|
||||
'bed' : 'text/plain',
|
||||
'blastxml' : 'text/plain',
|
||||
'blastxml' : 'application/xml',
|
||||
'customtrack' : 'text/plain',
|
||||
'csfasta' : 'text/plain',
|
||||
'fasta' : 'text/plain',
|
||||
@@ -200,6 +200,7 @@ class Registry( object ):
|
||||
'laj' : 'text/plain',
|
||||
'lav' : 'text/plain',
|
||||
'maf' : 'text/plain',
|
||||
'memexml' : 'application/xml',
|
||||
'pileup' : 'text/plain',
|
||||
'qualsolid' : 'text/plain',
|
||||
'qualsolexa' : 'text/plain',
|
||||
|
||||
@@ -26,19 +26,31 @@ class BlastXml( data.Text ):
|
||||
>>> fname = get_test_fname( 'megablast_xml_parser_test1.blastxml' )
|
||||
>>> BlastXml().sniff( fname )
|
||||
True
|
||||
>>> fname = get_test_fname( 'tblastn_four_human_vs_rhodopsin.xml' )
|
||||
>>> BlastXml().sniff( fname )
|
||||
True
|
||||
>>> fname = get_test_fname( 'interval.interval' )
|
||||
>>> BlastXml().sniff( fname )
|
||||
False
|
||||
"""
|
||||
blastxml_header = [ '<?xml version="1.0"?>',
|
||||
'<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd">',
|
||||
'<BlastOutput>' ]
|
||||
for i, line in enumerate( file( filename ) ):
|
||||
if i >= len( blastxml_header ):
|
||||
return True
|
||||
line = line.rstrip( '\n\r' )
|
||||
if line != blastxml_header[ i ]:
|
||||
return False
|
||||
#TODO - Use a context manager on Python 2.5+ to close handle
|
||||
handle = open(filename)
|
||||
line = handle.readline()
|
||||
if line.strip() != '<?xml version="1.0"?>':
|
||||
handle.close()
|
||||
return False
|
||||
line = handle.readline()
|
||||
if line.strip() not in ['<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "http://www.ncbi.nlm.nih.gov/dtd/NCBI_BlastOutput.dtd">',
|
||||
'<!DOCTYPE BlastOutput PUBLIC "-//NCBI//NCBI BlastOutput/EN" "NCBI_BlastOutput.dtd">']:
|
||||
handle.close()
|
||||
return False
|
||||
line = handle.readline()
|
||||
if line.strip() != '<BlastOutput>':
|
||||
handle.close()
|
||||
return False
|
||||
handle.close()
|
||||
return True
|
||||
|
||||
|
||||
class MEMEXml( data.Text ):
|
||||
"""MEME XML Output data"""
|
||||
|
||||
Reference in New Issue
Block a user