Skip to content

cigar_maplen

Maksim Sikolenko edited this page Jan 3, 2025 · 2 revisions

cigar_maplen

Description

The script prints which portion of a read is actually mapped, and which portions are clipped from each side. It might be useful for manual inspection of structural variants.

Example:

Input (a CIGAR string): 10H136M1I341M1D8M2D725M23912H

Output:

           10-H|          1,211|       23,912-H

Depencencies

The script is written in Python, so you need Python interpreter (version 3.X) to use it. Here you can download Python.

Usage

Mode 1: pass CIGAR strings as arguments.

One argument

./calc_cigar_qlen.py 32S67M8S

More than one argument

./calc_cigar_qlen.py 32S67M8S 12S67M1D34M18S

Mode 2: read CIGAR lines from stdin.

samtools view my.bam \
    | grep '26298e7e-f75d-43e9-a97e-8a962cadad1a' \
    | cut -f6 \
    | ./calc_cigar_qlen.py
Clone this wiki locally