Questions tagged [cigar]

A string present in each line of a SAM/BAM alignment file used to describe the similarity and differences between a read and the region it aligns to in the reference genome. The CIGAR string records the matching, mismatching and indels in the read compared to the reference. For example, a CIGAR string could encode a read that has 50 matches, followed by a deletion, followed by another 50 matching bases.

Filter by
Sorted by
Tagged with
1 vote
0 answers
86 views

Extract read names and the associated nucleotides on specific positions from a BAM file (in R)

Let's assume I have a BAM file and several positions that I would like to examine more closely in this alignment. My goal is to find out whether these positions are on the same reads and which ...
user avatar
  • 11
6 votes
1 answer
351 views

Is there an efficient way to extract CIGAR strings for read pairs from bam files with python?

I am working with bam files and I have to check if reads of a specific position or their mates are soft clipped. So, I am looking for a fast way to extract the read pairs from a bam file in python. So ...
user avatar
  • 61
1 vote
1 answer
151 views

What does presence/absence of black lines mean in IGV?

IGV (Integrated Genome Viewer) is a popular open-source tool for viewing alignment files. In my BAM file in IGV, some deletions have black lines running through them, and others don't. What causes ...
user avatar
  • 282
1 vote
2 answers
354 views

Extract end position from CIGAR

I was wondering how could I obtain the end position of an alignment using its start position and its CIGAR String. If an alignment present some soft clipping, for example: ...
user avatar
  • 135
3 votes
1 answer
2k views

How do I find split reads?

How can I detect a split read in a BAM file? Is there any sign in the CIGAR string that describes split read?
user avatar
5 votes
2 answers
267 views

Is there a Python/R package with the ability to convert an alignment and reference into a CIGAR?

I'm writing a python function from scratch to do this, but I feel like this must exist in some standard bioinformatics library already. In principle, this is a simply regex operation which many must ...
user avatar
  • 1,363
7 votes
2 answers
2k views

Extracting the CIGAR string from a BAM via Python?

Is there a standard method in Python to extract a CIGAR string from the BAM? There are great libraries which parse the CIGAR, e.g. https://pypi.python.org/pypi/cigar/0.1 ...
user avatar
5 votes
1 answer
140 views

Is the optional SAM NM field strictly computable from the MD and CIGAR?

From SAM Optional Fields Specification the NM field is Edit distance to the reference, including ambiguous bases but excluding clipping Assuming both the MD and CIGAR are present, is the edit ...
user avatar
  • 724
6 votes
1 answer
617 views

How should the SAM MD tag match the CIGAR string?

I am trying to understand how the MD:Z tag is used. The following is from the SAM Optional Fields Specification, which gives an example but is not thorough. The MD field aims to achieve SNP/indel ...
user avatar
  • 724