Creates a new PreMRNA instance.
The complete pre-mRNA sequence including introns and exons
The gene that was transcribed
TSS position in the original gene sequence
Optional
polyadenylationSite: numberOptional polyadenylation site position in transcript
const gene = new Gene('ATGAAACCCAAATTTGGG', [
{ start: 0, end: 6 }, // First exon: ATGAAA
{ start: 12, end: 18 } // Second exon: TTTGGG
]);
const preMRNA = new PreMRNA(
'AUGAAACCCAAAUUUGGG', // Transcribed sequence (DNA -> RNA)
gene,
0, // TSS at gene position 0
18 // Poly-A site at transcript end
);
Readonly
nucleicPrivate
Optional
Readonly
polyadenylationPosition of polyadenylation site in the transcript, if known
Private
Readonly
sourceThe source gene that was transcribed to create this pre-mRNA
Private
Readonly
transcriptionPosition of transcription start site in the original gene sequence
Checks if the sequence contains the specified subsequence
The subsequence to search for (string or same nucleic acid type)
True if the subsequence is found, false otherwise
const dna = new DNA('ATCGATCG');
console.log(dna.contains('TCG')); // true
console.log(dna.contains('AAA')); // false
Checks if the sequence ends with the specified suffix
The suffix to check for (string or same nucleic acid type)
True if the sequence ends with the suffix, false otherwise
const dna = new DNA('ATCGATCG');
console.log(dna.endsWith('TCG')); // true
console.log(dna.endsWith('ATC')); // false
Checks if the given NucleicAcid is equal
The NucleicAcid to compare
True if the NucleicAcids are equal, false otherwise
Gets the coding sequence by extracting and joining only the exons. This represents what the mature mRNA sequence will be after splicing.
The coding sequence (exons joined together)
const preMRNA = new PreMRNA('AUGAAACCCAAAUUUGGG', gene, 0);
console.log(preMRNA.getCodingSequence()); // 'AUGAAAUUUGGG' (exons only)
Returns the complement as a new RNA instance This is the object-oriented API for getting RNA complements
A new RNA instance containing the complement sequence
const rnaResult = RNA.create('AUCG');
if (rnaResult.success) {
const complement = rnaResult.data.getComplement(); // Returns new RNA('UAGC')
console.log(complement.getSequence()); // 'UAGC'
}
Gets the exon regions in transcript coordinates. These are the regions that will be retained after splicing.
Array of exon regions in transcript coordinates
const exonRegions = preMRNA.getExonRegions();
// [{ start: 0, end: 6 }, { start: 12, end: 18 }]
Gets the intron regions in transcript coordinates. These are the regions that will be removed during splicing.
Array of intron regions in transcript coordinates
const intronRegions = preMRNA.getIntronRegions();
// [{ start: 6, end: 12 }] - region between exons
Returns the reverse complement as a new RNA instance This represents the opposite strand orientation for RNA binding
A new RNA instance containing the reverse complement sequence
const rnaResult = RNA.create('AUCG');
if (rnaResult.success) {
const rna = rnaResult.data;
const reverseComplement = rna.getReverseComplement(); // Returns new RNA('CGAU')
// Chainable operations
const original = rna.getReverseComplement().getReverseComplement(); // Returns new RNA('AUCG')
const doubleComplement = rna.getComplement().getComplement(); // Returns new RNA('AUCG')
}
Returns the reverse complement of the sequence This represents the opposite strand of double-stranded nucleic acids
String representing the reverse complement of the sequence
const dna = new DNA('ATCG');
console.log(dna.getReverseComplementSequence()); // 'CGAT'
const rna = new RNA('AUCG');
console.log(rna.getReverseComplementSequence()); // 'CGAU'
Returns an RNA subsequence from the specified start position to the end position
The starting position (inclusive, 0-based)
Optional
end: numberThe ending position (exclusive, 0-based). If not specified, goes to end of sequence
A new RNA instance containing the subsequence
const rnaResult = RNA.create('AUCGAUCG');
if (rnaResult.success) {
const sub = rnaResult.data.getSubsequence(2, 5); // Creates new RNA with 'CGA'
console.log(sub.getSequence()); // 'CGA'
}
Returns the index of the first occurrence of the specified subsequence
The subsequence to search for (string or same nucleic acid type)
The position to start searching from (default: 0)
The index of the first occurrence, or -1 if not found
const dna = new DNA('ATCGATCG');
console.log(dna.indexOf('TCG')); // 1
console.log(dna.indexOf('TCG', 2)); // 5
console.log(dna.indexOf('AAA')); // -1
Checks if the sequence starts with the specified prefix
The prefix to check for (string or same nucleic acid type)
True if the sequence starts with the prefix, false otherwise
const dna = new DNA('ATCGATCG');
console.log(dna.startsWith('ATC')); // true
console.log(dna.startsWith('GTC')); // false
Static
createCreates an RNA instance with validation.
String sequence OR any NucleicAcid to convert to RNA
ValidationResult containing RNA or error
Represents pre-mRNA (precursor mRNA) - the initial RNA transcript containing both exons and introns. Pre-mRNA is produced directly from DNA transcription and requires processing (splicing) to become mature mRNA.
In eukaryotes, genes are transcribed as pre-mRNA containing:
Example