The editor has been updated to markdown! Please see more info at: Tutorial: Updated Support Site Editor

Question: Converting Fastq to Fasta in R
gravatar for christinafragel
25 days ago by
christinafragel0 wrote:

I am working on converting multiple fastq.gz files of raw sequence data into fasta files. I am trying to use the following lines of code to access the files in my directory based on pattern and convert them to fasta format. I have used two variations. The first which gives and error and the second does not. However, the second variation does not seem to produce a file. Any ideas???

1. writeFasta(readFastq("C:/Users/Christina/Desktop/Colucoides fastq", pattern = ".fastq.gz"), pattern = ".fa")

Error in isSingleString(filepath) : argument "file" is missing, with no default

2. writeFasta(readFastq("C:/Users/Christina/Desktop/Colucoides fastq", pattern = ".fastq.gz"), pattern = ".fa")

R bioinformatics fasta fastq • 69 views
ADD COMMENTlink modified 25 days ago by James W. MacDonald49k • written 25 days ago by christinafragel0
Answer: Converting Fastq to Fasta in R
gravatar for James W. MacDonald
25 days ago by
United States
James W. MacDonald49k wrote:

That's never going to work. You are asking R to read in all the FASTQ files in a directory and then hoping that it will then write them back out with the same names, but as FASTA files instead. But R isn't a mind reader. You have to be more specific. One alternative would be to pre-specify the input and output names.

whereitsat <- "C:/Users/Christina/Desktop/Colucoides fastq"
inny <- dir(whereitsat, pattern = "fastq.gz$")
outie <- paste0(whereitsat, "/",  gsub("fastq.gz","fa", inny))

for(i in seq(along = inny)) writeFasta(readFastq(whereitsat, inny[i]), outie[i])
ADD COMMENTlink written 25 days ago by James W. MacDonald49k

Thanks. I'll try that and work from there.

ADD REPLYlink written 25 days ago by christinafragel0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 192 users visited in the last hour