linux 中 shell 实现从fasta中提取任意的scaffold数据
001、测试数据
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg
002、sed命令实现提取任意的scaffold数据:
提取scaffold1
[root@pc1 test2]# cat a.fa >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr1/,/^>/p' a.fa | sed '1b; />/d' ## 提取scaffold1 >chr1 ddtttggggg eeeeee
003、提取scaffold3
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr3/,/^>/p' a.fa | sed '1b; />/d' ## 提取scaffold3 >chr3 uuuuueeeee qqqqqqqqq
004、提取scaffold5
[root@pc1 test2]# ls a.fa [root@pc1 test2]# cat a.fa ## 测试数据 >chr1 ddtttggggg eeeeee >chr2 iiiiirrrr sssssssss >chr3 uuuuueeeee qqqqqqqqq >chr4 tttttttt wwwwwww >chr5 yyyyyyy ggggggg [root@pc1 test2]# sed -n '/^>chr5/,/^>/p' a.fa | sed '1b; /^>/d' ## 提取scaffold5 >chr5 yyyyyyy ggggggg