Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a beginner class so it should not take anything fancy. The language is H

ID: 3828636 • Letter: T

Question

This is a beginner class so it should not take anything fancy. The language is Haskell. Thank you very much

A DNA molecule is a sequence of four bases which are conventionally represented using the characters 'A', 'G', 'C', and "T". Genomes represented by DNA molecules are subject to four different types of point mutations: insertions A base is inserted between two adjacent points in a genome. deletions A point is deleted from a genome. substitutions A base at a point is replaced with another base. transpositions The bases at two adjacent points are exchanged. Give definitions for Haskell functions insertions, deletions, substitutions and transpositions which take a genome represented as a string and return a list of all genomes produced by single point point mutations of the specifed kind. For example. *Main insertions "GC" insertions "GC" ("AGC GAC "GCA", "GGC", "GGC", "GCG", CGC "GCC" "GCC", "TGC", GTC "GCT"] Main deletions "AGCT" ("GCT ACT AGT AGC" Main substitutions ACT ("ACT AAT ACA "GCT", AGT "ACG", CCT ACT ACC "TCT", ATT ACT" Main transpositions "GATC" ("AGTC" GTAC" GACT"

Explanation / Answer

Insertion function

insertions :: [Char] -> [[Char]]

insertions [] = [['A']] ++ [['T']] ++ [['G']] ++ [['C']]

insertions (x:xs) = [['A']++(x:xs)] ++ [['T']++(x:xs)] ++ [['G']++(x:xs)] ++ [['C']++(x:xs)] ++ (map (x:) (insertions xs))

Deletion function

deletions :: [Char] -> [[Char]]

deletions [] = [[]]

deletions (x:[]) = [[]]

deletions (x:xs) = [xs] ++ map (x:) (deletions xs)

Substitution function

substitutions :: [Char] -> [[Char]]

substitutions [] = [[]]

substitutions (x:xs) = [['A']++(xs)]++[['T']++(xs)] ++ [['G']++(xs)] ++ [['C']++(xs)] ++ map (x:) (substitutions xs)

Transposition function

transpositions :: [Char] -> [[Char]]

transpositions [] = [[]]

transpositions (a:[]) = [[a]]

transpositions (x:y:[]) = [(y:x:[])]

transpositions (x:y:xs) = [(y:x:xs)] ++ map (x:) (transpositions (y:xs))

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote