How to change id in fasta file
2
0
Entering edit mode
16 months ago
Diego ▴ 110

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 • 1.2k views
ADD COMMENT
2
Entering edit mode
ADD REPLY
2
Entering edit mode
16 months ago
slw287r ▴ 140
gzip -cd old.fa.gz | cut -d' ' -f1 | gzip > new.fa.gz
ADD COMMENT
2
Entering edit mode
16 months ago
Diego ▴ 110

I ended up using the package seqkit:

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

Login before adding your answer.

Traffic: 1847 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6