如何根据列表名称元素绑定两个文件?

时间:2019-06-19 13:59:19

标签: r list

我有两个文件,一个是用R创建的,这是一个列表,其中包含一些看起来像这样的项目:

$`1`
  [1] "UniRef90_A0A076JUS5"    "UniRef90_A0A076JUV9"   
  [4] "UniRef90_A0A076JUX2"    "UniRef90_A0A076JV09"    "UniRef90_A0A076JV21"   
  [7] "UniRef90_A0A076JV26"    "UniRef90_A0A076JV29"    "UniRef90_A0A076JV55"   
 [10] "UniRef90_A0A076JV60"    "UniRef90_A0A076JV80"    "UniRef90_A0A076JV85"   
 [13] "UniRef90_A0A076JV97"    "UniRef90_A0A076JVA0"    "UniRef90_A0A076JVB1"   
 [15] "UniRef90_A0A076JVE1"    "UniRef90_A0A076JVG6"    "UniRef90_A0A076JVH2"

$`2`
  [1] "UniRef90_A0A0C1REE8" "UniRef90_A0A0R2QVL5" "UniRef90_A0A1Z8VD11"
  [4] "UniRef90_A0A0T5ZPM9" "UniRef90_A0A192IQ53" "UniRef90_A0A1B1TFC1"
  [7] "UniRef90_A0A1Z8KKZ0" "UniRef90_A0A1Z8KLU1" "UniRef90_A0A1Z8KMN0"
 [10] "UniRef90_A0A1Z8KNT2" "UniRef90_A0A1Z8KQA8" "UniRef90_A0A1Z8KTM0"
 [13] "UniRef90_A0A1Z8KUR1" "UniRef90_A0A1Z8L238" "UniRef90_A0A1Z8SKE9"
 [15] "UniRef90_A0A1Z8T976" "UniRef90_A0A1Z8TG89" 

第二个看起来像:

>UniRef90_A0A076JUS5 - Cluster: LOW QUALITY PROTEIN: titin
MTTKAPTFTQPLQSVVALEGSAATFEAHISGSPVPEVSWYRDGQVLSAATLPGVQISFSD
GRAKLMIPAVAAGHSGRYTLQATNGSGQATSTAELLVTAETAPPNFSQRLQSTTARQGSQ
VRLDVRVTGIPTPVVKFYRDRAEIQSSPDFQILQEGDLYSLIIAEAYPEDSGTYSVNATN
SVGRATSTAELLIHGEEEAVPAKKTKTIVSTAQITQTTRQARVEKKIEAHFDARSLATSE
>UniRef90_P14198 - Cluster: AAC-rich mRNA clone AAC4 protein
MSLSNNQTQFVTVFVPIQLSIDVFRKMNNINSFVNDNLTNFPIVTVDQLIKVVNNNNNNN
NNNNNNNNNNNNNTSISNNGDINNCLATFEQVQNNCFETCDFKATEREHYFASGKQIQES
VLPEEEEEKISVNNFAMVTVEPNNCFVKAQQINSVAPLSLDNRNCVRRAHREVNTFVQVF
DVCVFNLKVVNVATNESQVNLFNGGNVENICFDRSIQMPRSSADDFDWSSQQQSSWYSLA
LSIIPIYHEIILVLCNWLVVAFYKYWQHQQQKQLPPHPLNIIVPNVSKRIAVNLNNQLIS```

我想知道是否可以使用R创建一个新列表:对于第一个列表的每个元素,我想用第二个文件中的值替换每个"UniRef90_XXXXXX"。我的意思是,例如 在列表的第一部分,我想替换:

"UniRef90_A0A076JUS5"通过第二个文件中的“值”

GRAKLMIPAVAAGHSGRYTLQATNGSGQATSTAELLVTAETAPPNFSQRLQSTTARQGSQ
VRLDVRVTGIPTPVVKFYRDRAEIQSSPDFQILQEGDLYSLIIAEAYPEDSGTYSVNATN
SVGRATSTAELLIHGEEEAVPAKKTKTIVSTAQITQTTRQARVEKKIEAHFDARSLATSE```

Is it clear?

0 个答案:

没有答案