C# Class Bio.IO.BAM.BAMFormatter

Writes a SequenceAlignmentMap to a particular location, usually a file. The output is formatted according to the BAM file format. Documentation for the latest BAM file format can be found at http://samtools.sourceforge.net/SAM1.pdf
Inheritance: ISequenceAlignmentFormatter
Mostrar archivo Open project: dotnetbio/bio Class Usage Examples

Public Methods

Method Description
CompressBAMFile ( Stream reader, Stream writer ) : void

Compress the specified stream (reader) and writes to the specified stream (writer).

Format ( Stream writer, Bio.IO.BAM.BAMIndexStorage indexWriter, ISequenceAlignment sequenceAlignment ) : void

Writes specified alignment object to a stream. The output is formatted according to the BAM specification.

Format ( Stream stream, IEnumerable sequenceAlignments ) : void

Write a collection of ISequenceAlignments to a file.

Format ( Stream writer, ISequenceAlignment sequenceAlignment ) : void

Writes specified alignment object to a stream. The output is formatted according to the BAM specification. Note that this method does not create index file.

WriteAlignedSequence ( Bio.IO.SAM.SAMAlignmentHeader header, Bio.IO.SAM.SAMAlignedSequence alignedSeq, Stream writer ) : void

Writes SAMAlignedSequence to specified stream.

WriteHeader ( Bio.IO.SAM.SAMAlignmentHeader header, Stream writer ) : void

Writes BAM header to the specified stream in BAM format.

Private Methods

Method Description
CompareByChromosomeName ( Bio.IO.SAM.SAMRecordField field1, Bio.IO.SAM.SAMRecordField field2 ) : int
CreateBAMIndexFile ( Stream compressedBAMStream, Bio.IO.BAM.BAMIndexStorage indexStorage ) : void

Creates BAMIndex object from the specified BAM file and writes to specified BAMIndex file.

GetAuxiliaryDataLength ( Bio.IO.SAM.SAMAlignedSequence alignedSeq ) : int
GetBGZFStructure ( Stream compressedStream ) : byte[]

Gets BGZF structure from the GZipStream compression.

GetBlockSize ( Bio.IO.SAM.SAMAlignedSequence alignedSeq ) : int
GetCIGARLength ( string cigar ) : int
GetEOFBlock ( ) : byte[]

Gets empty block.

GetEncodedCIGAR ( string cigar ) : IList

Gets encoded CIGAR value.

GetEncodedCIGAROperation ( char operation ) : uint
GetEncodedSequence ( Bio.IO.SAM.SAMAlignedSequence alignedSeq ) : byte[]

Gets encoded sequence according to the BAM specification.

GetHeaderWithSortedSQFields ( Bio.IO.SAM.SAMAlignmentHeader header, bool canChangeOtherTagPos ) : Bio.IO.SAM.SAMAlignmentHeader
GetOptioanField ( Bio.IO.SAM.SAMOptionalField field ) : byte[]
GetOptionalFieldIntValueSize ( string value ) : int

Returns, 1 if the int value can be held in an unsinged byte. -1 if the int value can be held in a singed byte. 2 if the int value can be held in an unint16 (ushort). -2 if the int value can be held in an int16 (short). 4 if the int value can be held in an uint32. -4 if the int value can be held in an int32. 0 if the specified value can't parsed by an uint.

GetOptionalFieldValueSize ( Bio.IO.SAM.SAMOptionalField optionalField ) : int
GetQualityValue ( ISequence sequence ) : byte[]

Gets quality values from specified sequence.

GetRefSeqID ( string refSeqName ) : int
GetSQHeaders ( IList recordFields ) : IList
GetSizeOfArrayType ( char arrayType ) : int
IsSortedByChromosomeNames ( IList sqHeaders ) : bool
SortSequenceRanges ( IEnumerable ranges ) : IList
UpdateArrayType ( byte array, Bio.IO.SAM.SAMOptionalField field ) : void
ValidateAlignment ( ISequenceAlignment sequenceAlignment ) : Bio.IO.SAM.SequenceAlignmentMap
ValidateAlignmentHeader ( Bio.IO.SAM.SAMAlignmentHeader header ) : void
ValidateSQHeader ( string refSeqName ) : void
WriteAlignedSequence ( Bio.IO.SAM.SAMAlignedSequence alignedSeq, Stream writer ) : void

Writes SAMAlignedSequence to specified stream.

WriteSequenceAlignment ( ISequenceAlignment sequenceAlignment, Stream writer, Bio.IO.BAM.BAMIndexStorage indexStorage ) : void

Writes sequence alignment to specified stream.

WriteUncompressed ( Bio.IO.SAM.SequenceAlignmentMap sequenceAlignmentMap, Stream writer, bool createSortedFile ) : void

Writes specified sequence alignment to stream. The output is formatted according to the BAM structure.

WriteUncompressedSortedBAM ( Bio.IO.SAM.SequenceAlignmentMap sequenceAlignmentMap, Stream writer ) : void

Writes specified sequence alignment to stream according to the specified sorted order. The output is formatted according to the BAM structure.

Method Details

CompressBAMFile() public method

Compress the specified stream (reader) and writes to the specified stream (writer).
public CompressBAMFile ( Stream reader, Stream writer ) : void
reader Stream Stream to read from.
writer Stream Stream to write.
return void

Format() public method

Writes specified alignment object to a stream. The output is formatted according to the BAM specification.
public Format ( Stream writer, Bio.IO.BAM.BAMIndexStorage indexWriter, ISequenceAlignment sequenceAlignment ) : void
writer Stream Stream to write BAM data.
indexWriter Bio.IO.BAM.BAMIndexStorage BAMIndexFile to write index data.
sequenceAlignment ISequenceAlignment SequenceAlignmentMap object.
return void

Format() public method

Write a collection of ISequenceAlignments to a file.
public Format ( Stream stream, IEnumerable sequenceAlignments ) : void
stream Stream The name of the file to write the formatted sequence alignments.
sequenceAlignments IEnumerable The sequenceAlignments to write.
return void

Format() public method

Writes specified alignment object to a stream. The output is formatted according to the BAM specification. Note that this method does not create index file.
public Format ( Stream writer, ISequenceAlignment sequenceAlignment ) : void
writer Stream Stream to write BAM data.
sequenceAlignment ISequenceAlignment SequenceAlignmentMap object.
return void

WriteAlignedSequence() public method

Writes SAMAlignedSequence to specified stream.
public WriteAlignedSequence ( Bio.IO.SAM.SAMAlignmentHeader header, Bio.IO.SAM.SAMAlignedSequence alignedSeq, Stream writer ) : void
header Bio.IO.SAM.SAMAlignmentHeader Header from SAM object.
alignedSeq Bio.IO.SAM.SAMAlignedSequence SAMAlignedSequence object.
writer Stream Stream to write.
return void

WriteHeader() public method

Writes BAM header to the specified stream in BAM format.
public WriteHeader ( Bio.IO.SAM.SAMAlignmentHeader header, Stream writer ) : void
header Bio.IO.SAM.SAMAlignmentHeader SAMAlignmentHeader object
writer Stream Stream to write.
return void