Skip to main content

A package for splitting reads in BAM/FASTQ files into smaller fragments.

Project description

Bamurai

A Python package for splitting reads in BAM/FASTQ files into smaller fragments.

Description

Bamurai is a command-line tool for splitting reads in BAM/FASTQ files into smaller fragments. It is designed to be fast and efficient, and can be used to split reads into a target length or a target number of pieces per read.

These are the current features of Bamurai:

  1. Splitting reads in a file to a target length
  2. Splitting reads in a file to a target number of pieces per read
  3. Getting statistics from a BAM or FASTQ(.gz) file
  4. Basic validation of BAM and FASTQ(.gz) files

The split command splits reads into a target length, each read will be split into fragments as close to the target length as possible. Reads shorter than the target length will not be split.

The divide command splits reads into a target number of pieces, each read will be split into the number of pieces specified. A further minimum length can be specified to ensure that reads are not split if the resultant fragments are less than the minimum length.

The stats command will output the following information by default:

Statistics for input.bam:
  Total reads: 8160
  Average read length: 30638
  Throughput: 250006998
  N50: 82547

It can be used with the --tsv argument to output the statistics in a tab-separated format for computational analysis.

file_name       total_reads     avg_read_len    throughput      n50
input.bam      8160    30638   250006998       82547

The validate command will check the integrity of a BAM or FASTQ(.gz) file and output the following information if the file is valid.:

input.bam is a valid BAM file with 8160 records.

Installation

To install the released version of Bamurai from PyPI

pip install bamurai

To install the latest version of Bamurai from GitHub

pip install git+https://github.com/Shians/Bamurai.git

Usage

To get help on the command-line interface and list available commands

bamurai --help

To get help on a specific command

bamurai <command> --help

Splitting reads to target size

To split a file into 10,000 bp reads

bamurai split input.bam --target-length 10000 --output output.fastq

To create a gzipped output file

bamurai split input.bam --target-length 10000 | gzip > output.fastq.gz

Dividing reads into a target number of pieces

To divide reads into 2 pieces

bamurai divide input.bam --num_fragments 2 --output output.fastq

To divide reads into 2 pieces unless resultant fragments are less than 1000 bp

bamurai divide input.bam --num_fragments 2 --min_length 1000 --output output.fastq

Getting statistics from a BAM or FASTQ file

To get stats from a BAM file

bamurai stats input.bam

To get stats from a FASTQ file or Gzipped FASTQ file

bamurai stats input.fastq
bamurai stats input.fastq.gz

Validating BAM or FASTQ files

To validate a BAM file

bamurai validate input.bam

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

bamurai-0.4.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

bamurai-0.4.1-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file bamurai-0.4.1.tar.gz.

File metadata

  • Download URL: bamurai-0.4.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bamurai-0.4.1.tar.gz
Algorithm Hash digest
SHA256 4050ec9dac10cf62b21ffa1273e2e21be24b7e877d09a13018f4d107a4c1c9fc
MD5 f3511bb83f3034cbb55338c9a3cada9e
BLAKE2b-256 5848efbca3b6400619c61ed76d0c37836b842993ad1aade64ad72eb50adcdf44

See more details on using hashes here.

Provenance

The following attestation bundles were made for bamurai-0.4.1.tar.gz:

Publisher: publish-to-pypi.yml on Shians/Bamurai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bamurai-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: bamurai-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for bamurai-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad141b609322da65c2c89be09ed7d7579a598c2c580d3d798aadac3dfc393ab7
MD5 9b890642bb69caf7fee55c33e5a01c07
BLAKE2b-256 2d27e90e20fa2162ba0f748e3a276ff425c6496115a3fe6ae7cf59159b930da4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bamurai-0.4.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on Shians/Bamurai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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