Skip to main content

用于操作 minimap2 的 CS 标签的 Python 模块

项目描述

执照 测试 Python 派皮 百康达

cstag

cstag是一个 Python 模块,用于操作minimap2 的 CS 标签

  • cstag.shorten(): 将 cs 标签从长格式转换为短格式
  • cstag.lengthen(): 将 cs 标签从短格式转换为长格式
  • cstag.consensus(): 从多个 cs 标签生成一个共识 cs 标签
  • cstag.mask(): 屏蔽 cs 标签中的低质量碱基
  • cstag.to_html():输出html报告

有关更多信息,请参阅文档

安装

来自PyPI

pip install cstag

来自Bioconda

conda install -c bioconda cstag

例子

缩短/延长

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

调用共识

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

屏蔽 cs 标签中的低质量碱基

import cstag

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

输出 HTML 报告

import cstag
from pathlib import Path

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

cstag_html = cstag.to_html(cs, description)
Path("report.html").write_text(cstag_html)
# => Output "report.html"

report.html:point_down:

示例报告

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

cstag-0.3.1.zip (12.1 kB 查看哈希

已上传 source