2

我有一个 FASTA 格式的文件,它本质上是一个特殊的文本文件,包含许多条目,其中一个如下所示,我在 R 中用名称“FASTA”分配了它。原始文件是红色的,格式如下所示R 中的 seqinr 包。

FASTA<- structure(list(`tr|A1Z6G9|A1Z6G9_DROME` = structure("MSISASHPCGLNADGTATQYKESTATIQTSGLQSSPRSFLPEREDTLEYFIKFPKPSSKNEFVLAKDHDGEDSHVPIVMLLGWAGCQDRYLMKYSKIYEERGLITVRYTAPVDSLFWKRSEMIPIGEKILKLIQDMNFDAHPLIFHIFSNGGAYLYQHINLAVIKHKSPLQVRGVIFDSAPGERRIISLYRAITAIYGREKRCNCLAALVITITLSIMWFVEESISALKSLFVPSSPVRPSPFCDLKNEANRYPQLFLYSKGDIVIPYRDVEKFIRLRRDQGIQVSSVCFEDAEHVKIYTKYPKQYVQCVCNFIRNCMTIPPLKEAVNSEPSESVSRVNLKYD", name = "tr|A1Z6G9|A1Z6G9_DROME", Annot = ">tr|A1Z6G9|A1Z6G9_DROME CG8245 OS=Drosophila melanogaster GN=CG8245-RA PE=2 SV=1", class = "SeqFastaAA")))

现在虽然这种格式允许我获取条目/条目的名称索引,但当我使用 grep 搜索它时,如下所示

grep("A1Z6G9_DROME", names(FASTA))

或使用

as.vector(sapply(names(attributes(FASTA)), function(x) attr(FASTA, x)))

但是,我不能 grep/regexpr 属性部分中的任何文本/信息或隔离任何属性,例如 name= 或 Annot= 部分之后的文本。谁能帮我这个?

据我所知,当在 R 中使用谷歌搜索 read.fasta 时,与 seqinr 包相关的手册说明了一些注释/属性被忽略的内容(我认为),但这些属性部分包含有关条目身份的重要信息,我迫切需要!我已经尝试使用粘贴功能取消列出或折叠,但它们删除了我需要的所有属性!

4

1 回答 1

3

seqinr包中有很多get*功能(参见http://www.rdocumentation.org/packages/seqinr)。这些函数旨在访问不同的属性,例如:

getAnnot(FASTA)
#[[1]]
#[1] ">tr|A1Z6G9|A1Z6G9_DROME CG8245 OS=Drosophila melanogaster GN=CG8245-RA PE=2 SV=1"

getSequence(FASTA)
#[[1]]
#  [1] "M" "S" "I" "S" "A" "S" "H" "P" "C" "G" "L" "N" "A" "D" "G" "T" "A" "T" "Q" "Y" "K" "E" "S" "T" "A" "T" "I" "Q" "T" "S" "G" "L" "Q" "S" "S" "P" "R" "S" "F" "L" "P" "E" "R" "E" "D" "T" "L" "E" "Y" "F" "I" "K" "F" "P" "K" "P" "S" "S" "K"
# [60] "N" "E" "F" "V" "L" "A" "K" "D" "H" "D" "G" "E" "D" "S" "H" "V" "P" "I" "V" "M" "L" "L" "G" "W" "A" "G" "C" "Q" "D" "R" "Y" "L" "M" "K" "Y" "S" "K" "I" "Y" "E" "E" "R" "G" "L" "I" "T" "V" "R" "Y" "T" "A" "P" "V" "D" "S" "L" "F" "W" "K"
#[119] "R" "S" "E" "M" "I" "P" "I" "G" "E" "K" "I" "L" "K" "L" "I" "Q" "D" "M" "N" "F" "D" "A" "H" "P" "L" "I" "F" "H" "I" "F" "S" "N" "G" "G" "A" "Y" "L" "Y" "Q" "H" "I" "N" "L" "A" "V" "I" "K" "H" "K" "S" "P" "L" "Q" "V" "R" "G" "V" "I" "F"
#[178] "D" "S" "A" "P" "G" "E" "R" "R" "I" "I" "S" "L" "Y" "R" "A" "I" "T" "A" "I" "Y" "G" "R" "E" "K" "R" "C" "N" "C" "L" "A" "A" "L" "V" "I" "T" "I" "T" "L" "S" "I" "M" "W" "F" "V" "E" "E" "S" "I" "S" "A" "L" "K" "S" "L" "F" "V" "P" "S" "S"
#[237] "P" "V" "R" "P" "S" "P" "F" "C" "D" "L" "K" "N" "E" "A" "N" "R" "Y" "P" "Q" "L" "F" "L" "Y" "S" "K" "G" "D" "I" "V" "I" "P" "Y" "R" "D" "V" "E" "K" "F" "I" "R" "L" "R" "R" "D" "Q" "G" "I" "Q" "V" "S" "S" "V" "C" "F" "E" "D" "A" "E" "H"
#[296] "V" "K" "I" "Y" "T" "K" "Y" "P" "K" "Q" "Y" "V" "Q" "C" "V" "C" "N" "F" "I" "R" "N" "C" "M" "T" "I" "P" "P" "L" "K" "E" "A" "V" "N" "S" "E" "P" "S" "E" "S" "V" "S" "R" "V" "N" "L" "K" "Y" "D"
于 2013-08-29T18:38:50.400 回答