extract sequences ID from a fasta file
0
0
Entering edit mode
9.8 years ago
Kurban ▴ 230

i wanna extract all the sequences ID from a fasta file (Drosophila melanogaster chromatin remodeling factors).

fasta file content:

>FBpp0079251 FBgn0003607 symbol:Su(var)205 family:Chromatin Remodeling Factors species:Drosophila melanogaster
MGKKIDNPESSAKVSDAEEEEEEYAVEKIIDRRVRKGKVEYYLKWKGYPETENTWEPENN
LDCQDLIQQYEASRKDEEKSAASKKDRPSSSAKAKETQGRASSSTSTASKRKSEEPTAPS
GNKSKRTTDAEQDTIPVSGSTGFDRGLEAEKILGASDNNGRLTFLIQFKGVDQAEMVPSS
VANEKIPRMVIHFYEERLSWYSDNED
>FBpp0079496 FBgn0032157 symbol:Etl1 family:Chromatin Remodeling Factors species:Drosophila melanogaster
MSDSTVAASASASASSSAKSSLSDLRQFRINKNASSVVASPSRTERVPGKKRIQVMADSD
SDGNDSQTPKKTKLELTVKEKEERYMAAAKISPHFDTMAIQESLSRTNWDVAASVRYLRE
NCKPKGHNGPLAKSKLKPRSNGISGGNFSDNDHSDDDDVKQSKDQVYDSDDSDSEMSTKM
TGQRKKVFQFMNEASLIELQSVKTLSEKKALAIIDVRPFSDWSDLRQKLESIRMSGDLLN
YAQELINKQNTVAAILSKCNNMVSRLEKAISNGAGIVEQPKLLSSGLQLADYQIIGLNWL
TVMHKQEMNGILADEMGL

how can i extract all the IDs from the file in the Linux terminal(command)?

extract sequencesID • 6.1k views
ADD COMMENT
0
Entering edit mode
 grep '^>' fasta_file.fa > seq_id.txt
ADD REPLY
1
Entering edit mode

That will extract the entire header line, not the ID.

ADD REPLY
0
Entering edit mode

Well what is your expected output? What are the IDs?

ADD REPLY
0
Entering edit mode

Thank you for the commend.

IDs in the texts above are the lines which contain '>' sight, e.g.:

>FBpp0079251 FBgn0003607 symbol:Su(var)205 family:Chromatin Remodeling Factors species:Drosophila melanogaster
>FBpp0079496 FBgn0032157 symbol:Etl1 family:Chromatin Remodeling Factors species:Drosophila melanogaster

You can say its the id of that gene or polypeptide.

ADD REPLY
0
Entering edit mode

well then I have to agree with poisonAlien's solution. From what you told me you just want the fasta headers:

grep ">" fasta_file.fa | sed 's,>,,g' > seq_id.txt
ADD REPLY
0
Entering edit mode

Please search this site, similar questions have been asked and answered multiple times.

ADD REPLY
0
Entering edit mode

Oops ! sorry. Should have read it carefully.

ADD REPLY

Login before adding your answer.

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