forked from Shivi91/Rosalind-1
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solution to Rosalind Problem 003: Complementing a Strand of DNA
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env python | ||
''' | ||
A solution to a ROSALIND bioinformatics problem. | ||
Problem Title: Complementing a Strand of DNA | ||
Rosalind ID: REVC | ||
Rosalind #: 003 | ||
URL: http://rosalind.info/problems/revc/ | ||
''' | ||
|
||
from string import maketrans | ||
|
||
input_file = open('data/rosalind_revc.txt') | ||
dna = input_file.read() | ||
input_file.close() | ||
|
||
nucleotide = 'ATCG' | ||
complement = 'TAGC' | ||
transtab = maketrans(nucleotide, complement) | ||
|
||
dna_reverse_complement = dna.translate(transtab)[::-1].lstrip() | ||
|
||
output_file = open('output/003_REVC.txt', 'w') | ||
output_file.write(dna_reverse_complement) | ||
output_file.close() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GTATTAAGAAGCCTACTGACATAAGATGAGACCTGCGATCCTAAAAGACGGTTAACACGTCACATACCGATCAATCGAACTGTTCAGCGCAACACTATTCCTCCCAAAGGTCGCGGGGACCCCCCAACCATTAGTATGGCTGGTTGATACCACACCTAATTTACTCAGTTTATCCAACCTTTAGAACTCCCCTTTACTTTCTACTGTATTGCCACGAAACAGCACCTATCTACGAACGAGTTCTAAGGGGCCTATATCGGTAGGTGTTTTTTAATACGGTAACGCATCATCGCTACGAAAGATCCCCCAATTAAAGGACAGACAAAACTAGTAGCGTGTTGTCGTTGAAAATATGTCAGCAATATATGGTAACCGAGCTAGGACTCATACTGCGCATTGTTAACTGTCGAATTGGTTAACCACGGCTCACTATCTGCGGGAACGCAGAAGGTCCCCTAAAGTAATCAGTGACGAGCTCAAGGTATAAATTCATGCCAATGTTCTTGGGTGCAAGGCAGGCCCGTCCGGGCCAAACAAGTGCAAGTTTACATAACTGGCCTTAATCCGATAATCACCTGCTTTCGATACGGGGTTAGGAAAAAGAAGCCCGGAGCCTTAGATCCCTAAAATGCGCACTTCTCAGGGGGGTATCGTAGGCGACACTCAGACTGCCGTGTCTTACGCCGCCGCGGGTCGATTAGTCTAAGTGATCGGTACGCAAGGCGATGTCGCACAAAGTGCAAGACGAGGTGAGCAGTAGCTACAGTGCATGCATGGCCGCTCCCGCCAGCTAATCGATTGGCCACCGTAGAATTTGTCCTGTTTCGTCGGTTACACATTTTCACCAGTACGATTAAGACCTCGGTTAACCACTTGTAGATTTTTTGCTTTGGACTAGG |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CCTAGTCCAAAGCAAAAAATCTACAAGTGGTTAACCGAGGTCTTAATCGTACTGGTGAAAATGTGTAACCGACGAAACAGGACAAATTCTACGGTGGCCAATCGATTAGCTGGCGGGAGCGGCCATGCATGCACTGTAGCTACTGCTCACCTCGTCTTGCACTTTGTGCGACATCGCCTTGCGTACCGATCACTTAGACTAATCGACCCGCGGCGGCGTAAGACACGGCAGTCTGAGTGTCGCCTACGATACCCCCCTGAGAAGTGCGCATTTTAGGGATCTAAGGCTCCGGGCTTCTTTTTCCTAACCCCGTATCGAAAGCAGGTGATTATCGGATTAAGGCCAGTTATGTAAACTTGCACTTGTTTGGCCCGGACGGGCCTGCCTTGCACCCAAGAACATTGGCATGAATTTATACCTTGAGCTCGTCACTGATTACTTTAGGGGACCTTCTGCGTTCCCGCAGATAGTGAGCCGTGGTTAACCAATTCGACAGTTAACAATGCGCAGTATGAGTCCTAGCTCGGTTACCATATATTGCTGACATATTTTCAACGACAACACGCTACTAGTTTTGTCTGTCCTTTAATTGGGGGATCTTTCGTAGCGATGATGCGTTACCGTATTAAAAAACACCTACCGATATAGGCCCCTTAGAACTCGTTCGTAGATAGGTGCTGTTTCGTGGCAATACAGTAGAAAGTAAAGGGGAGTTCTAAAGGTTGGATAAACTGAGTAAATTAGGTGTGGTATCAACCAGCCATACTAATGGTTGGGGGGTCCCCGCGACCTTTGGGAGGAATAGTGTTGCGCTGAACAGTTCGATTGATCGGTATGTGACGTGTTAACCGTCTTTTAGGATCGCAGGTCTCATCTTATGTCAGTAGGCTTCTTAATAC |