Python Help

Hey so to preface I am a python newbie and I'm trying to write an example script to search through this huge fasta file to find all the possible sequences that match the forward primer. I even wanted to have a mismatch tolerance. Here is the code i currently have:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--in_file", help = "input filename")
parser.add_argument("--out_file", help = "output filename")

in_file = args.in_file
out_file = args.out_file

from Bio import SeqIO
import re
forward_primer = "GTGCCAGCMGCCGCGGTAA"

for seq_record in SeqIO.parse(in_file, "fasta"):

        test = re.search("(forward_primer){e<=3}", str(seq_record.seq))

if test:
        print test.groups()

the only problem I'm having is that nothing prints to the screen. Is this supposed to happen or is my code wrong?

Posted Dec 6, 2018, 1:41 AM UTC

313
Loading comments…