EDIT by RamRS
Cross-posted on bioinfo SE: https://bioinformatics.stackexchange.com/questions/21464/how-to-loop-over-certain-files-within-a-directory-that-belongs-to-certain-sample
I have two samples where the sequencing was done on 3-lanes paired end reads. The two samples are A44943_1
and A44944_1
.
I would like to generate a for in loop to merge the R1 files of sample A44943_1
from the 3-lanes, and then do the same for R2 files of this sample, then I want to merge R1 files of sample A44944_1
from the 3-lanes and then do the same for R2 files of this sample. So I thought about for in loop. My fastq files looks like:
R0480-S0001_182602S1P1_A44943_1_H77YFDRXY_CGCAACTA-GAATCCGA_L001_R1_trimmed.fastq
R0480-S0001_182602S1P1_A44943_1_H77YFDRXY_CGCAACTA-GAATCCGA_L001_R2_trimmed.fastq
R0480-S0001_182602S1P1_A44943_1_H77YFDRXY_CGCAACTA-GAATCCGA_L002_R1_trimmed.fastq
R0480-S0001_182602S1P1_A44943_1_H77YFDRXY_CGCAACTA-GAATCCGA_L002_R2_trimmed.fastq
R0480-S0001_182602S1P1_A44943_1_H7YKTDRXY_CGCAACTA-GAATCCGA_L003_R1_trimmed.fastq
R0480-S0001_182602S1P1_A44943_1_H7YKTDRXY_CGCAACTA-GAATCCGA_L003_R2_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H77YFDRXY_CACAGACT-TGGTACAG_L001_R1_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H77YFDRXY_CACAGACT-TGGTACAG_L001_R2_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H77YFDRXY_CACAGACT-TGGTACAG_L002_R1_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H77YFDRXY_CACAGACT-TGGTACAG_L002_R2_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H7YKTDRXY_CACAGACT-TGGTACAG_L003_R1_trimmed.fastq
R0480-S0002_182602S1P2_A44944_1_H7YKTDRXY_CACAGACT-TGGTACAG_L003_R2_trimmed.fastq
Could you advise me on a for in loop to do this task?
Thanks
https://www.cyberciti.biz/faq/bash-for-loop/ . What have you tried so far ?
Here is an easier to understand option: Concatenating fastq.gz files across lanes
There are other answers you can use in the thread as well.
Do not post on multiple forums - that is just bad etiquette. What's worse, you did not link between the two so no one knows that you're asking two sets of online volunteers to spend their time on your problem without telling them that you're also asking the other group.
You've done this multiple times. If you repeat this behavior, you risk your account being suspended.
If this comment is any indicator, this is how much you annoy people in both communities with this sort of behavior.