This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Merging different fastq files into one folder

I have 16S amplicon 80 fastq paired-end data files in 80 different folders but I want all to be in one folder for analysis. How can I do this through R?

r
find DIR1 DIR2 DIR3 -type f -name "*.fasqt.gz" -exec ln -s '{}' DESTDIR/ ';'

so in place of DIR1, DIR2, and DIR3, I will write folder names? And in place of DESTDIR, I will write my new folder name.

2 answers

Do you want to physically move them into a single folder? You should use command line, not R.

Are all folders in the same parent folder? You can make a vector of file paths very easily in R and load them in to R without moving them around.

but how can i make a vector?

list = list.files(path, recursive = T)

In linux, use following command:

If your fastq format looks like: sample1_1.fastq.gz sampl1_2.fastq.gz; Folders containing these files are stored in ~/data/fq/sample1/ ~/data/fq/sample2/.

Then:

mv ~/data/fq/*/*.gz ~/data/

It will move all files with ".gz" surffix in each folder to ~/data/

Log in to answer this question.