Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.47 KB

README.md

File metadata and controls

49 lines (34 loc) · 1.47 KB

Nucleotide

GitHub issues GitHub license Swift

Usage

(Click here for details)

Import

import Nucleotide

DNA sequence

// 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"

RNA sequence

// 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"