|
发表于 2023-1-16 17:50:25
|
显示全部楼层
pathID <- vector()
path_name <- vector()
cpd <- vector()
cpd_name <- vector()
for (i in 1:nrow(hsa_path)){
hsa_info <- keggGet(hsa_path[i,"pathID"])
hsa_compound <- hsa_info[[1]]$COMPOUND
if(length(hsa_compound)>0){
for (j in 1:length(hsa_compound)){
pathID <- rbind(pathID,hsa_path[i,"pathID"])
path_name <-rbind(path_name,hsa_info[[1]]$NAME)
}
for (k in 1:length(hsa_compound)){
cpd <- rbind(cpd,names(hsa_compound)[k])
cpd_name <-rbind(cpd_name,as.character(hsa_compound)[k])
}
}
if(length(hsa_compound)==0){
pathID <- rbind(pathID,hsa_path[i,"pathID"])
path_name <-rbind(path_name,hsa_info[[1]]$NAME)
cpd <- rbind(cpd,NA)
cpd_name <-rbind(cpd_name,NA)
}
}
kegg_meta<-cbind(pathID,path_name,cpd,cpd_name)
colnames(kegg_meta)<-c("Pathway_ID","Pathway_Name","Compound_ID","Metabolism_Name") |
|