An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100108/e3cfb821/attachment.pl>
Directory operations
7 messages · anupam sinha, jim holtman, Uwe Ligges +2 more
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100108/be5cdf50/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100109/10bea4d8/attachment.pl>
On 09.01.2010 19:04, anupam sinha wrote:
Hi Jim,
Thanks for your suggestion. I tried scripting but gives me an
error. Can you tell me what am I doing wrong here ?
*> list.files()->org_xml_dirs
Please do turn that arrow around....
for (i in org_xml_dirs){
+ setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i")}
There is no directory .../i
Your probably want:
setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/", i))
Uwe Ligges
Error in setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i") :
cannot change working directory
*
On Fri, Jan 8, 2010 at 11:37 PM, jim holtman<jholtman at gmail.com> wrote:
?list.files ?file.info ?setwd You can get a list of all the files in a directory (list.files) and then do a file.info to determine which ones are the directories you want to search. A list.files on that directory will give you the list of file names that you can then process. On Fri, Jan 8, 2010 at 12:41 PM, anupam sinha<anupam.contact at gmail.com>wrote:
Dear all,
I have this directory structure :
Dir1 Dir2 Dir3 Dir4 .........................
A.xml D.xml G.xml
B.xml E.xml H.xml
C.xml F.xml I.xml
Within each of these directories (Dir1, Dir2 etc) there are a num of xml
files (A.xml, B.xml etc).
What I want to do is to enter into the first directory read all the xml
files do certain operations come out of the directory and do the same
thing
for another directory. Can anyone help me out ? Thanks in advance for any
suggestions.
Regards,
Anupam Sinha
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100110/e4a2cfa6/attachment.pl>
1 day later
To initialize an list:
foo <- list()
## and then extend it as in your code
foo <- c(foo, list(x=1)) foo
$x [1] 1
foo <- c(foo, list(y=1)) foo
$x [1] 1 $y [1] 1
At 7:16 PM +0530 1/10/10, anupam sinha wrote:
Hi Uwe,
Thanks for your suggestion . Here's my code. I am confused as
to how to initialize an empty list . Here I have used pairlist()
*list.files()->org_xml_dirs
for (i in org_xml_dirs)
{
setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/",i))
org_xml<-list.files()
for(j in org_xml)
{
graph_list<-pairlist()
graph<-parseKGML2Graph(j,genesOnly=TRUE)
graph_list<-c(graph_list,list(graph))
}
org_met_net<-mergeKEGGgraphs(graph_list)
met_org<-igraph.from.graphNEL(org_met_net,name=TRUE)
write.graph(met_org,"/home/anupam/Research/Anupam_data/ORG_XML_FILES/i.metnet",format=c("NCOL"))
}
*
This is giving an error:
Error in UseMethod("xmlAttrs", node) :
no applicable method for "xmlAttrs"
I apologise for asking a Bioconductor list related question on this list.
Can you figure out the problem ? Thanks in advance.
Regards,
Anupam
On Sun, Jan 10, 2010 at 12:54 AM, Uwe Ligges <
ligges at statistik.tu-dortmund.de> wrote:
On 09.01.2010 19:04, anupam sinha wrote:
Hi Jim,
Thanks for your suggestion. I tried scripting but gives me an
error. Can you tell me what am I doing wrong here ?
*> list.files()->org_xml_dirs
Please do turn that arrow around....
for (i in org_xml_dirs){
+ setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i")}
There is no directory .../i
Your probably want:
setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/", i))
Uwe Ligges
>
>
>
>
>> Error in setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i") :
>> cannot change working directory
>> *
>>
>>
>> On Fri, Jan 8, 2010 at 11:37 PM, jim holtman<jholtman at gmail.com> wrote:
?list.files
?file.info ?setwd You can get a list of all the files in a directory (list.files) and then do a file.info to determine which ones are the directories you want to search. A list.files on that directory will give you the list of file names that you can then process. On Fri, Jan 8, 2010 at 12:41 PM, anupam sinha<anupam.contact at gmail.com
>wrote:
Dear all,
I have this directory structure :
Dir1 Dir2 Dir3 Dir4 .........................
A.xml D.xml G.xml
B.xml E.xml H.xml
C.xml F.xml I.xml
Within each of these directories (Dir1, Dir2 etc) there are a num of xml
files (A.xml, B.xml etc).
What I want to do is to enter into the first directory read all the xml
files do certain operations come out of the directory and do the same
thing
for another directory. Can anyone help me out ? Thanks in advance for
any
suggestions.
Regards,
Anupam Sinha
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html< http://*www.*r-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
-- Graduate Student, Laboratory of Computtational Biology, Centre For DNA Fingerprinting And Diagnostics, 4-1-714 to 725/2, Tuljaguda complex Mozamzahi Road, Nampally, Hyderabad-500001 [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://*stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
-------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062
On 1/10/10 5:46 AM, anupam sinha wrote:
Hi Uwe,
Thanks for your suggestion . Here's my code. I am confused as
to how to initialize an empty list . Here I have used pairlist()
*list.files()->org_xml_dirs
## the following is much preferred: org_xml_dirs <- list.files()
for (i in org_xml_dirs)
{
setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/",i))
org_xml<-list.files()
for(j in org_xml)
{
graph_list<-pairlist()
graph_list <- list() ## in general, avoid pairlist
graph<-parseKGML2Graph(j,genesOnly=TRUE)
graph_list<-c(graph_list,list(graph))
}
org_met_net<-mergeKEGGgraphs(graph_list)
met_org<-igraph.from.graphNEL(org_met_net,name=TRUE)
write.graph(met_org,"/home/anupam/Research/Anupam_data/ORG_XML_FILES/i.metnet",format=c("NCOL"))
}
*
This is giving an error:
Error in UseMethod("xmlAttrs", node) :
no applicable method for "xmlAttrs"
I apologise for asking a Bioconductor list related question on this list.
Can you figure out the problem ? Thanks in advance.
Without output of sessionInfo() it is hard to diagnose further, but this looks like a bug that has been resolved in latest version of the XML package. Please make sure you are using the latest R release and latest Bioconductor and CRAN packages. + seth
Seth Falcon Bioconductor Core Team | FHCRC