I'm trying to learn Python to perform some tasks in the lab.
I was trying to find a pattern in a FASTA file, interpolating pattern and fasta as string variables. This way the program doesn't find anything. On the other hand, when I try to do the same, but writing the pattern string instead of using the variable interpolation, it works and finds the pattern. Could you please help me to figure out what the problem is?
Here is my code:
firstname = "header1" for record in SeqIO.parse("prueba_fasta.fasta", "fasta"): print ">" + record.id + "\n" + record.seq fa = strrecord.id) print fa fir = str(firstname) print fir matches = re.search (fir, fa) if matches: print ">" + record.id + "\n" + record.seq
Thanks in advance