-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrph.hs
More file actions
30 lines (24 loc) · 726 Bytes
/
Copy pathgrph.hs
File metadata and controls
30 lines (24 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-
Given: A collection of DNA strings
in FASTA format having total length at most 10 kbp.
Return: The adjacency list corresponding to O3.
You may return edges in any order.
-}
import Fasta(splitStr, formTuple)
overlap k (a,b) (x,y)
| t == h && a /= x = (a,x)
| otherwise = ("","")
where h = take k y
t = drop (n-k) b
n = length b
printList [] = putStr ""
printList ((x,y):xs)
| x/="" = do
putStrLn $ (drop 1 x) ++ " " ++ (drop 1 y)
printList xs
| otherwise = printList xs
grph k s = concat $ map (\(x,y) -> map (overlap k (x,y)) s) s
main = do
let k = 3
readFile "rosalind_grph.txt" >>=
printList . (grph k) . formTuple . lines . splitStr