Skip to main content

Python module to manipulate the minimap2's CS tag

Project description

Licence Docs Test Python PyPI Bioconda

cstag

cstag is a Python module to manipulate minimap2's CS tag.

  • cstag.shorten(): to convert a cs tag from long to short format
  • cstag.lengthen(): to convert a cs tag from short to long format
  • cstag.consensus(): to generate a consensus cs tag from multiple cs tags
  • cstag.mask(): to mask low-quality bases in a cs tag
  • cstag.to_html(): to output html report

See documentation for more information.

Installation

From PyPI:

pip install cstag

From Bioconda:

conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda

conda install cstag

Examples

Shorten/Lengthen

import cstag

# Convert a cs tag from long to short
cs = "cs:Z:=ACGT*ag=CGT"

cstag.shorten(cs)
# => cs:Z::4*ag:3


# Convert a cs tag from short to long
cs = "cs:Z::4*ag:3"
cigar = "8M"
seq = "ACGTACGT"

cstag.lengthen(cs, cigar, seq)
# => cs:Z:=ACGT*ag=CGT

Call consensus

import cstag

cs_list = ["cs:Z:=ACGT", "cs:Z:=AC*gt=T", "cs:Z:=C*gt=T", "cs:Z:=C*gt=T", "cs:Z:=ACT+ccc=T"]
cigar_list = ["4M", "4M", "1S3M", "3M", "3M3I1M"]
pos_list = [1, 1, 1, 2, 1]

cstag.consensus(cs_list, cigar_list, pos_list)
# => cs:Z:=AC*gt*T

Mask low-quality bases in a cs tag

import cstag

cs = "cs:Z:=ACGT*ac+gg-cc=T"
qual = "AA!!!!AA"
phred_threshold = 10
cstag.mask(cs, qual, phred_threshold)
# => cs:Z:=ACNN*an+ng-cc=T

Output HTML report

import cstag

cs = "cs:Z:=AC+GGG=T-ACGT*at~gt10cg=GNNN"
output = "report"
description = "Example"

cstag.to_html(cs, output, description)
# => Output "report.html"

The report.html is :point_down:

example_report

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cstag-0.2.2.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

cstag-0.2.2-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page