https://github.com/cdcgov/tn93

Tamura-Nei distance calculation

https://github.com/cdcgov/tn93

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: pubmed.ncbi, ncbi.nlm.nih.gov
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Tamura-Nei distance calculation

Basic Info
  • Host: GitHub
  • Owner: CDCgov
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 181 KB
Statistics
  • Stars: 7
  • Watchers: 2
  • Forks: 5
  • Open Issues: 1
  • Releases: 13
Created almost 4 years ago · Last pushed over 2 years ago
Metadata Files
Readme Contributing Code of conduct

README.md

Tamura-Nei Distance Calculation with Python

Unit Tests Deployed Package

Overview

This repository contains a Python implementation of the Tamura-Nei (TN93) distance calculation. When provided with two sequences to compare, this software returns a distance value between 0 and 1 using the Tamura-Nei nucleotide substitution model. See Estimation of the number of nucleotide substitutions in the control region of mitochondrial DNA in humans and chimpanzees for more information on the algorithm. This software has been developed by the Molecular Epidemiology and Bioinformatics Team in the Division of HIV/AIDS Prevention, NCHHSTP.

Usage

This tool is primarily meant as a library to be imported and used in custom analysis code, but can also be used to directly calculate the pairwise distances for a set of sequences in a FASTA file.

First, install using pip

bash pip install tn93

or clone this respository and copy src/tn93/tn93.py to your working directory. To calculate the distance between a pair of sequences,

```python from Bio import SeqIO import tn93

Read in a FASTA file to get sequences

seqs = [ x for x in SeqIo.parse("yoursequences.fasta", format="fasta") ] tn93 = tn93.TN93() distance = tn93.tn93distance(seqs[0], seqs[1], "RESOLVE") ```

Alternatively, the module can be run from the command line and provided with a sequence file and match mode to produce a JSON file with the pairwise distances.

bash python tn93.py --input_file example_seqs.fasta --match_mode RESOLVE --output example_seqs_resolve_distance.json

By default, the software produces distances in the form ID1,ID2,Distance

Selecting JSON output produces distances in the form {"ID1": ID1, "ID2": ID2, "Distance": Distance}

There are four distinct match modes:

  • SKIP, which ignores ambiguous positions
  • GAPMM, which treats gaps appearing in only one sequence as mismatches
  • AVERAGE, which takes the average of the possible resolution values
  • RESOLVE, which tries to resolve the ambiguity to a single nucleotide, averages if that fails

``` usage: tn93.py [-h] -i INPUTFILE -m MATCHMODE -o OUTPUT [-g MAXAMBIGFRACTION] [-v] [-n] [-j]

optional arguments: -h, --help show this help message and exit -i INPUTFILE, --inputfile INPUTFILE Path to the input fasta file -m MATCHMODE, --matchmode MATCHMODE How to handle ambiguities. This can be one of four options: average - Averages the possible nucleotide values for each ambiguity in a sequence; resolve - Tries to resolve ambiguities; skip - Ignores gaps and ambiguities; gapmm - Treats gaps in only one sequence as 'N's; -o OUTPUT, --output OUTPUT The name of the output file to create -g MAXAMBIGFRACTION, --maxambigfraction MAXAMBIGFRACTION Sequences that have proportions of ambiguities lower than this value will be resolved, otherwise they will be averaged (RESOLVE only) (Default: 1.0) -v, --verbose Verbosity, One copy prints intermediate values and final counts, two copies produces a CSV file with pairwise counts for each non-gap nucleotide -n, --ignoreterminalgaps Should gaps at the beginning and end of a sequence be ignored (GAPMM only)? (Default: False) -j, --json_output Should the output be in JSON format? (Default: False) ```

Related documents

Public Domain Standard Notice

This repository constitutes a work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. This repository is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication. All contributions to this repository will be released under the CC0 dedication. By submitting a pull request you are agreeing to comply with this waiver of copyright interest.

License Standard Notice

The repository utilizes code licensed under the terms of the Apache Software License and therefore is licensed under ASL v2 or later.

This source code in this repository is free: you can redistribute it and/or modify it under the terms of the Apache Software License version 2, or (at your option) any later version.

This source code in this repository is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache Software License for more details.

You should have received a copy of the Apache Software License along with this program. If not, see http://www.apache.org/licenses/LICENSE-2.0.html

The source code forked from other open source projects will inherit its license.

Privacy Standard Notice

This repository contains only non-sensitive, publicly available data and information. All material and community participation is covered by the Disclaimer and Code of Conduct. For more information about CDC's privacy policy, please visit http://www.cdc.gov/other/privacy.html.

Contributing Standard Notice

Anyone is encouraged to contribute to the repository by forking and submitting a pull request. (If you are new to GitHub, you might start with a basic tutorial.) By contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users under the terms of the Apache Software License v2 or later.

All comments, messages, pull requests, and other submissions received through CDC including this GitHub page may be subject to applicable federal law, including but not limited to the Federal Records Act, and may be archived. Learn more at http://www.cdc.gov/other/privacy.html.

Records Management Standard Notice

This repository is not a source of government records, but is a copy to increase collaboration and collaborative potential. All government records will be published through the CDC web site.

Additional Standard Notices

Please refer to CDC's Template Repository for more information about contributing to this repository, public domain notices and disclaimers, and code of conduct.

Owner

  • Name: Centers for Disease Control and Prevention
  • Login: CDCgov
  • Kind: organization
  • Email: data@cdc.gov
  • Location: Atlanta, GA

CDC's collaborative software projects to protect America from health, safety, and security threats, both foreign and in the U.S.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 1
  • Fork event: 2
Last Year
  • Issues event: 1
  • Watch event: 1
  • Fork event: 2

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 59
  • Total Committers: 2
  • Avg Commits per committer: 29.5
  • Development Distribution Score (DDS): 0.085
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Reagan Kelly y****9@c****v 54
Dan Novikov d****v@o****t 5
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 2
  • Total pull requests: 3
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 6 days
  • Total issue authors: 2
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • shencangsheng (1)
  • reagank (1)
  • AndreaAguadoM (1)
Pull Request Authors
  • dannovikov (4)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 27 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 16
  • Total maintainers: 1
pypi.org: tn93

A python implementation of the Tamura-Nei pairwise distance calculation

  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 27 Last month
Rankings
Dependent packages count: 6.6%
Downloads: 17.1%
Average: 18.1%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 10 months ago

Dependencies

.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/python-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
pyproject.toml pypi