Skip to main content

Plot medaka trimmed-read length distributions across samples for target loci.

Project description

mTRplotter

PyPI

mTRplotter turns the read-length plotting logic from the notebook into a small Python CLI.

Each run also writes params.json and log.out alongside the figure and TSV outputs so the command parameters and progress logs stay with the generated results.

Installation

pip install mtrplotter

It expects a tab-delimited sample table with at least:

  • sample
  • medaka_folder
  • software (medaka or trgt)
  • flank_bp
  • any number of extra metadata columns

If --output-dir is omitted, mTRplotter writes all outputs to the current working directory.

For each requested locus, it:

  • validates medaka rows against each sample's ref_chunks.fasta
  • validates TRGT rows against each sample's .trgt.vcf.gz
  • extracts medaka reads from trimmed_reads_to_poa.bam through the BAM index
  • extracts TRGT reads from .trgt.spanning.bam
  • extracts read lengths for the requested locus or BED subset
  • writes per-read and summary tables
  • produces one figure per locus with samples on the x-axis and trimmed read length on the y-axis

Usage

Single locus:

python -m mtrplotter \
  --sample-table examples/samples.tsv \
  --region chr1:99682978-99683197 \
  --label-columns tissue_name tech core technology \
  --jobs 10

BED input:

python -m mtrplotter \
  --sample-table samples.tsv \
  --bed regions.bed \
  --output-dir results \
  --catalog-bed catalog.bed

If --catalog-bed is not provided, loci are still checked against each sample's ref_chunks.fasta, which reflects the regions actually used by the medaka run.

Metadata should already be present in the sample table. There is no separate manifest join step at runtime.

The bundled example table keeps inline columns such as tissue, tissue_name, tech, core, and technology so plotting labels can be chosen directly from the sample table.

For medaka rows, the plotted length is raw_length - 2 * flank_bp, where flank_bp comes from the sample table.

For TRGT rows, the software looks for the FL BAM tag and uses raw_length - left_flank - right_flank. If the FL tag is absent, it falls back to the sample-table flank_bp.

For TRGT rows, use the medaka_folder column as a generic input path. The most reliable form is a per-sample TRGT prefix such as:

sample	medaka_folder	software	flank_bp
SAMPLE001	/path/to/trgt/SAMPLE001	trgt	50

mTRplotter resolves the sibling files:

  • .trgt.vcf.gz
  • .trgt.spanning.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

mtrplotter-0.1.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

mtrplotter-0.1.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file mtrplotter-0.1.1.tar.gz.

File metadata

  • Download URL: mtrplotter-0.1.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mtrplotter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e0a27f59e708ab46357f2e7d19b4e74842ad777d5e0d7848e6458105087443b0
MD5 1cfd3ec421cc3459c7ef23bf6e61bccd
BLAKE2b-256 aa527bbdccb46e67094a543445fbb74d2e710e0b1dd50169949cd4abfb008c49

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtrplotter-0.1.1.tar.gz:

Publisher: publish.yml on Fu-Yilei/mTRplotter

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

File details

Details for the file mtrplotter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mtrplotter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mtrplotter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47275d2363610a6bf0389da73bda61a342d94d9c6c464e0efc1af4488c18a639
MD5 c72f2e2a39fa18201fcb2dfbc9b07327
BLAKE2b-256 293e087872d84c9b6d534fd2dfa79e618c3de62864169ee4ea3314a94710ec6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mtrplotter-0.1.1-py3-none-any.whl:

Publisher: publish.yml on Fu-Yilei/mTRplotter

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