This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Problem With Fasta Parser

I'm looking for an existing C++ program which can parse FASTA files, and i've found this one: http://lh3lh3.users.sourceforge.net/parsefastq.shtml

the problem is that it requires a .seq file, while i've got a .fasta file, and when I give input .fasta file, nothing happens.

someone has used the program with a .fasta file?

thanks

fasta parser

I just compiled and ran the code without problems on a FASTA file with the suffix .fa. I don't think the suffix is the issue. Are you sure you have a valid FASTA file?

Yes, i use the standard human hg19.fasta, plus i've got the .fasta.fai, but i don't know how to use it.

FASTQ format is NOT the same as FASTA format

If I remember correctly, that library is supposed to work with either type.

I initially thought that too, but the web page states that kseq.h parses "both FASTA and FASTQ format, and even a mixture of FASTA and FASTQ records in one file."

then that code doesn't work with a .FASTA file...

Yes it does, as I stated in my first comment.

So, i ran it with "nameofprogram file.fasta" and returns "return value -1".

the problem is that when i insert the fasta, fp = NULL ( fp = gzopen(argv[1], "r"); ), and in zlib.h says that "gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state"

1 answer

What you linked to is more of an API, not a program.

What are you trying to do?

There are commandline tools for dealing with sequence files here (from the same author, using the library you linked to).

i would like to extract the name of chromosome and the relative bases, for all the fasta file(22 chromosomes).

for example

"chr1

AACTTAGCCC......

chr2

CCAAAATCGG......

.... "

but i need the code, because then i' ve to working with the information to compare with a bam file.

Log in to answer this question.