我是这个社区的新手,我想问这个问题(我没有发现任何问题可以帮助我)。
我有一根绳子:
{name:GTP hydrolysis and joining of the 60S ribosomal subunit,description:Hydrolysis of eIF2-GTP occurs after the Met-tRNAi has recognized the AUG. This reaction is catalyzed by eIF5 (or eIF5B) and is thought to cause dissociation of all other initiation factors and allow joining of the large 60S ribosomal subunit. The 60S subunit joins - a reaction catalyzed by eIF5 or eIF5B - resulting in a translation-competent 80S ribosome. Following 60S subunit joining, eIF5B hydrolyzes its GTP and is released from the 80S ribosome, which is now ready to start elongating the polypeptide chain.,url:https://reactome.org/PathwayBrowser/#/R-HSA-72706,sameAs:null,version:62,keywords:[Pathway],creator:[],includedInDataCatalog:{url:https://reactome.org,name:Reactome,@type:DataCatalog},distribution:[{contentUrl:https://reactome.org/ContentService/exporter/sbml/72706.xml,fileFormat:SBML,@type:DataDownload},{contentUrl:https://reactome.org/ReactomeRESTfulAPI/RESTfulWS/sbgnExporter/72706,fileFor... <truncated>这是非常混乱的,我想删除所有字符之前的文字描述。结果会是这样:
description:Hydrolysis of eIF2-GTP occurs after the Met-tRNAi has recognized the AUG. This reaction is catalyzed by eIF5 (or eIF5B) and is thought to cause dissociation of all other initiation factors and allow joining of the large 60S ribosomal subunit. The 60S subunit joins - a reaction catalyzed by eIF5 or eIF5B - resulting in a translation-competent 80S ribosome. Following 60S subunit joining, eIF5B hydrolyzes its GTP and is released from the 80S ribosome, which is now ready to start elongating the polypeptide chain.,url:https://reactome.org/PathwayBrowser/#/R-HSA-72706,sameAs:null,version:62,keywords:[Pathway],creator:[],includedInDataCatalog:{url:https://reactome.org,name:Reactome,@type:DataCatalog},distribution:[{contentUrl:https://reactome.org/ContentService/exporter/sbml/72706.xml,fileFormat:SBML,@type:DataDownload},{contentUrl:https://reactome.org/ReactomeRESTfulAPI/RESTfulWS/sbgnExporter/72706,fileFor... <truncated>提前感谢!
发布于 2017-10-24 09:07:55
您应该使用reg ex方法,这样您就可以处理不同数量的主角:
a <- "{name:GTP hydrolysis and joining of the 60S ribosomal subunit,description:Hydrolysis of eIF2-GTP occurs after the Met-tRNAi has recognized the AUG. This reaction is catalyzed by eIF5 (or eIF5B) and is thought to cause dissociation of all other initiation factors and allow joining of the large 60S ribosomal subunit. The 60S subunit joins - a reaction catalyzed by eIF5 or eIF5B - resulting in a translation-competent 80S ribosome. Following 60S subunit joining, eIF5B hydrolyzes its GTP and is released from the 80S ribosome, which is now ready to start elongating the polypeptide chain.,url:https://reactome.org/PathwayBrowser/#/R-HSA-72706,sameAs:null,version:62,keywords:[Pathway],creator:[],includedInDataCatalog:{url:https://reactome.org,name:Reactome,@type:DataCatalog},distribution:[{contentUrl:https://reactome.org/ContentService/exporter/sbml/72706.xml,fileFormat:SBML,@type:DataDownload},{contentUrl:https://reactome.org/ReactomeRESTfulAPI/RESTfulWS/sbgnExporter/72706,fileFor..."
gsub('(.*)description:','', a)发布于 2017-10-24 09:10:06
您可以使用来自str_extract的stringr
library(stringr)
str_extract(text, "description:(?s)(.*$)")
"description:Hydrolysis of eIF2-GTP occurs after the ...发布于 2017-10-24 09:06:30
这个怎么样?
library(stringr)
yourData$yourColumn <- str_sub(yourData$yourColumn, start=62) # hope I've counted right!https://stackoverflow.com/questions/46906190
复制相似问题