-
Notifications
You must be signed in to change notification settings - Fork 0
Home
RedRimmedBox edited this page Sep 4, 2022
·
13 revisions
Still under development. Only the currently implemented features are introduced here.
import Nucleotide
// declaration
let dna: BaseSequence<DNA> = "ATGCATGC"
// Calculate GC content (non-GC combinations are also possible)
let gc = dna.contentTotal([.g, .c]) // 4
// Transcription from DNA sequence to RNA sequence
let rna = dna.transcribed() // "RNA: AUGCAUGC"
// Create a complementary strand of the sequence
var s = dna.reverseComplementaryStrand() // "DNA: CGATCGAT"
// RNA sequences are also possible
dna.reverseComplementaryStrand(typeOf: RNA.self) // "DNA: GCAUGCAU"
// Complement all bases
s = dna.complementaryStrand() // "RNA: TACGTACG"
// declaration
let rna: BaseSequence<RNA> = "AUGCAUGC"
// Calculate GC content (non-GC combinations are also possible)
let gc = rna.contentTotal([.g, .c]) // 4
// Create a complementary strand of the sequence
var s = rna.reverseComplementaryStrand() // "RNA: GCAUGCAU"
// Generate cDNA of RNA
let cDNA = rna.reverseComplementaryStrand(typeOf: DNA.self) // "DNA: GCATCGAT"
// Complement all bases
s = rna.complementaryStrand() // "RNA: UACGUACG"