Entering edit mode
2.3 years ago
LaFra
▴
10
Hi all,
I'm trying to convert my multiline fasta in a single line fasta.
My input file is like this (I put only the first lines, but they are many more):
>sample1
gttaatgtagcttaaacccaaagcaaggcactgaaaatgcctagatgagtacaccaactc
cataaacacataggtttggtcccagccttcctgtttactttcaataggcctacacatgca
agcatccacgccccggtgagtaacaccctccaaatcaacaagactaagaggagtaggtat
caagcacacatcctgtagctcataacacctcgcccaaccacacccccacgggagacagca
gtgacaaaaattaagccataaacgaaagtttgactaagccatattgattagggttggtaa
atctcgtgccagccaccgcggtcatacgattaacccgagctaacaggaatacggcgtaaa
And the desired output would be this:
>sample1
gttaatgtagcttaaacccaaagcaaggcactgaaaatgcctagatgagtacaccaactccataaacacataggtttggtcccagccttcctgtttactttcaataggcctacacatgcaagcatccacgccccggtgagtaacaccctccaaatcaacaagactaagaggagtaggtatcaagcacacatcctgtagctcataacacctcgcccaaccacacccccacgggagacagcagtgacaaaaattaagccataaacgaaagtttgactaagccatattgattagggttggtaaatctcgtgccagccaccgcggtcatacgattaacccgagctaacaggaatacggcgtaaa
I tried this command, but it give me the same file as the input, that menas a multiline fasta
awk '{if(NR==1) {print $0} else {if($0 ~ /^>/) {print "\n"$0} else {printf $0}}}' input.fa > output.fa
I also tried several other commands, but they don't work..why?
0
Entering edit mode
ADD REPLY
• link
2.3 years ago by
shenwei356
8.7k