Skip to main content

A python tool used to automatically genotype rhinovirus.

Project description

rhinotype

rhinotype: A Python Package for the Classification of Rhinoviruses

Table of contents

  1. Background
  2. Workflow
  3. Installation
  4. getprototypeseqs
  5. readfasta
  6. SNPeek
  7. assign_types
  8. pairwise_distances
  9. overall_mean_distance
  10. count_SNPs
  11. plot_frequency
  12. plot_distances
  13. plot_tree
  14. plot_AA
  15. Citation
  16. Contributors

Background

Among the major causes of human respiratory infections, rhinovirus causes around 50% of all the year-round cases of common cold. This virus belongs to the Enterovirus genus in the Picornaviridae family. RV-A, RV-B, and RV-C are the three species under the genus Rhinovirus, each having about 169 different genotypes. Rhinoviruses are positive-sense, non-enveloped RNA viruses with approximately 7.2 kilobases long genome. The genome codes for seven non-structural proteins and four structural proteins—VP1, VP2, VP3, and VP4—which are part of the genome encoding viral replication and host infection mechanisms. Genotyping of Rhinovirus, until now, is done manually, while an R software package, rhinotypeR, allows for fully automated genotyping based on the VP4 region. The Python rhinovirus type package brings out VP1 and VP4 regions that aim to improve acuity in genotyping. The VP1 region has been tested to display better acuity in genotypic identification, while the VP4/2 region ensures compatibility under one universal amplification protocol for rapid genotyping.

Workflow

Workflow

Installation

You can install the package using the following command:

pip install rhinotype

Note: This package requires MAFFT for sequence alignment. Please ensure that you have MAFFT installed and that it is available in your system's PATH.

Run the package

The tool can process VP1 and VP4/2 regions simultaneously or individually:

# Process VP1 sequences
rhinotype --vp1 my_vp1.fasta

# Process VP4/2 sequences
rhinotype --vp42 my_vp42.fasta

# Process both regions
rhinotype --vp1 my_vp1.fasta --vp42 my_vp42.fasta

# Customize threshold and model
rhinotype --vp1 my_vp1.fasta --threshold 0.13 --model p-distance

Common Flags:

  • --vp1: Path to VP1 FASTA file.
  • --vp42: Path to VP4/2 FASTA file.
  • --threshold: Pairwise distance threshold (default: 0.13 for VP1, 0.105 for VP4/2).
  • --model: Evolutionary model (p-distance, jc69, k2p, tn93).
  • --threads: Number of threads for MAFFT alignment (default: 2).
  • --pre-aligned: Skip MAFFT alignment and use the input file as a pre-aligned FASTA (must include prototypes).
  • --start / --end: Custom range for SNPeek visualization.

Outputs

All outputs are uniquely timestamped to prevent overwriting previous runs:

  1. Reports: Genotyping results are saved as CSV files in the reports/ directory (e.g., reports/my_file_Vp1_20260313_120000.csv).
  2. Figures: Visualizations (SNPeek, Frequency, Distances, Tree, and Amino Acid plots) are saved in the figures/ directory.
  3. Logs: Execution details and any errors are logged in the logs/ directory.
  4. Alignments: Intermediate MAFFT alignments and combined reference/query files are saved in the current working directory.

getprotypeseqs

Gets the prototype sequences of the Rhinovirus genotypes and save the reference fasta file into RVRefs directory. Making both VP1 and VP4/2 sequences available depending on whch region you have. The tool then combines user sequences together with the prototype sequences and align them using MAFFT or any other alignment tool.

readfasta

Reads the alignments/sequences. Compares the input sequences and pads the short sequences with - until they are long as the longest sequence. The sequences are then stored in a dictionary with the sequence name as the key and the sequence as the value.

SNPeek

SNPeek function visualizes single nuclotide polymorphisms(SNPs) using the users sequences, relative to a specified reference sequence. To specify a reference sequence, the user should move the sequence to the bottom of the alignment. Substitutions are color coded by nucleotide: A = green, T = red, C = blue, G = yellow.

assign_types

The assign_types function assigns genotype to the sequences in the fasta file by comparing them to the prototype sequences. The classification is based on pairwise distances calculated using a specified distance model. Users can adjust parameters for gap deletion and threshold to control the classification process. The function reads prototype sequences from predefined CSV files based on the specified prototype type.

Parameters:

  • fasta_data (DataFrame): A DataFrame containing the sequences to be classified.
  • model (str): The distance model to use (default is 'p-distance').
  • gap_deletion (bool): Whether to apply gap deletion in distance calculations (default is True).
  • threshold (float): The distance threshold for classification (default is 0.105)

pairwise_distances

Calculates pairwise genetic distances between sequences in a FASTA dataset using the specified distance model. The function supports various models for distance calculation and can optionally apply gap deletion. The result is a DataFrame showing the distances between each pair of sequences.

Parameters:

  • fasta_data (DataFrame): A DataFrame containing the sequences to be analyzed.
  • model (str): The distance model to use. Options include:
    • "p-distance": Simple proportion of differing sites.
    • "JC": Jukes-Cantor model.
    • "Kimura2p": Kimura 2-parameter model.
    • "Tamura3p": Tamura 3-parameter model.
  • gap_deletion (bool): Whether to apply gap deletion in the distance calculation (default is True).
  • Output: The function returns a numpy array containing the pairwise distances between the sequences

overall_mean_distance

Calculates the overall mean genetic distance between sequences using various distance models. The function supports multiple models and can optionally handle gap deletion in sequences. It provides an average distance value based on the chosen model.

count_SNPs

Counts the single nucleotide polymorphisms (SNPs) in the provided sequence data and can optionally handle gap deletion in the sequences.

plot_frequency

Generates a bar chart visualizing the frequency of assigned types from a DataFrame. The function creates a bar chart where each bar represents the count of a specific type, and colors are used to differentiate between species. The chart is saved as an image file and can optionally include a legend.

plot_distances

Generates a heatmap to visualize the pairwise genetic distances between sequences and saves the plot as an image file. The color scale represents the magnitude of genetic distances.

plot_tree

Generates a hierarchical clustering dendrogram from the pairwise genetic distances between sequences. The function performs complete linkage clustering and visualizes the results as a tree diagram. The dendrogram is saved as an image file.

plot_AA

Visualizes amino acid differences between protein sequences. The function compares each sequence to a reference sequence and plots the differences as colored bars, categorizing amino acids based on their properties. The plot is saved as an image file.

Citation

Contributors

  1. Ephantus Wambui

  2. Daniel Okoro

  3. Andrew Acheampong

  4. Parcelli Jepchirchir

  5. Olaitan I. Awe

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

rhinotype-3.0.0.tar.gz (219.7 kB view details)

Uploaded Source

Built Distribution

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

rhinotype-3.0.0-py3-none-any.whl (235.4 kB view details)

Uploaded Python 3

File details

Details for the file rhinotype-3.0.0.tar.gz.

File metadata

  • Download URL: rhinotype-3.0.0.tar.gz
  • Upload date:
  • Size: 219.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for rhinotype-3.0.0.tar.gz
Algorithm Hash digest
SHA256 84886cc85669ac5585f79de3cb49b8f8ec1a12c5ec029a77c6245ddc10167fdc
MD5 42139b65efdbeb9b6232d5752e724b2f
BLAKE2b-256 4ffe32c3d233b0587b2d764d9ccf9ef6f74a5071a71b67894ea77030cbc1500e

See more details on using hashes here.

File details

Details for the file rhinotype-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: rhinotype-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 235.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for rhinotype-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2adf90fff759c85a5d6e960a1c71ef4e56e34461cec62929b8b455937dd25312
MD5 67f1123a47db3bcc410bc7f5a1a86725
BLAKE2b-256 13828f3d0b33e11d127d7b3e3a89571f9efe4bfa124d41668516cbac8b5723fd

See more details on using hashes here.

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