CRAM format

This commit is contained in:
youri
2015-11-16 22:57:02 +01:00
parent 0b788e9731
commit d40d384a86
2 changed files with 36 additions and 0 deletions
+2
View File
@@ -16,6 +16,7 @@
<display file="igv/bam.xml" />
<display file="igb/bam.xml" />
</datatype>
<datatype extension="cram" type="galaxy.datatypes.binary:CRAM" mimetype="application/octet-stream" display_in_upload="true" description="CRAM is a file format for highly efficient and tunable reference-based compression of alignment data." description_url="http://www.ebi.ac.uk/ena/software/cram-usage"/>
<datatype extension="bed" type="galaxy.datatypes.interval:Bed" display_in_upload="true" description="BED format provides a flexible way to define the data lines that are displayed in an annotation track. BED lines have three required columns and nine additional optional columns. The three required columns are chrom, chromStart and chromEnd." description_url="https://wiki.galaxyproject.org/Learn/Datatypes#Bed">
<converter file="bed_to_gff_converter.xml" target_datatype="gff"/>
<converter file="bed_to_bgzip_converter.xml" target_datatype="bgzip"/>
@@ -442,6 +443,7 @@
<sniffer type="galaxy.datatypes.proteomics:MzSQlite"/>
<sniffer type="galaxy.datatypes.binary:SQlite"/>
<sniffer type="galaxy.datatypes.binary:Bam"/>
<sniffer type="galaxy.datatypes.binary:CRAM"/>
<sniffer type="galaxy.datatypes.binary:Sff"/>
<sniffer type="galaxy.datatypes.binary:Sra"/>
<sniffer type="galaxy.datatypes.xml:Phyloxml"/>
+34
View File
@@ -456,6 +456,40 @@ class Bam( Binary ):
Binary.register_sniffable_binary_format("bam", "bam", Bam)
class CRAM( Binary ):
file_ext = "cram"
edam_format = "format_3462"
MetadataElement( name="cram_version", default=None, desc="CRAM Version", param=MetadataParameter, readonly=True, visible=False, optional=False, no_value=None )
def set_meta( self, dataset, overwrite=True, **kwd ):
try:
with open(dataset.file_name, "r") as fh:
header = fh.read(6)
dataset.metadata.cram_version = str(ord(header[4]))+"."+str(ord(header[5]))
except Exception as exc:
log.warn( '%s, set_meta Exception: %s', self, exc )
def set_peek( self, dataset, is_multi_byte=False ):
if not dataset.dataset.purged:
dataset.peek = 'CRAM binary alignment file'
dataset.blurb = 'binary data'
else:
dataset.peek = 'file does not exist'
dataset.blurb = 'file purged from disk'
def sniff( self, filename ):
try:
header = open( filename ).read(4)
if header[0:4] == "CRAM":
return True
return False
except:
return False
Binary.register_sniffable_binary_format('cram', 'cram', CRAM)
class Bcf( Binary):
"""Class describing a BCF file"""
edam_format = "format_3020"