Created
December 7, 2015 21:14
-
-
Save SavinaRoja/d45d05479a9cb8cb12ac to your computer and use it in GitHub Desktop.
Using Lazy ByteStrings to quickly transcribe DNA to RNA (replace T with U) on input sequences of arbitrary length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A solution to Rosalind Problem: RNA by SavinaRoja | |
-- http://rosalind.info/problems/rna/ | |
-- Uses Data.ByteString to remove unnecessary overhead of string or Text | |
-- representation, and Data.ByteString.Lazy in particular for safety in | |
-- handling sequence files of arbitrary length. | |
-- | |
-- This script is really quite trivial, it just replaces bytes of value 84 with | |
-- bytes of value 85, converting T to U in ASCII. | |
module Main where | |
import qualified Data.ByteString.Lazy as BL | |
import qualified Data.Map.Strict as M | |
import System.Environment | |
main :: IO () | |
main = do | |
args <- getArgs | |
contents <- BL.readFile (head args) | |
-- In ASCII: A = 65, C = 67, G = 71, T = 84, U = 85 | |
BL.putStr $ BL.pack [if x == 84 then 85 else x | x <- BL.unpack contents] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment