Skip to Main Content Skip to Search
Product Documentation

align2cigar - Convert aligned sequences to corresponding Compact Idiosyncratic Gapped Alignment Report (CIGAR) format strings

Syntax

[Cigars,Starts] = align2cigar(Alignment,Ref)

Description

[Cigars,Starts] = align2cigar(Alignment,Ref) converts aligned sequences represented in Alignment, a cell array of aligned strings or a character array, into Cigars, a cell array of corresponding CIGAR strings, using the reference sequence specified by Ref, a string. It also returns Starts, a vector of integers indicating the start position of each aligned sequence with respect to the ungapped reference sequence.

Input Arguments

Alignment

Cell array of aligned sequence strings or a character array representing aligned sequences. Soft clippings are assumed to be represented by lowercase letters in the aligned sequences. Skipped positions are assumed to be represented by . in the aligned sequences.

Ref

String specifying an aligned reference sequence. The length of Ref must equal the number of columns in Alignment.

Output Arguments

Cigars

Cell array of CIGAR strings corresponding to each aligned sequence in Alignment.

Starts

Vector of integers indicating the start position of each aligned sequence with respect to the ungapped reference sequence.

Examples

Create a cell array of aligned strings, create a string specifying a reference sequence, and then convert the alignment to CIGAR strings:

aln = ['ACG-ATGC'; 'ACGT-TGC'; '  GTAT-C']
aln =

ACG-ATGC
ACGT-TGC
  GTAT-C
ref =  'ACGTATGC';
[cigar, start] = align2cigar(aln, ref)
cigar = 

    '3M1D4M'    '4M1D3M'    '4M1D1M'


start =

     1     1     3

References

[1] Li, H., Handsaker, B., Wysoker, A., Fennell, T., Ruan, J., Homer, N., Marth, G., Goncalo, A., and Durbin, R. (2009). The Sequence Alignment/Map format and SAMtools. Bioinformatics 25, 16, 2078–2079.

See Also

BioMap | cigar2align | getAlignment | getBaseCoverage | getCompactAlignment | multialign

How To

Related Links

  


Free Computational Biology Interactive Kit

See how to analyze, visualize, and model biological data and systems using MathWorks products.

Get free kit

Trials Available

Try the latest computational biology products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS