Skip to content

Instantly share code, notes, and snippets.

@acomjean
Last active November 7, 2015 01:34
Show Gist options
  • Select an option

  • Save acomjean/4f8f02fbd352eac789ad to your computer and use it in GitHub Desktop.

Select an option

Save acomjean/4f8f02fbd352eac789ad to your computer and use it in GitHub Desktop.
#Python Problem 1
#reverseComplement.py
#Introduction to Bioinformatics Assignment 2
#Purpose: reverse compliment
#Your Name: Aram Comjean
#Date: 10/11/2105
#s1 is the string you should use to generate a reverse complement sequence
#Note that your result needs to be presented in the 5' to 3' direction
s1 = "AAAAACCCCCTCGGCTAATCGACTACTACTACTACTACTTCATCATCATCAGGGGGGGGCTCTCTCTAAAAACCCCTTTTGGGGG"
find_replace_dictionary = {'A':'T', 'T':'A','G':'C','C':'G'};
compliment ='';
for key in s1:
#Skip values if not in dictionary
if key in find_replace_dictionary:
#add to compliment string
compliment+= find_replace_dictionary[key]
#reverse the string
reverse_compliment = compliment[::-1]
print reverse_compliment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment