(Click here for details)
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
let s = dna.reverseComplementaryStrand() // "DNA: CGATCGAT"
// RNA sequences are also possible
dna.reverseComplementaryStrand(typeOf: RNA.self) // "DNA: GCAUGCAU"
// 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
let s = rna.reverseComplementaryStrand() // "RNA: UACGUACG"
// Generate cDNA of RNA
let cDNA = rna.reverseComplementaryStrand(typeOf: DNA.self) // "DNA: TACGTACG"