Remove line breaks in a FASTA file

前端 未结 9 1282
予麋鹿
予麋鹿 2020-12-05 01:26

I have a fasta file where the sequences are broken up with newlines. I\'d like to remove the newlines. Here\'s an example of my file:

>accession1
ATGGCC         


        
9条回答
  •  长情又很酷
    2020-12-05 01:53

    There is another awk one-liner, should work for your case.

    awk '/^>/{print s? s"\n"$0:$0;s="";next}{s=s sprintf("%s",$0)}END{if(s)print s}' file
    

提交回复
热议问题