This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Finding non ATGCN sequences using python

I want to search for non sequences in a file, to substitute them.

for file in SeqIO.parse('myfile.fasta', 'r'):
    sequence = re.search('^ATGCN', record.seq)
    output_file=open('files.fasta, 'w+')
python fasta sequence

1 answer

Go to a site like:

https://regex101.com/

to test your regular expressions (select Python as the language). To match characters except ATGCN the pattern would be:

[^ACGTN]

you get quite helpful tips in the sidebar

Log in to answer this question.