Skip to content

rrbox/Nucleotide-Swift

Repository files navigation

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"

Releases

No releases published

Packages

No packages published

Languages