Locating Restriction Sites
This problem asks:
Given: A DNA string of length at most 1 kbp in FASTA format.
Return: The position and length of every reverse palindrome in the string having length between 4 and 12.
Restate the problem
Introductory reading:
Solution steps
My first thought was to write a function to find all reverse palindromes of length 4.
That worked, and when I expanded it to search for palindromes of various length, it seemed to work for longer palindromes as well.
I got my code to process the sample dataset correctly, but kept failing on the challenge datasets, and for the longest time, I couldn’t figure out why.
Finally, I figured out that the files Project Rosalind was sending me included line breaks in the DNA sequences, which was new, and my code wasn’t handling them properly.
Python concepts
Reading the DNA string out of the file directly failed because of the line breaks, but SeqIO.parse worked fine.
Bioinformatics concepts
This challenge built on the previous bioinformatics concepts of reverse palindromes and complements.