---
layout: post
title: "Writing an R function to read FASTA-formatted files (CC289)"
blurb: "Making use of the tempfile function"
author: "PD Schloss"
date: 2024-06-10 11:00
comments: false
youtube: 4tsM8oPkCIk
start_hash: 23e295d7a80b6714373764565b7ac2204af49b70
end_hash: dd413bfe743fb8e1c3de23c44363a52e29f59601
---

Watch along as Pat shows the development of a function for reading in a FASTA-formatted file. FASTA files are commonly used to store DNA sequence information. He uses Test Driven Development (TDD) to develop and refactor the function to suit our needs. Along the way, he makes use of temporary files using the tempfile function and a variety of functions from the stringi package that stringr is based on. This episode is part of an ongoing effort to develop an R package that implements the naive Bayesian classifier.

<iframe style="margin: 0 auto;display:block;" width="560" height="315" src="https://www.youtube.com/embed/{{ page.youtube }}" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

## Code

You can browse the state of the repository at the

* [beginning of the episode](https://github.com/riffomonas/phylotypr/tree/{{page.start_hash}})
* [end of the episode](https://github.com/riffomonas/phylotyprr/tree/{{page.end_hash}})
