README
genetic-tools
genetic-tools
is a Node.JS package that provides miscellaneous tools to work with genetic sequences, both DNA and mRNA.
Features
- No dependencies.
- Conversion between DNA and mRNA.
- Works with both DNA and mRNA.
- Find all open reading frames.
- Conversion of a sequence to proteins.
Installation
gentic-tools
is an npm module. Using npm, install it using this command:
$ npm install genetic-tools
Usage
A simple example of the usage of this library:
const geneticTools = require("genetic-tools");
let DNASequence = "aggatgattagggtgctatactgatgacacaat";
let RNASequence = "AUGUUUGUUCCGUCGAAAUACCUAUGAACACGCUAAAUGUUUGUUCCGUCGAAAUACCUAUGAACACGCUAA";
console.log(geneticTools.dna.DNAtoProtein(DNASequence));
// Will output "MIRVLY".
console.log(geneticTools.rna.DNAtomRNA(DNASequence));
// Will output "AGGAUGAUUAGGGUGCUAUACUGAUGACACAAU".
console.log(geneticTools.rna.findAllOpenReadingFrames(RNASequence));
// Will output "[AUGUUUGUUCCGUCGAAAUACCUAUGA, AUGUUUGUUCCGUCGAAAUACCUAUGA]".
console.log(geneticTools.rna.allORFtoProtein(RNASequence));
// Will output "[MFVPSKYL, MFVPSKYL]".
Methods
For DNA
dna.mRNAtoDNA(mRNA)
Translates a messenger RNA sequence to a DNA sequence. Changes every occurrence of uracil to thymine.
mRNA
: The mRNA sequence to convert to DNA.
dna.DNAtoProtein(DNA)
Converts the first ORF of the provided DNA sequence into a protein sequence.
DNA
: The DNA sequence to process.
dna.allORFtoProtein(DNA, minimumSequenceLength)
Converts every open reading frame found in a DNA sequence into protein sequences. Returns a string array with every protein sequence.
DNA
: The DNA sequence to process.minimumSequenceLength
(optional): The minimum sequence length to consider it an open reading frame. Defaults to 1.
dna.findOpenReadingFrame(DNA)
Returns the first open reading frame.
DNA
: The DNA sequence to search in.
dna.findAllOpenReadingFrames(DNA, minimumLength)
Returns an array of sequences with every open reading frame found.
DNA
: The DNA sequence to search in.minimumLength
(optional): The minimum sequence length to consider it an open reading frame. Defaults to 1.
dna.antiCodon(DNA)
Returns a string with the anti codons of the sequence. For ATG, it would be TAC.
DNA
: The sequence to modify.
For RNA
The methods for RNA are all the same as in DNA, with the only difference of using RNA instead of DNA. Despite this, there are methods which are exclusive to RNA.
rna.DNAtomRNA(DNA)
Translates a sequence of DNA to a sequence of messenger RNA, changing every occurrence of thymine to uracil.
DNA
: The DNA sequence to translate.
rna.codonToAminoAcid(codon)
Returns the amino acid related to a codon, or throws an error if not found. "*"
is the STOP codon.
codon
: The codon to convert to amino acid.
Graphics
This module can also be used for graphical representation of DNA with its anti codons. Graphics has only one method.
graphics.sequenceToGraphic(DNA, lb, unionChar)
DNA
: The DNA sequence to represent.lb
(optional): The maximum length of each line. Defaults to80
.unionChar
(optional): The character to use to join the DNA sequence with the other base.
Graphics example:
Provided the sequence CACAGAAGGGATTTCTAAACTGTAACATTC
and using the default settings, this would be the result:
CACAGAAGGGATTTCTAAACTGTAACATTC
||||||||||||||||||||||||||||||
GTGTCTTCCCTAAAGATTTGACATTGTAAG
Contributing
Contributing to this project is welcome. If you find any bug, want to improve the project or just want to give feedback, do it at the main project repo. Every help is welcome and appreciated.
License
This program is licensed under the MIT
license. You can check it in LICENSE
file that is provided with this module or online here.