Skip to content

Instantly share code, notes, and snippets.

@c-guzman
Created February 29, 2016 15:33
Show Gist options
  • Save c-guzman/c4fbf9ebf438d0141cc8 to your computer and use it in GitHub Desktop.
Save c-guzman/c4fbf9ebf438d0141cc8 to your computer and use it in GitHub Desktop.
# counting point mutations
# count all mutations where C != C, G !=G, A != A, and T != T
import algorithm
# define string variables
var s: string = "GAGCCTACTAACGGGAT"
var t: string = "CATCGTAATGACGGCCT"
# define count variable for number of mutations
var mutations: int = 0
# for loop if letter of string s does not match letter of string t increase mutation variable by 1
for letter in s.mitems:
if letter != : # I'm not sure how to iterate over the individual letters of string t here, I tried t.mitems but that didn't work.
mutations.inc()
echo mutations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment