This is what I am doing:
- Extract 112 xml files names from my working directory into a list.
- Convert xml files into graphs.
- Create a list of all those xml files
- Merge all those graphNEL objects into one big graphNEL object
Here is my code:
rm(list = ls())
pathways = list.files(pattern="*.xml")
for (i in 1:length(pathways)){
assign(pathways[i], parseKGML2Graph(pathways[i],expandGenes=TRUE, genesOnly = "TRUE"))}
rm(i);rm(pathways);
pathways<-objNameToList(objects(), parent.frame())
mergedPathways_u <- ugraph(mergeKEGGgraphs(pathways, edgemode = "directed"))
The problem is when I use objNameToList
I have to ensure there are no other objects in my R environment other than xml files which I do by using rm(list = ls())
. Is there a way around this? Is it possible to list only those 112 graphNEL objects. The rest of the data is used later and I have to load it again and that would require writing it in files which I don't want to do.
Thanks!