This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to change id in fasta file

Hi all,

I think I have a simple question for you. I need to change the id of my sequences in fasta because they are too long:

>CAEGAH010000001.1 genome assembly, contig: scaffold9796, whole genome shotgun sequence

How can I change/reduce all the ids in my fasta file to something simple:

 >CAEGAH010000001.1

Thanks all!!

fasta

2 answers

gzip -cd old.fa.gz | cut -d' ' -f1 | gzip > new.fa.gz

I ended up using the package seqkit:

cat myfile.fna | seqkit replace -p "\s.+" > newfile.fna

Log in to answer this question.