Skip to main content

Oxford Nanopore Technologies logo

Mapula

This package provides a command line tool that is able to parse alignments in SAM format and produce a range of useful stats.

Mapula provides several subcommands, use --help with each one to find detailed usage instructions.

install with bioconda

Installation

Count mapula can be installed following the usual Python tradition:

pip install mapula

Or via conda:

conda install mapula

Usage

$ mapula -h
usage: mapping-stats <command> [<args>]"

Available subcommands are:
    count        Count mapping stats from a SAM/BAM file
    merge        Combine mapula count's json outputs

Collects stats from SAM/BAM files

positional arguments:
  command     Subcommand to run

optional arguments:
  -h, --help  show this help message and exit

The main subcommand command is mapula count. This command can accept one or several input SAM or BAM files and outputs mapping statistics.

Alignments are grouped by user-specifiable criteria, -s. These aggregations can then be output in two formats using -f. The default .csv format is the most easily iterpretable for a quick glance, or for onward programmatic analysis the .json output contains a more in-depth view of the data.

Examples

Output some stats in .csv format containing mapping stats:

mapula count <paths_to_sam_or_bam> -r <path_to_a_reference_fasta>

Split stats only by read_group and barcode:

mapula count <paths_to_sam_or_bam> -r <path_to_a_reference_fasta> -s barcode read_group

Output some stats in both .csv and .json format:

mapula count
  <paths_to_sam_or_bam> -f all -r <path_to_a_reference_fasta> <path_to_a_reference_fasta>

Accept multiple alignment and reference inputs

mapula count
  <paths_to_sam_or_bam> <paths_to_sam_or_bam> -r <path_to_a_reference_fasta> <path_to_a_reference_fasta>

Receive some SAM or BAM from stdin, output stats in .csv, and pipe the SAM records onwards:

minimap2 -y -ax map-ont <path_to_a_reference_fasta> *_reads.fastq \
  | mapula -r <path_to_a_reference_fasta> -f csv -p \
  | samtools sort -o sorted.aligned.bam

Important: tags

At present, for access to barcode, run_id, read_group, mapula depends on tags being available within the input SAM records, as follows:

  • barcode = bc
  • run_id = rd
  • read_group = rg

If these are not available, Mapula will just provide a placeholder of Unknown. The minimap2 flag -y can carry information from the .fastq header into the records it creates to faciliate this transfer of information.


Help

Licence and Copyright

© 2021- Oxford Nanopore Technologies Ltd.

mapula is distributed under the terms of the Mozilla Public License 2.0.

Research Release

Research releases are provided as technology demonstrators to provide early access to features or stimulate Community development of tools. Support for this software will be minimal and is only provided directly by the developers. Feature requests, improvements, and discussions are welcome and can be implemented by forking and pull requests. However much as we would like to rectify every issue and piece of feedback users may have, the developers may have limited resource for support of this software. Research releases may be unstable and subject to rapid iteration by Oxford Nanopore Technologies.

Metadata

Release files for mapula 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mapula 2.1.2
File Size Uploaded
mapula-2.1.2.tar.gz 17.4 kB Details

Release files / mapula-2.1.2.tar.gz

Download URL mapula-2.1.2.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd0798aca0f40cd5e9f46897a25d431d952e4b3e872cacc0d8c4cc1903f1eb42
BLAKE2b-256 checksum
How to use checksums
279a3a36d22ce981781c1ba953f98f8bb0069c2ab1989218ed0964cdb228e8d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

2.1.2 This release

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.1.0

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page