Hi guys,
I try to read fastq files from a RNA-Seq result. I had 19 fastq files, but the manual of ShortRead said "Methods read all files into a single R object; a typical use is to restrict input to a single FASTQ file."
I do not know how to write a i loop to make one vector for all the 19 files. Could you kindly help, please? Many thanks,
Jerry
Below is what I write, I guess is kind of stupid....
fastqFilesdir <- dir("/Users/jerry/Desktop/RStudio/Key/fastq/fastq", full=TRUE)
fq1<- readFastq(fastqFilesdir[1])
fq2<- readFastq(fastqFilesdir[2])
fq3<- readFastq(fastqFilesdir[3])
...
fq18<- readFastq(fastqFilesdir[18])
fq19<- readFastq(fastqFilesdir[19])
Dear Sukhdeep Singh,
I used this code as well:
fq1<- readFastq("/Users/Jerry/Desktop/RStudio/Key/fastq/fastq", pattern = "jerry_S1_L001_R1_001.fastq")
It provides same result as above. All the 19 files are in the dirpath "/Users/Jerry/Desktop/RStudio/Key/fastq/fastq", but each file name is different, from "jerry_S1_L001_R1_001.fastq" to ""jerry_S1_L019_R1_001.fastq".
May I ask how to write pattern to includes all the 19 files, please? Thank you~
This is very easy, if you read the parameter information carefully. I don't have the package installed to test it for you.
I updated the answer, should work for you. Be careful, it might bog down your machine, depending on the size of files that you are reading in + a single S4 object in R will contain all the information from all files, this will be heavy duty!!