Back to Skills

pysam

Genomic file toolkit. Read/write SAM/BAM/CRAM alignments, VCF/BCF variants, FASTA/FASTQ sequences, extract regions, calculate coverage, for NGS data processing pipelines.

17,798stars1,609forksUpdated 1/21/2026

Security Assessment

Safe(100/100)
Security Score100/100

About pysam

Pysam is a powerful Python module designed for the efficient reading, manipulation, and writing of genomic datasets, specifically tailored for working with various formats such as SAM, BAM, CRAM for alignment files, VCF, and BCF for variant files, as well as FASTA and FASTQ for sequence data. This skill addresses the complexities involved in processing next-generation sequencing (NGS) data, making it accessible and manageable for bioinformaticians, researchers, and data scientists who require precise control over genomic data workflows. By providing a Pythonic interface to the underlying htslib, Pysam enables users to perform a wide range of operations without delving deeply into lower-level programming intricacies.

The main features of Pysam include robust file handling capabilities for alignment, variant, and sequence files, along with advanced querying functionalities. Users can efficiently extract reads or variants from specified genomic regions, calculate coverage and read depth, and perform quality control checks. Pysam also supports various operations such as filtering, annotation, and creating new files, which are essential for comprehensive bioinformatics analysis pipelines. Its integration with elements like pileup analysis and random access to sequences further enhances its utility for various genomic research projects.

Pysam is particularly beneficial for professionals working in genomics, bioinformatics, and computational biology. It is ideal for tasks such as variant calling, data preprocessing, and analysis pipelines that involve large-scale genomic data. Whether users are extracting specific regions of interest, analyzing genetic variants, or processing raw sequencing reads, Pysam serves as a versatile toolkit to streamline their workflows and improve the efficiency of genomic data analysis.

FAQ

How do I install Pysam?

You can install Pysam using pip with the command 'pip install pysam'.

What file formats does Pysam support?

Pysam supports SAM, BAM, CRAM for alignment files, VCF and BCF for variant files, and FASTA and FASTQ for sequence data.

Can Pysam handle large genomic datasets?

Yes, Pysam is optimized for performance and can efficiently manage large genomic datasets, making it suitable for NGS data processing.

Is there any specific Python version required for Pysam?

While the documentation does not specify a Python version, it is generally recommended to use Python 3 for compatibility.

Can I filter variants using Pysam?

Yes, Pysam allows you to filter variants based on various criteria such as quality and allele frequency.

Install pysam

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill