Question: get names from fasta file
0
gravatar for zzzahiri
4.5 years ago by
zzzahiri0
zzzahiri0 wrote:

How can I get the name of proteins from fasta file in R for example: P13639 from

sp|P13639|EF2_HUMAN Elongation factor 2 OS=Homo sapiens GN=EEF2 PE=1 SV=4 MVNFTVDQIRAIMDKKANIRNMSVIAHVDHGKSTLTDSLVCKAGIIASARAGETRFTDTR KDEQERCITIKSTAISLFYELSENDLNFIKQSKDGAGFLINLIDSPGHVDFSSEVTAALR VTDGALVVVDCVSGVCVQTETVLRQAIAERIKPVLMMNKMDRALLELQLEPEELYQTFQR IVENVNVIISTYGEGESGPMGNIMIDPVLGTVGFGSGLHGWAFTLKQFAEMYVAKFAAKG EGQLGPAERAKKVEDMMKKLWGDRYFDPANGKFSKSATSPEGKKLPRTFCQLILDPIFKV FDAIMNFKKEETAKLIEKLDIKLDSEDKDKEGKPLLKAVMRRWLPAGDALLQMITIHLPS PVTAQKYRCELLYEGPPDDEAAMGIKSCDPKGPLMMYISKMVPTSDKGRFYAFGRVFSGL VSTGLKVRIMGPNYTPGKKEDLYLKPIQRTILMMGRYVEPIEDVPCGNIVGLVGVDQFLV KTGTITTFEHAHNMRVMKFSVSPVVRVAVEAKNPADLPKLVEGLKRLAKSDPMVQCIIEE SGEHIIAGAGELHLEICLKDLEEDHACIPIKKSDPVVSYRETVSEESNVLCLSKSPNKHN RLYMKARPFPDGLAEDIDKGEVSARQELKQRARYLAEKYEWDVAEARKIWCFGPDGTGPN ILTDITKGVQYLNEIKDSVVAGFQWATKEGALCEENMRGVRFDVHDVTLHADAIHRGGGQ IIPTARRCLYASVLTAQPRLMEPIYLVEIQCPEQVVGGIYGVLNRKRGHVFEESQVAGTP MFVVKAYLPVNESFGFTADLRSNTGGQAFPQCVFDHWQILPGDPFDNSSRPSQVVAETRK RKGLKEGIPALDNFLDKL

R • 2.5k views
ADD COMMENTlink modified 4.5 years ago by Medhat8.9k • written 4.5 years ago by zzzahiri0
0
gravatar for Medhat
4.5 years ago by
Medhat8.9k
Texas
Medhat8.9k wrote:

from

http://www.bioconductor.org/packages/2.13/bioc/html/Biostrings.html

you can use

library("Biostrings")
myFastaFile <- readAAStringSet("my.fasta")
seqName = names(myFastaFile)

and if you have a big file you can refer to

http://stackoverflow.com/questions/23173215/how-to-subset-sequences-in-fasta-file-based-on-sequence-id-or-name

ADD COMMENTlink modified 4.5 years ago • written 4.5 years ago by Medhat8.9k

Thanks But the result of this code is sp|P13639|EF2_HUMAN but I want to have P13639 :-(

ADD REPLYlink written 4.5 years ago by zzzahiri0

maybe use gsub?

ADD REPLYlink written 4.5 years ago by Ram32k

what about using split?

strsplit(seq, "|")[[1]][2]
ADD REPLYlink modified 4.5 years ago • written 4.5 years ago by Medhat8.9k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2056 users visited in the last hour
_