samsum
A light-weight python package for summarizing sequence coverage from SAM and BAM files
Installation
Samsum is currently supported on Mac and Linux systems and has been tested primarily on Ubuntu operating systems
(bionic and trusty distributions).
It is a python package on the Python Package Index (PyPI) and can be installed using pip:
pip install samsum
Samsum can also be installed using conda with the command:
conda install -c bioconda samsum
You can also install samsum from source by cloning the directory from its GitHub page or downloading a GitHub release.
git clone https://github.com/hallamlab/samsum.git
cd samsum
python3 setup.py sdist
pip install dist/samsum*tar.gz
Usage
samsum stats will read either a SAM or BAM file (this functionality will be implemented soon) and
rapidly count the number of reads mapped to each reference sequence (e.g. contigs, scaffolds)
while also keeping track of the reads that remain unmapped.
This all occurs within the C++ Python extension.
It will then read the reference FASTA file to gather the lengths of each reference sequence.
Combining the read counts and sequence lengths, it will then calculate:
- fragments per kilobase per million (FPKM)
- transcripts per milllion (TPM)
Command-line options
By default, reads with multiple identical alignments (i.e. mapping quality is 0) are not included in these calculations.
This can be toggled off to include these alignments with the --m flag.
Another option is to drop counts for reference sequences if only a portion of a sequence is mapped to.
With the -p argument, you can control the minimum proportion a reference sequence needs to be covered
for its read counts to be included in the output; all stats are otherwise set to 0.
An example command is:
samsum stats -f ref.fasta -a alignments.sam --multireads -p 0.5 -o output_dir/samsum_table.tsv
This will include all alignments, regardless of their mapping quality but only report alignments for reference sequences that were covered across at least 50% of their length.
API
Being a python package, samsum can also be readily imported into python code and used via its API.
The function generally desired would be ref_sequence_abundances. Usage could be:
from samsum import commands
sam="/home/user/reads_to_genome.sam"
fasta="/home/user/genome.fasta"
ref_seq_abunds = commands.ref_sequence_abundances(aln_file=sam, seq_file=fasta, min_aln=10, p_cov=0, map_qual=0)
The ref_seq_abunds object is a dictionary of RefSequence instances indexed by their header/sequence names.
RefSequence objects have several variables that are of interest:
self.nameis the name of the (reference) sequence or headerself.lengthis the length (in base-pairs) of the sequenceself.reads_mappedis the number of reads that were mappedself.weight_totalis the number of fragments (float) that were mapped to the sequenceself.fpkmis Fragments Per Kilobase per Million mapped readsself.tpmis Transcripts Per Million mapped reads
Outputs
If samsum stats was executed, a "samsum_log.txt" file is written to the current working directory
(i.e. where samsum was executed from). A comma-separated value (CSV) file with the fields
"QueryName", "RefSequence", "ProportionCovered", "Coverage", "Fragments", "FPKM" and "TPM" is written to a file
path specified on the command-line, or by default "samsum_table.csv".
A TSV file can be written instead if the sep argument was modified to 'tab'.
Metadata
Release files for samsum 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| samsum-0.1.4.tar.gz | 1.7 MB | Without provenance | Details for samsum-0.1.4.tar.gz |
Built distributions (wheels)
Total release size: 3.1 MB
Release files / samsum-0.1.4.tar.gz
| Download URL | samsum-0.1.4.tar.gz |
|---|---|
| Size | 1.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36b1fc0eaa4da1b7a70d2791357c7547612c9653e4e0ea7db39ba96cdd03ffc5
|
|
BLAKE2b-256 checksum How to use checksums |
2e7297a9685d229361484444748f4cd9be3ea9ce3abbe2c0fa21b336ee9c071f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp38-cp38-manylinux2014_x86_64.whl
| Download URL | samsum-0.1.4-cp38-cp38-manylinux2014_x86_64.whl |
|---|---|
| Size | 396.4 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c592f7a74370e3306174cf6cca479227b38385eb11805f4ddb42fae8b19fa891
|
|
BLAKE2b-256 checksum How to use checksums |
2840331693ef76326d004d38d5900b14f14599725c1f890f7093f3eda7cfdf8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp38-cp38-macosx_10_14_x86_64.whl
| Download URL | samsum-0.1.4-cp38-cp38-macosx_10_14_x86_64.whl |
|---|---|
| Size | 57.1 kB |
| Tags | CPython 3.8 macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
02d33ae2d7517252c63ccde0be796625511786c7e408d644729dde3a52ce383f
|
|
BLAKE2b-256 checksum How to use checksums |
e713968d6eb46778e3b8bb7c6bdf398c28e5da166e8a00e2ff4501af5fa62e6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp37-cp37m-manylinux2014_x86_64.whl
| Download URL | samsum-0.1.4-cp37-cp37m-manylinux2014_x86_64.whl |
|---|---|
| Size | 398.6 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
7a820cadafdd471420f8968e605ea6bc9d7a4b7897d5590a2de91c4f34cb0e97
|
|
BLAKE2b-256 checksum How to use checksums |
875cbe99b14614b7c77671abf76313da642f7ccbfe96710a6910a31daacfbca2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp37-cp37m-macosx_10_14_x86_64.whl
| Download URL | samsum-0.1.4-cp37-cp37m-macosx_10_14_x86_64.whl |
|---|---|
| Size | 57.2 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
1689806f51e4303c72f439b68e10a04ca68338de4434e78e1d5092f87fa428b0
|
|
BLAKE2b-256 checksum How to use checksums |
4f23480f4f8706bfeb36af32c265aa2507f4f75c58d29852ab58f172b9c057c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp36-cp36m-manylinux2014_x86_64.whl
| Download URL | samsum-0.1.4-cp36-cp36m-manylinux2014_x86_64.whl |
|---|---|
| Size | 395.8 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
4b7008c8c6ded9594a562423324bb88092a0aec396e16b48907e00f30290033c
|
|
BLAKE2b-256 checksum How to use checksums |
1cd6dd28fffbce4b3a4d5bf0714816c9762d422ab6ff16f545417739cb1fea08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Release files / samsum-0.1.4-cp36-cp36m-macosx_10_14_x86_64.whl
| Download URL | samsum-0.1.4-cp36-cp36m-macosx_10_14_x86_64.whl |
|---|---|
| Size | 57.2 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc macOS 10.14+ x86-64 |
|
SHA-256 checksum How to use checksums |
0af11ec16faf3c65e1342f925de58002a9e585a9ee376ea1b82a92be5dcf1c28
|
|
BLAKE2b-256 checksum How to use checksums |
06261e37c72dd819ace1067aac5033ad25993005992a18e0e62d2af1ad6fbc33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.7
|
Security for samsum 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.