rrbox / Nucleotide-Swift

Swift package for bioinformatics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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"

About

Swift package for bioinformatics

License:MIT License


Languages

Language:Swift 100.0%