参考自:https://www.jianshu.com/p/97defd9adf18
https://blog.csdn.net/weixin_31956641/article/details/116553743
需要合并多个双端文件
*第一步,将相同样本名字和对应的SRR编号放在一起(excel直接复制)*
vi sample.txt
a srr1
a srr2
b srr3
b srr4
b srr5
第二步修改SRR数据文件名
1端
for i in `cat sample.txt|tr "\t" "_"`;do echo ${i};mv ${i##*_}_1.fastp.fastq.gz ${i}_1.fastp.fastq.gz;done
2端
for i in `cat sample.txt|tr "\t" "_"`;do echo ${i};mv ${i##*_}_2.fastp.fastq.gz ${i}_2.fastp.fastq.gz;done
第三步合并文件
安装bgzip
conda install -c bioconda tabix
1端合并到he目录
for i in `cat sample.txt|cut -f1|sort|uniq`;do echo ${i};zcat ${i}_*_1.fastp.fastq.gz | bgzip - > he/${i}_1.fastq.gz ;done
2端合并到he目录
for i in `cat sample.txt|cut -f1|sort|uniq`;do echo ${i}; zcat ${i}_*_2.fastp.fastq.gz | bgzip - > he/${i}_2.fastq.gz;done
网友评论