Remove whitespaces on fasta files, except on fasta-header

Remove whitespaces on fasta files, except on fasta-header

0

Hey everyone,

I have a multi-fasta file like this:

>NC_000914 464618..534825
gtgccttccattttggagcgggaccaaatcgcagcggttctggtaagtgcgagcagggac gtgccttccattttggagcgggaccaaatcgcagcggttctggtaagtgcgagcagggac
aaaacgccggccggcttgcgggaccatgcgatattacaactgctcgccacctacggactg aaaacgccggccggcttgcgggaccatgcgatattacaactgctcgccacctacggactg
cgatcaggagaaatccgcaacatgcggattgaggatatcgattggcggaccgaaaccatt cgatcaggagaaatccgcaacatgcggattgaggatatcgattggcggaccgaaaccatt

I would like to remove whitespaces from the fasta sequences, but keep the whitespaces on the fasta-headers (>). I use this command sed -i '/^>/ s/ .*//' file.fasta to remove whitespaces from fastaheaders, but now I want the opposite. Is this possible?

Thanks!


sequence

• 38 views

Read more here: Source link