Skip to main content

Translates and transcribes an arbitrary genetic sequence, generates FASTA-formatted files, and interfaces with BLAST databases to identify genetic and protein sequences.

Project description

PyPI version Actions Status Downloads License

Installation

The following command installs Codons in a command prompt/terminal environment:

pip install codons

__init__

The data environment, in a Python IDE, is defined:

import codons
cd = codons.Codons(sequence = None, codons_table = 'standard', amino_acids_form = 'full_name', hyphenated = None, verbose = False, printing = True)
  • sequence str: specifies the genetic sequence that will be processed through subsequent functions, which can alternatively be provided in each function ad hoc.

  • codons_table str: specifies the framework for translating codons into amino acids, where the standard translation table is used by default.

  • amino_acids_form str: specifies whether the amino acid full_name, three_letter, or one_letter nomenclature will be used in the protein sequence.

  • hyphenated bool: specifies whether amino acid residues of the protein sequence are delimited by hyphens, where None defaults to True for amino_acids_for = full_name and amino_acids_for = three_letter and False for amino_acids_for = one_letter.

  • verbose & printing bool: specifies whether troubleshooting information or MW results will be printed, respectively.

transcribe()

A genetic sequence is converted from DNA -> RNA, or RNA -> DNA, where the directionality of the conversion is automatically listed in the FASTA description:

cd.transcribe(sequence = None, description = '')
  • sequence str: The genetic seqeuence that will be transcribed. The sequence is case-insensitive, and can even possess line numbers or column-spaces, which the code ignores. The absence of a passed sequence executes the sequence that is loaded into the Codons object.

  • description str: A description of the genetic seqeuence that will be added to the FASTA-formatted output of the function.

translate()

A genetic sequence is translated into a FASTA-formatted sequence of amino acids for each protein that is coded by the genetic code:

cd.translate(sequence = None, description = '')
  • sequence str: The genetic seqeuence, of either DNA or RNA, that will be parsed and translated into a protein sequence. The sequence is case-insensitive, and can even possess line numbers or column-spaces, which the code ignores. The absence of a passed sequence executes the sequence that is loaded into the Codons object.

  • description str: A description of the genetic seqeuence that will be added to the FASTA-formatted output of the function.

make_fasta()

A simple function that returns, and optionally exports, a FASTA-formatted file from the parameterized description and sequence:

cd.make_fasta(sequence, description = 'sequence', export_path = None):
  • sequence str: The genetic or protein seqeuence that will constitute the FASTA file.

  • description str: A description of the seqeuence that will be the first line of the FASTA file.

  • export_path str: The path to which the FASTA file will be exported, where None specifies that the file will not be exported.

blast_protein()

A protein sequence or a FASTA-formatted file of protein sequences is searched in through the BLAST database of the NIH for information about the protein(s):

cd.blast_protein(sequence = None, database = 'nr', )
  • sequence str: The genetic seqeuence, of either DNA or RNA, that will be parsed and translated into a protein sequence. The sequence is case-insensitive, and can even possess line numbers or column-spaces, which the code ignores. The absence of a passed sequence executes the sequence that is loaded into the Codons object.

  • database str: The BLAST database that will be searched for the protein sequence. Permissible options include: nr, refseq_select, refseq_protein, landmark, swissprot, pataa, pdb, env_nr, tsa_nr.

  • export_name & export_directory str: The name of the folder and directory to which the scraped BLAST data will be saved in a file: nucleotide_blast_results.xml. The None values enable the code to construct a unique folder name that describes the contents and saves it to the current working directory.

blast_nucleotide()

A genetic sequence is translated into a FASTA-formatted sequence of amino acids for each protein that is coded by the genetic code:

cd.translate(sequence = None, database= 'nt', export_name = None, export_directory = None)
  • sequence str: The genetic seqeuence, of either DNA or RNA, that will be parsed and translated into a protein sequence. The sequence is case-insensitive, and can even possess line numbers or column-spaces, which the code ignores. The absence of a passed sequence executes the sequence that is loaded into the Codons object.

  • database str: The BLAST database that will be searched for the nucleotide sequence. Permissible options include: nr, nt, refseq_select, refseq_rna, refseq_representative_genomes, wgs, refseq_genomes, est, SRA, TSA, HTGS, pat, pdb, RefSeq_Gene, gss, dbsts.

  • export_name & export_directory str: The name of the folder and directory to which the scraped BLAST data will be saved in a file: protein_blast_results.xml. The None values enable the code to construct a unique folder name that describes the contents and saves it to the current working directory.

export()

The genetic sequence and any corresponding protein or nucleotide content from the aforementioned functions, which reside in the Codons object, are exported:

cd.export(export_name = None, export_directory = None)
  • export_name str: optionally specifies a name for the folder of exported content, where None enables the code to design a unique folder name for simulation and descriptive tags of the contents.

  • export_directory str: optionally specifies a path to where the content will be exported, where None selects the current working directory.

Accessible content

The Codons object retains numerous components that are accessible to the user:

  • proteins list: A list of the protein sequences that are generated by the parameterized genetic sequence.

  • multi_fasta str: The assembled FASTA-formatted file for the translated proteins from a parameterized sequence.

  • protein_mass dict: A collection of the protein sequences and their respective masses, in a key-value pairing, that were discovered in the translate() function.

  • transcribed_sequence & sequence str: The transcribed genetic sequence from the transcription() function, and the genetical sequence that is used in any of the Codons functions.

  • amino_acid_synonyms dict: The synonyms for each amino acid, with keys of the full amino acid name.

  • codons_table & changed_codons dict: The translation table between genetic codons and amion acid residues, which is accessed with case-insensitivity, and the translation conversions that were changed based upon the user’s specification.

  • missed_codons dict: A collections of the codons that were parsed yet never matched with a codons_table key.

  • paths & parameters dict: Collections of the paths and parameters are are defined for the simulation.

  • export_path str: The complete export path for the Codons contents.

  • protein_blast_results & nucleotide_blast_results str: The BLAST search results for the passed proteins and nucleotides, respectively.

Execution

Codons is executed through the following sequence of the aforementioned functions, which is exemplified in the example Notebook of our GitHub repository:

import codons
cd = codons.Codons(sequence = None, codons_table = 'standard', amino_acids_form = 'full_name', hyphenated = None, verbose = False, printing = True)
# < insert Codons function(s) >
cd.export(export_name = None, export_directory = None)

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

Codons-0.0.1.tar.gz (10.8 kB view details)

Uploaded Source

File details

Details for the file Codons-0.0.1.tar.gz.

File metadata

  • Download URL: Codons-0.0.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.10

File hashes

Hashes for Codons-0.0.1.tar.gz
Algorithm Hash digest
SHA256 755462b63ffd349ff2fd3be7fb7b9ef4c39cb01676530f33668a5d0140c52979
MD5 bb198cf273494db2a23c21c9a85e073a
BLAKE2b-256 c738bcbaedcf80e762e79f2082b440036a85ea9c712b2b35474b21c428cae2a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page