Merging different fastq files into one folder
2
0
Entering edit mode
2.2 years ago
anasjamshed ▴ 140

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 • 1.4k views
ADD COMMENT
0
Entering edit mode
find DIR1 DIR2 DIR3 -type f -name "*.fasqt.gz" -exec ln -s '{}' DESTDIR/ ';'
ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode
2.2 years ago
Trivas ★ 1.8k

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.

ADD COMMENT
0
Entering edit mode

but how can i make a vector?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
2.2 years ago
tomas4482 ▴ 430

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/

ADD COMMENT

Login before adding your answer.

Traffic: 1922 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6