Skip to main content

ngstoolkits

Project description

Author : Liubo <Ben-unbelieveable>

ngstoolkits

NGS(下一代测序)数据分析工具包

主要功能类

CPRA

用于表示和分析变异位点的类。支持加载参考基因组和BAM文件进行深入分析。

from ngstoolkits import CPRA

# 初始化变异对象
mut = CPRA("chr6", 159188398, "C", "T")

# 加载必要文件
CPRA.loadBam("sample.bam")
CPRA.loadReference("reference.fa")

# 获取变异支持信息
mut.get_suppot()

# 访问分析结果
print(mut.supportReadNum)  # 支持该变异的reads数量
print(mut.CoverReadNum)    # 覆盖该位点的总reads数量
print(mut.ratio)           # 变异频率

BAM

用于处理BAM文件的工具类。

from ngstoolkits import BAM
import pysam

bam = BAM(pysam.AlignmentFile("sample.bam"))

# 获取特定位点的碱基统计
counts = bam.get_base_count_per_position("chr1", 1000)
print(counts)  # 返回 [A数量, C数量, G数量, T数量, 总数量]

# 获取区域平均深度
depth, details = bam.get_region_depth("chr1", 1000, 2000)

SeqFunction

提供序列处理的静态方法。

from ngstoolkits import SeqFunction

# 获取反向互补序列
rev_comp = SeqFunction.reverse_complement("ATGC")  # 返回 "GCAT"

# 计算GC含量
gc = SeqFunction.GC_content("ATGC")  # 返回 0.5

FASTA

用于处理FASTA文件的工具类。

from ngstoolkits import FASTA

fa = FASTA("reference.fa")
gc_rate = fa.gc_rate_special_region("chr1", 1000, 2000)

安装

pip install ngstoolkits

依赖

  • Python >= 3.8
  • pysam

许可证

MIT License

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

ngstoolkits-1.0.1rc1.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ngstoolkits-1.0.1rc1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file ngstoolkits-1.0.1rc1.tar.gz.

File metadata

  • Download URL: ngstoolkits-1.0.1rc1.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for ngstoolkits-1.0.1rc1.tar.gz
Algorithm Hash digest
SHA256 a88c5d24c1feac4fb18d6b3d30dfbbaa82ad1d330e1f4f572766dc7d7567d76f
MD5 2e33d7c2444595c17b93d2302fd140a4
BLAKE2b-256 05b608b7e0a8bc06646344cfea12e3ea1341ff42a807c9fe201ccf336148c527

See more details on using hashes here.

File details

Details for the file ngstoolkits-1.0.1rc1-py3-none-any.whl.

File metadata

  • Download URL: ngstoolkits-1.0.1rc1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for ngstoolkits-1.0.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 5472425f7e84d93f71649f9e15f6d0d28c4fbd26429f75045a6dac77d6f0defd
MD5 d5fc04080828942c814e1b706cb172a0
BLAKE2b-256 610adddd33b5e15e59df2c58720c9f6bdaae85d3246ea4664a6f5c0f55f9b653

See more details on using hashes here.

Supported by

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