-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathReverseComp.py
29 lines (23 loc) · 10.3 KB
/
ReverseComp.py
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
import sys
def reverseComp(text):
reverseStack = []
for i in range(len(text)):
if text[i] == "A":
##text.replace(text[i], 'T')
reverseStack.append('T')
elif text[i] == 'T':
#text.replace(text[i], 'A')
reverseStack.append('A')
elif text[i] == 'C':
reverseStack.append('G')
elif text[i] == 'G':
reverseStack.append('C')
reverseComplement = []
for i in range(len(reverseStack)):
reverseComplement.append(reverseStack.pop())
print("".join(str(x) for x in reverseComplement))
file = open(sys.argv[1], 'r')
text2 = file.readline()
#print text2
reverseComp(text2)
#reverseComp('AATAGTTGGACAAAATGGTTTGGCATGTGGTCCCTGCCATCCGTGGACAGCAGTACGATTCAGAGCTTACAATTCCTATACTAATGTGTCATAGAGTAAACAGCTTTATCACACCCTGTACGTGCTTTATGCAGCAAGAATTTTTCATTTACGACATTCCATCAGCAGGATAAATACTACAACTACGCCAATGGGACAATTGGCGTCCTGACGGAATTCACACGTTTCCTCACTACAGCCTTTTGATGAAGTTATAATACCGAGTTCTCCACGGTGATAGCTGCCTCCAAGACTATCGGACGTTGGCAACTTAACCTACAAATTTAGGGCTCAATTGCCGACGTATAGCCTATCTTCTGGCAGACATGCCGGCCATGGTTGTTAACAAGCCCTACCGAAGTAATGGCTGTGGTCCAGCAAGTGCGAGTGACCATCCTCCTCTAAGGCCAGGCATAAACGAATACATATTTCACATAAGTTCCCGTCCAGCGCGATATTGGAGAGCGTACTAGGACGAAAGTGTCCGGTGGCATATTTACCGGGGTCGCCACCTGGTAGATACAGACGGCATATTCCCGTGATCCCGCTTAAGAAGGATCTCTTGTATATACTATGTCAACGGTAGAAGTCCTGGCATGAAGAAGTGGATCGGACGCCCACATCATCCAAACGGCTTGGGCGGGTCCTGAGACATTTACATAGCTCCAACATAATAGTCTCGTGACATCGATACCCACGGCACCAAGGAGCCTCGAGTTTTAAGGGGTCTTAACAGTATTAGACCGGTGCTACGGTGAGCCGGAGCCGAATGGAGAGGAGTCAAATTTGAAACGTCATGTCAGACTAGAAGCCGTGCATACGCTTCTCACGTACCACCGTGGTGGCGGAGCAGTCTAGCGATTATCCTCTCGCTGTACGAAATGCGCTTAGTTAACGATTACGCCCCCCCGGTCTTCTGCGTGGAAGTTCCTACACACCTGGCCCTCGTACCAGGGAACCGCTGCCATCCTGTGCAGGCGCGGGGCGGGGTCCAGTCCGTTGTTAATATATTGGTACATATCAACAGTAGGATATCCCGCGCTAGAAGAACCCCTAAATGCTCCCCGTTCTTATTGGTATGCCCGGATGCTCCGCGCGGCCTCGCTCACACATCCGTTCTTCGTGTCAGGCTATGTAGAGTCATTCCCGTTCCACGATTCTCTCAACTTTGACAATCTTCAACGGCGGTTGAGCCCTTCGCTATGGAGTACGCGCCCGTCCTTTAGGGTCGCGGGTCGCGCTTTAATTCTTACTTGCCGAATCATGGTATAGGCCGGCGCCGAGTCGCTACCTCAGCCTAAATCTAGGCTCTCCCCTATGTCCCTGAACAACAAACCGGATAAGGCAAACCGACCTTAGCACCGAATATTGTGTGTTCCGTCTAGTCGCAAACAGTATATAAGTGATGCCGGCATGAAAGCGCACAACCATAATCTCTTGTCGTTCGCGCAATTTCAGGCCAGTTGGCGTGCGGCTGCGGGAAAACGACTGTGCATCCACTTCCCTAGTACCCGATAGCTTCCGGCCTGACTCGGTAGGTATCGGCCAGTACTCCGTTAGTAGAAACTCATTCACATAGAGTCCTGACGATAGCACTTTTCTCTGTCCTTCTCGGGTATGATCAGATACACAGAATACAAAAGAGCGTGACATCTCTCATACCCGGGATGTATTGCGGGTTGAGGCGCAGATGTTGATGGATTAATTAACGAGCAGTGGCTAGAAAAAGTTGTGTGCCGCCCGACGAACGAGGACGTGCTTCAACGACCGGGGATAGCTCACCTAATCTGACTAGCGTCGACGATACCTTTCGGCGCGGCTTAAACGTAAGAGATCTGGGCCTCGCGTTACGAGACAGCGAACGGGGTTGAGAAAACTTTAGTGTGGGGTCATAAATGCCATGGGATATGTGTATGTCTCCGGACTGTTCATAGATTCGTGCCCCGCTCGCATCGGCTTCTTATTTCTGGGCTACGTATCAATGCTTGGGAGCTTGGTAAGCAACCTGTCTTGTCCATTAAAGCGAGATGGGCCGTCCTTTTTGTTGTTACTTTTCACAAGATTTGTCTACGAGTATCCCCACCGACCATCGCGAAGGTTTCGCACTACGTTTGCCTGGCCTGTTTCTCTCAATTCAGTTTTCGGGACACGGATCAATCGGGATTGTGAGCGATAACAGGGGACTTATCCTTCGTAAGATTGATTGGGACTAATGATGTATTCGACCGGCGCACATTTTCGTAAATTGGCCTCCGCGTTTTGAATCAAATTCGCCTCTCCTTTCAACGGTTGGCGTCTTCGCATACTAGACTCAACACAGTCCACAATATCATCACGTGGCGAACTCGATCGCTATACGGTCGAACGCGGCCGCTGTTATACAATAACTTGTTACAGCGCTCATACCGAGATAGGCATACTACGCGCGCGGCTGGCGTTTCGTTCGCGGGTTTTACTTCCCAACTTGAGCAGACTCCAATTGTACTCCTCATTATGGAGTGTATAGGGCTCGGTCCCTTTTGGACACGCGAAGCGGAGGCGCAAAGCGCACCGTTTAGTCATCTTGGTCTGCATCCATTAGAATATGACTTGGCTTAATTACAAACACCCATGAAGTCAGCGAAGGCGTCTTACTAGAGCCGCCATAGGTGGGAAGTATTTCAAACTAATTGTAACAGTTAATCCTTGTGTAATATCCTGACGCGTTAACGCGTTAAAGACTACAGGAATCATTCGTATCAAAGACGTAGTAAAGCCGTGCCCTAGAGACGCAATTGTTAATGTGATCTTTGACTGTAACAGTAAATTCTCGGGGCCCTGTATGCAACTCCGGCTGAGATCGGGCGATCGGGTTCCATAGCGCTGGTCGCATTTGATCATTGCCATACATGGCGTCCTAGCAGCCATCCTCACTAGCGGGGAGTCAAAGAAGAGAAGTCAGACGCTGGGGGTTGGGTAGATGATTACACGTTGATGAAGTCTCCCGCATCATATATGCTATTCCGCATTAGTGACGACGGGCCATTTTATGGCAAGTTTTACGGACATTGAAACCGCGGTGGTTGCCACAGCTGTGCGCTACTTCTTAATGGCCAGACCATGCCGACTACGGCCTTGTCACAAGAGTCACTCTTCGGGTCGGCAGCCCATTTGTCTCGGGGTGCCGCGGCGCAACTCTGTCCTCACAACGGCCGTGTGGGAAAGGTCCCAACTTCGCTCTTCCCCGTTCAAGGCCACACTCCTACTGCCCCTGACAGAGGCAAACCGACGACTGCTGGGACCCGGCTGTTTATTCCACCGGAAAACTCGTGATTCGGATGTCTCTACGAACACCGGTAAGTGCGTCCTAATTTAGGCCTACATGGCAACATATGCTCCGCTATCGTCTGTAGGAACCTTTCTACCGGGGGCAGAGGGCAAATCACTGTACTCAGCAACCCTTCCCTTCTCTTGTCTCGGCAATATTCCACTCGCTAATAAGTGCACGGAAACTGCTTGGGCCAGCGTTGTTTTAGGGTAACTTCGTTGGGGGACACAGAAGAAACATTGAGATTCTATTTCGACGGGAAGGGATTAGCGCACGTAGGCCTCAACTGTGGGTTAACTACCGTCTGACTCGCTATCGGTAACCTGTGAGTGTGCGGTCGGAAGTTTATACGAAGGGCTTTGAGGGTCCCCCTGGTCCAAAGGGATATATGTTTCCTATACGGACCGCTTGGATAGCCGTCGGATAGGATCGTGGATTGCGTCCCCGAAGGGCTAAGTCCGCTAGGAACATCCCTTGTATCGGCAGGCTGAAATAGATGCGGGGGAATCGTCTGGGAGCCTCCTGAAGCACCGGCTGCGCGGGAAGCAGTAGATTGTATAAGAGCTATGCCTACCATAGAATAATGCGCGCGTACCACCGCTCATTGTGTCACTGAAGCCCTGTAGAACTATGCCCGTCGTAATACAGTAGGAGTCTCTTGGCTGAATCTGTTTGACCTTGCTGGTGTGGTGCCAAGCTCATTAGTGTTAAAGGCGAAAGATCCGAGATGAATCCGCGAATAGCTGCTACCTGCCGCCCGATGAGTGCCAATTCAGAACCGGTATCCTCTTACTCAAACGACAATACGCTAACGCGAACACGTTACTAATTCTCTGCGCAGGTGCCCTAACTGTATACAACCACAGTGCCTACCTATCCTGCCGGGCTCGTGAGGTCAGGACGAGTGCATCGGCTCAGACACAGATCTGCACCTGCACCCGTCTGCCTTTCGCACGCAATTTTAATTGTCCTGCCCCCCACCACCTCTGTACTGGTACTACATAAGCTTGATGTGCAGTGCCTCAGTGCCCGTCGCCTACGCTAGTCAAAGCGAACTCAGCCCCACTATGTTTCGGAAACCAGATCGATAGATTCAGATCGTCTGCCTAGAATCGTTGTTGTACATCTTTCTTGTCGACCTTGTTCACTTTTAACTCGAGCTGTAGTGCACAGAGGTGAATATGCGTTATTATTGCGGAATGGGTAGGTCAGCTTAGTGGTCGGGGCTAAGAAAGGGTATGTTAATCACCCCTAGCGCCAGCTTGGGGTCACTAGTATCTTGGTTCTCATTTCATGGGCGACTGGCTTGCTGTTGATATCCGAGCTCGCCACATTTGGAAGGATGGAAAGTTTCGCAGGGTATGAGGTAAAATCCTGTTTGCATCGTTACTCATTTATTTTGACCCAGGGGAGTCATGTGAAACGGTAAATTAACCGTCGATAGAAGTCCAGAACATGTACCCTAATCGATCTCAATGACTGTGAGCCTGGCAGCAATCCGTCGACTTTTTAGAGGAGATTCGGCAGCAGGTGTTTGTCCCTCGGGCCGATCCGGGCGGTCGAAAATATTGTGTCCAAGGTTAACTTCTAGGTACCTTTTTTATATGTGTGCGCGTTGCGTACTCGCGTCTTGGTGAGATGTCGTCTGGCGTGTATGACCTAGTCGTACTACCGATTCTTGCCCATACGCATAGGCTTTTACTCGATAAGCTTTTCGTTGACCAAGGTACGGAACTGAGGTGTTCCGAACGCTAGTTACGGAGGGCCACTCCGGGAGACCCTCTTGAATACCAGGTTATATATTCTTGGCGTATGGTATTAACTTTTGACAATCCGGGAAAACAAACCTGTACGAGTAATACCACGTGCTTTGCTTTCGAATTACTCGAATCGTTGGAGTCTTCTTCCATGCAGGATGACTTGTTATTAAATACTAGTTGACAAATCTTAACAGGAATCAAGGGTGTCCTGACACTTGTCGGCTCTGTTGACTAAGCGTAACGCGTGCGCGGGGACCCATGTCCCCATATTTTTAGTCAGTTAACCGCAGTGTGCTACTACACTACTATCCTGCTCAGCCATCAAACGCGGACAACGTCATACCGGCACGACTAGCAAGAAACGGATATTTTGAAGGATTTGGTCCACATTGATTGCTATATCAAACAAGGATAAAGTGTTGGTTCATTTGGTCCCACTCCGTGGAAATAGCCGGATTAAACCTTTAGAACGACCCGACCGTCGACAACCTGTGGCCTTCTATACTGTACCATGAAGGCTTGAGCGCCATATGGAAGTGATACACGGTTTCCGATGCGTATCACGGAAGAGGAATAGCCCATTTGTTAACACATCCCAACCACGCTCAAATCCGACATGTCTATCCCATGAGATTTCCATGGACAACCAAGGTGTCTACGGTTCGAAGTTTAGACATTGACAGCGTAGTAGGATAAAATCTCGCCGTCTGTTAATAAACGCACCCCCCCATATACCGACAGATCACCTTTAGGAGCCACAATACACGCTCTGAGTTACCTAGCAACTGAGTTGGTCCATAGACCGGGCGCACTAATAAGATATCCCTCAGCTCGTCAGCGTTGACTTTTCAGCATACGTACTGATACTGACCATTGCAGGGAATAATATCACCGCAGTGTTGTCGCAATCGTTTGATCATTTTGATATATTTAGTGACCTATCTCATTTCAAAGGTCGCAGGTACTTTCTGGTAAGCGCCGGTCCTTTATTATTGTGAGACGTAATTCAGATCCAAAAAGAAGGGTATGCGCCAGTTGCGAGAGGTACATCATTGTAAGGAATTGTTGGAGGAGGAAAGAGTTTCGGCATTCATTATGGATTCGTAAAGAGTGAGGATCAAGTAAGGTGCTCATATTTGACCAGGTACTCTGTCAACAGCGAATAAGGTCCGTAGTCGTCCGATTCACATGCGGTGCATCTAAGCACAGCTGCTCCTCACTGATTCACTCCACCGGTATCTGATGTAGCCGCTTCATCGGGTGCTTCTGCTTAATTCGAAGGCTATGGATTGTTATTGCCCTACGATGCAACCCAGTGTATAAGTTACCGAAATACCGCGGTTAGATAATTAGCGGCGTCGGCGTCATACTGATGCGTTAGGTTTTTGCAAACACCTCGTCGTCCGTGAGTTCGGATTATGAACATGAAACTGTAATGATGTTCAAGCTACGTGTCTATGACGGAATTGTCAATCACCGGCCTTTTTCCTCATTCTGCTGAGTATTCCTTCCAATGCAGCGGGTCTAGACATGTTTCCACGGCGCGGAACCACGATCGCCATCAAAGTCCGTTAACATATTCATATGCTACTTGCGGCGAGAATATGTCCACATTTTCAAAATGACAGGTAGATAAAGAGCAGCTTGAAGGATGTTCCGACGTGTAACAATGTCAGAGAACCCCGTACGGATCGTCATTTGGTTTATAAGGGCATCGTAAGAAACTGGGTAGAGGGCGTAGAGACATACAGCTGCTTTGCGTAGCCGAACGGGGCGATGTTCGGACCACCGGTCTTCAACGCGGCACCTGTCTTCTAGAACATCCACCATTCGTTCAGTGTAGGAGGTTTACCGGGTGTCTAGGACTGATTCCTGTGTGACACCAACCAGCTCGACTGGACGAGAGACTGCGGCCTGGTCGGTCTTGTCGTGGCTCTCTAAATTAACGGGTAGTAACCACCAGTGGGGCTGATCGTCTATAAATGTGGTATAGCGTGGATTTCTAGTCCCGTAAATCAAGATGGCACAAACAATGGTGCACTATCCACAATGTCGTGGACATGCCAGGTCCCAAGAGACGCTTTTTGCATCTGAATAGTTCTGATCAACAAGCTCATAGTTGATACGACGTCGTGTGATGGGTCTAGTGCGTTGTGCCGCAGGCCTCGTGTCCTGTCACGTCCAGTGTAGTGTACACAGATGGATTGCGCTAACAACGGAAGTCTGGCTGCGGCGGGCAGGTGCGCACTGCATTGTCCACTCAGGGATAGCTGGCACGTTTTTCTCTCTCCAAAACCCTTGCGACCACGCCGACCCGATAGTCAATACCGATTGCGGCTCCTTAATTATGTCATCTAGCGGGAAAAAGCAGTATGGATCGCTTTTTCTACGTTGGGATCGGGGCCGGGCCGCCGGTATCGACCCCTGGCCCTATGTCCCCGCCATCGCAGTGTAAAAGTCAAGGTGTGAAAGTTATCTGGGAGGGAACCGCTGCCTGATGTTGAGAACGTGCCCGCGTATTCGATTCGGGAACTCGTTACTACGTCGCGTCACTGTTATGTAACTGTCTATGGTTCCCGGCTCCACTGAGCAAAACAGCTGGAAACCCCGATGTTATCCATTCATTGTGTTCGATGGTCACTACCTCCCGCGTACTCGCTCCAACAGAGGCCAGGGAAGGTCTAACTCGCCCGTCGCATTACGCGGTCGACTATCGAGCCTGAAACAGGATTAGTCAAATATTCCCCTCTAAGCTTACCTATGGCTTAACCTAGGGTGTGGGACATACCGGGCACAGGTTTGCTGTATATAGAGATACTCGGAGCTTTTGTGGCTCAGATCTAGTGCTATAGCGCTCACTTGGTGTGAAGTGATACACGTGCATAGGTCTAGGAAAGGTGGAAAGTTTCTTATATAAATCCCCTCCCCTTACCGCAAACAGCTACAGCATTAGAGCCCAAGGGACGCACCGGTATGTATTTGCTCCTAATGGCCATCTGCTGGTTCCTTAGTTCATCGAAGTGTCGACGTCCCAACACTGGAATCCTCTCAATCAGCGGCACAAGATGTGCACGCTCCCACACAACCAGGAATACTCTCAGTACGCACGGCAGTCTTCCGCCGGTATACTCTGTGGGTAACTATACATACCATCACGGAATCCCCCAGTGAGCAAGTAGCCGCATTTACGTTCACACGAGATAAGGATTGCAGTAGTAAGCAGTGGTGACTGATTGGAAGTTGACTACTCAGGGTCGTGTGTCCAAGAGGGCGAGTACTAAAGTCACCGTAACGCGGAGGCCAGCACTCTGGCAATAGAGGGGTGGAGCTTTTACGTATCGCAGCTCAAAACAGCTGAAGAACGGTGTGTAATCGACGGCGAAAATCCCCGTTTGTGTGTGAGGACCACCGAGGCAGCGAAGTTATAGCTTTGGATGGCGCGCAGCATGGATGGTTAAACTTTTGGCATCCTGGGGATCATTGGAAGATAGTTATCGACGACTCTAGCTCAGAGCCAATAAATTACGATCCGGAGGGTACAGGATTCCCGACCCACAGACAAGGGCCTCGACTTGCTCCACCGGGAGCGCGATACTGCTGAGTCCGGGCACCTACGCGTAGCCAAAATGCCCCACGAGCCGGAGCTGTTGAATTAGAGCAGTAGAAAACAATCCCCAAGATGTTAAAAATTTGGGTGGCTATCCAACTACGTTAGGAGTTATCATAAGGCGAACTCCTTGGAAAGGAGTTCGAGTCTGAATGTCCCTCGTTGTTCGTACAAGTCATCTCGTGGCACGGCGTGACCAACGAGGAATCTTGGCAATGTATCGGAAATGAAAATTATTGAGCCGGTCCGCTTTATAGAGGACGCGTCTCTCTGGTTTTTAAAAAGGACTGCTTCTTCGTGCTACACGGGGATATTGACTACGACTTGTGGTCTAGAAGTATCGCGGATTTCCATGTACATGCCGATGCGACCAGGAGCGACGGTCAGTTGCTGCGAGAAATTTAACTGGACCACGTCAAACTACAATTTAATCTTAGGGACGCAGCTTGCTACGTCCGACGAGCGGGATAAAGTATTAATATTTTTTAGAACCGGCTGTTACGGCACCATTGTTACTTGGATCGCCACCTCCATTGTTGATTAGGTTAATCCTGATGCTTAATCCGTCTGGTAGACTACTCGTCAAACGGTGAAGCGTAGGAGGTATTCTTTCACCGCTCTCTCCCTAGGGATGAACCAGATATAAGGAAGACCGTGGAAGTTTAACCGAAGGACATAAAATGACATACACATCGTATGAACTACTGCCAAATTACCCTGAACGCAGGGTGGGTTGAAAGACGGATGTTCGGTCTAAGTAGGGGGGTCGTACAAGGAAGCCTTTTTGGTAGGGCGAATAGAGCATGCAGGGGTGCAGTAAGTGGCCACAGAGGGGAACCGGGCGTCAAATAAATCTAACACTTCTAGGTTCACAATTAAGAACACTCGTTGTCAACGGCTCTGATGTCAAACGCGACCTAACCACGATCTCGTAGCCCGAATATCACACGTCGCGTAGGTGGGGGTCCGCCAGCAGTTACGTTTGCTTGTCGCGTCTTATGCGGAACTCTCACCCGTAGAAATCGCAGCACCTTAGTCTCAAAGATCCCAGCTAAACCAGGCTACACAAAGCAAGTTCCGCAAATAACGGCTTGTTCTGTACTTCGCTCTGTAACCGAGAACCGAATCACGGGGTAGAATTGGGTATATAATCCGTATTTGGGACGGTTTATGTGAGCCAGTCAGCATGCAAACAACGTTATTCACCGGCGATGCGG')