How to edit the fasta headers?
2
0
Entering edit mode
2.6 years ago
p • 0

Hi, pls, let me know how can i edit the fasta file header.

>LR99555.1 Avo, chromosome: 1 

I want this header like this.

>LR99555.1
linux • 1.7k views
ADD COMMENT
0
Entering edit mode

A low-tech way of doing this is to open the file in any text editor and simply delete the part you don't need. This is not advised if you have a large number of sequences.

ADD REPLY
1
Entering edit mode
2.6 years ago
cut -d ' ' -f 1 < in.fa
ADD COMMENT
0
Entering edit mode

hi, thanks for the reply, what is -f here?

ADD REPLY
1
Entering edit mode

according to the manual (man cut):

 -f list
         The list specifies fields, separated in the input by the field
         delimiter character (see the -d option).  Output fields are
         separated by a single occurrence of the field delimiter character.

Meaning that it keeps everything before the first space delimiter and removes the rest.

ADD REPLY
1
Entering edit mode
2.6 years ago
$ awk '/^>/ {print $1} !/>/' test.fa
$ sed '/^>/ s/\s.*//g' input.fa
ADD COMMENT

Login before adding your answer.

Traffic: 1986 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