This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Any packages to validate FASTA file?

I am trying to create a function that can take in a file and check to see if it's a valid fasta file or not (such as making sure there's no leading tabs or spaces, the first character starts with >, no empty lines between sequences, etc.).

I have tried using SeqIO.parse(filename, "fasta"), but it returned true for cases where it only had the description line with > and no sequence provided.

I was trying to code this, but I was wondering if there was other packages that checks validity of FASTA format?

Thanks -

python fasta

If you need empty records to be considered invalid, maybe you could issue a pull request to biopython

You could subclass the SeqIO operations and extend the sequence checking processes for empty seqs etc?

1 answer

There are two options: you can use accordingly: 1 : https://github.com/linsalrob/fasta_validator fasta_validator This is simple C code to validate a fasta file. It only checks a few things, and by default only sets its response via the return code, so you will need to check that!

  1. install fasta file validator from pip or conda.

Log in to answer this question.