# A stateful C function for R: parsing Fasta sequences

[This article was first published on

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In the following post, I’ll create a C extension for R. This extension will iterate over all the FASTA sequences in a file and will return a pair(name,sequence) for each sequence, that is to say that I won’t store all the sequences in memory.The C codeThe structure FastaHandler holds the state of the fasta parser. It contains a pointer to the FILE, the current sequence and fasta header. We also
**YOKOFAKUN**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

To

**leave a comment**for the author, please follow the link and comment on their blog:**YOKOFAKUN**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.