// The class contructor given a DNA string. public DNA(string action, Tuple <int, int> origin, string dna) { this.dna = new List <Nucleotide>(); List <Nucleobases> nucleobases = Nucleobase.ToDNA(dna); for (int i = 0; i < nucleobases.Count; i++) { this.dna.Add(new Nucleotide(action, origin, i, nucleobases[i])); } }
// Constructs a section of DNA sequence public static List <Nucleotide> ToNucleotides(string action, Tuple <int, int> origin, int position, string dna) { List <Nucleotide> nucleotides = new List <Nucleotide>(); List <Nucleobases> nucleobases = Nucleobase.ToDNA(dna); for (int i = 0; i < nucleobases.Count; i++) { nucleotides.Add(new Nucleotide(action, origin, position + i, nucleobases[i])); } return(nucleotides); }
// A single nucleotide polymorphism (SNP). // Replaces a single nucleobase (or nucleotide) within // an existing gene with a different nucleobase. private static void Snip(int speciesId, int geneId, int index, string dna) { int i = GeneIndex(speciesId, geneId); genes[i].Dna.Dna[index].Nucleobase = Nucleobase.ToDNA(dna)[0]; }