Skip to content

Instantly share code, notes, and snippets.

@jacqueline-homan
Created March 30, 2016 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacqueline-homan/c1618551164f3395a858144b181d8224 to your computer and use it in GitHub Desktop.
Save jacqueline-homan/c1618551164f3395a858144b181d8224 to your computer and use it in GitHub Desktop.
open System
open System.IO
let path = @"/home/jacque/Projects/F-sharp/Rosalind/Rosalind/rosalind_dna.txt"
let inputFromFile = File.ReadAllText(path)
let program (dna:string) =
inputFromFile
let countAs (inputFromFile:string) =
inputFromFile
|> Seq.filter (fun c -> c = 'A')
|> Seq.length
let countCs (inputFromFile:string) =
inputFromFile
|> Seq.filter (fun c -> c = 'C')
|> Seq.length
let countGs (inputFromFile:string) =
inputFromFile
|> Seq.filter (fun c -> c = 'G')
|> Seq.length
let countTs (inputFromFile:string) =
inputFromFile
|> Seq.filter (fun c -> c = 'T')
|> Seq.length
printfn "%s" inputFromFile
let countAnyLetter (inputFromFile:string) (letter:char) =
inputFromFile
|> Seq.filter (fun c -> c = letter)
|> Seq.length
let countChar (inputFromFile:string) (target:char) =
inputFromFile
|> Seq.filter (fun c -> c = target)
|> Seq.length
[<EntryPoint>]
let main argv =
printfn "Welcome to F# lessons!"
//printfn "PLEASE GIVE ME PATH TO THE FILE"
//let path = Console.ReadLine()
//let wait = Console.ReadLine ()
0 // return an integer exit code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment