linux gz文件合并,快速合并多个fastq.gz文件 | 您所在的位置:网站首页 › 如何将压缩包合并 › linux gz文件合并,快速合并多个fastq.gz文件 |
案例描述: 需要将Sample_test1_R1.fastq.gz和Sample_test2_R2.fastq.gz合并为test.fastq.gz 操作方法1: 先zcat再gzip zcat Sample_test_1.R1.fastq.gz Sample_test_2.R2.fastq.gz | gzip - > test.fastq.gz 操作方法2: 直接cat cat Sample_test_1.R1.fastq.gz Sample_test_2.R2.fastq.gz > test2.fastq.gz 结果对比 压缩文件大小 ll test*.gz-rw-r–r– 1 An Lau 197121 1321311 6月 13 10:14 test.fastq.gz -rw-r–r– 1 An Lau 197121 1321742 6月 13 10:15 test2.fastq.gz 解压缩文件大小 gzip -cd test.fastq.gz > test.fastq gzip -cd test2.fastq.gz > test2.fastq ll test *.fastq-rw-r–r– 1 An Lau 197121 7195186 6月 13 10:16 test.fastq -rw-r–r– 1 An Lau 197121 7195186 6月 13 10:16 test2.fastq 对比文件内容 zcat Sample_test_1.R1.fastq.gz Sample_test_2.R2.fastq.gz | wc80000 100000 7195186 wc test*.fastq80000 100000 7195186 test.fastq 80000 100000 7195186 test2.fastq 160000 200000 14390372 total 总结 虽然压缩文件大小不一样,应该是压缩率不同导致的, 但是不同方法出来的文件大小和内容都是一样的。 直接cat的速度肯定会比zcat … | gzip …快! 所有以后直接cat就可以了。 |
CopyRight 2018-2019 实验室设备网 版权所有 |