Skip to content
Dan Katzel edited this page Jul 22, 2017 · 1 revision

Cigar

The org.jcvi.jillion.sam.cigar package contains classes for working with CIGAR formatted read alignments.

The org.jcvi.jillion.sam.cigar.Cigar class is the main Jillion CIGAR class and an instance of Cigar represents a single read alignment.

Methods of Cigar Object:

    Range getValidRange();
 
    String toCigarString();
 
    NucleotideSequence toGappedTrimmedSequence(NucleotideSequence rawUngappedSequence)
 
}

getValidRange() return a Range of the region of the read that is not clipped.

toGappedTrimmedSequence() takes the original full length ungapped sequence such as the sequence from the input fastq file and returns a new NucleotideSequence object that is clipped and gapped according to the Cigar specification.

Factory method to parse CIGAR strings

The Cigar.parse(String) is a factory method for parsing CIGAR formatted strings into a Jillion Cigar Object.

Cigar cigar1 = Cigar.parse("8M2I40M1D3M");
 
Cigar cigar2 = Cigar.parse("6H5M");

Using Cigar Builder class

Jillion also comes with a Builder class to programmatically construct Cigar objects using the Builder pattern:

//same as Cigar.pares("8M2I40M1D3M")
Cigar cigar = new Cigar.Builder()
			.addElement(CigarOperation.ALIGNMENT_MATCH, 8)
			.addElement(CigarOperation.INSERTION, 2)
			.addElement(CigarOperation.ALIGNMENT_MATCH, 40)
			.addElement(CigarOperation.DELETION, 1)
			.addElement(CigarOperation.ALIGNMENT_MATCH, 3)
			.build();

Clone this wiki locally