A Python tool to filter sam/bam files by percent identity or percent of matched sequence
Percent identity is computed as:
$$PI = 100 \frac{N_m}{N_m + N_i}$$
where $N_m$ is the number of matches and $N_i$ is the number of mismatches.
Percent of matched sequences is computed as:
$$PM = 100 \frac{N_m}{L}$$
where $L$ corresponds to query sequence length.
NOTES
-
Percent of matched sequence is also an alternative definition of percent identity used in some cases, for intance, in BLAST.
-
BAM/SAM files must contain MD tags to be able to filter by percent identity. Aligners such as BWA add MD tags to each queried sequence in a BAM file. MD tags can also be generated with samtools.
Installation
pip install filtersam
Usage
You can find a jupyter notebook with usage examples here.
Citation
If you use this software, please cite it as below:
Robaina-Estévez, S. (2022). filterSAM: filter sam/bam files by percent identity or percent of matched sequence (Version 0.0.11)[Computer software]. https://doi.org/10.5281/zenodo.7056278.
Metadata
Release files for filtersam-tools 0.0.11
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 |
|---|---|---|---|---|
| filtersam_tools-0.0.11.tar.gz | 11.7 kB | With provenance | Details for filtersam_tools-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| filtersam_tools-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for filtersam_tools-0.0.11-py3-none-any.whl |
Total release size: 22.3 kB
Release files / filtersam_tools-0.0.11.tar.gz
| Download URL | filtersam_tools-0.0.11.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8557f3b1f2da22dd5ad7279edf19ed1982aa5155008e4e1308bbb97130b554a
|
|
BLAKE2b-256 checksum How to use checksums |
ca0c76209641972ab02b80cf359ddee92a8eb976d5265ce14f5a6240d98895f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logRelease files / filtersam_tools-0.0.11-py3-none-any.whl
| Download URL | filtersam_tools-0.0.11-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f704a93098eb7aa60a570f3e77964587195ca465c532b73837be7439fc78f08
|
|
BLAKE2b-256 checksum How to use checksums |
99274a75e18ec18cda710916c9e0e8727f63dd7947a742d58eadea3882e8ae29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logSecurity for filtersam-tools 0.0.11
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for filtersam_tools-0.0.11.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 19, 2026.
Transparency logA 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.