Unable to use biomaRt because Rcurl doesn't pick up my proxy server address
1
0
Entering edit mode
@michael-watson-iah-c-378
Last seen 10.2 years ago
Hi I'm using R 2.3.1 on windows, with biomaRt 1.7.3 and Rcurl 0.6-2. I am also using the "--internet2" option in R, which as I understand it, takes it's internet connection information from Windows, and I have Windows set up to access the internet through a proxy. However, curlPerform() will not work unless I specifically set the proxy. I can't set the proxy for the calls to Rcurl functions, as they are all wrapped up in biomaRt functions. This is probably best demonstrated with some code: > # I have an internet connection! > source("http://www.bioconductor.org/biocLite.R") > # biomaRt cannot connect > library(biomaRt) Loading required package: XML Loading required package: RCurl Warning message: use of NULL environment is deprecated > mart <- useMart("ensembl", dataset = "hsapiens_gene_ensembl") Error in curlPerform(curl = curl, .opts = opts) : couldn't connect to host > # tracked down the error to here > getURL("http://www.biomart.org/biomart/martservice?type=registry") Error in curlPerform(curl = curl, .opts = opts) : couldn't connect to host > # However, download.file works with the same URL! > download.file("http://www.biomart.org/biomart/martservice?type=registr y" , "test.xml") trying URL 'http://www.biomart.org/biomart/martservice?type=registry' Content type 'text/plain' length 200 bytes opened URL downloaded 1908 bytes Warning message: downloaded length 1908 != reported length 200 > # If I specifically set the proxy, curlPerform works! > myOpts = curlOptions(proxy="http://myproxyserver.com") > curlPerform(url="http://www.omegahat.org/RCurl", writefunction = h$update, .opts=myOpts) OK 0 > # and if I take it away again, it doesn't > curlPerform(url="http://www.omegahat.org/RCurl", writefunction = h$update) Error in curlPerform(url = "http://www.omegahat.org/RCurl", writefunction = h$update) : couldn't connect to host So, I'm not sure what to do here - either the biomaRt code needs changing so that I can pass in my proxy server address for the Rcurl functions, or the Rcurl code needs changing so that it picks up my internet connection settings the same way that download.file() and source() do.... Thanks Mick
biomaRt biomaRt • 6.1k views
ADD COMMENT
0
Entering edit mode
@duncan-temple-lang-1540
Last seen 10.2 years ago
Hi Michael In the specific case of setting the proxy, there is an easy way to achieve this. Use the http_proxy environment variable Sys.putenv("http_proxy" = "http://my.proxy.org:9999") giving the value as your proxy server. For setting arbitrary options, we need to have a mechanism that looks for a default set of options and use that if it exists. I'll add that to the next release. Thanks D. michael watson (IAH-C) wrote: > Hi > > I'm using R 2.3.1 on windows, with biomaRt 1.7.3 and Rcurl 0.6-2. I am > also using the "--internet2" option in R, which as I understand it, > takes it's internet connection information from Windows, and I have > Windows set up to access the internet through a proxy. However, > curlPerform() will not work unless I specifically set the proxy. I > can't set the proxy for the calls to Rcurl functions, as they are all > wrapped up in biomaRt functions. > > This is probably best demonstrated with some code: > >> # I have an internet connection! >> source("http://www.bioconductor.org/biocLite.R") > >> # biomaRt cannot connect >> library(biomaRt) > Loading required package: XML > Loading required package: RCurl > Warning message: > use of NULL environment is deprecated >> mart <- useMart("ensembl", dataset = "hsapiens_gene_ensembl") > Error in curlPerform(curl = curl, .opts = opts) : > couldn't connect to host > >> # tracked down the error to here >> getURL("http://www.biomart.org/biomart/martservice?type=registry") > Error in curlPerform(curl = curl, .opts = opts) : > couldn't connect to host > >> # However, download.file works with the same URL! >> > download.file("http://www.biomart.org/biomart/martservice?type=regis try" > , "test.xml") > trying URL 'http://www.biomart.org/biomart/martservice?type=registry' > Content type 'text/plain' length 200 bytes > opened URL > downloaded 1908 bytes > > Warning message: > downloaded length 1908 != reported length 200 > >> # If I specifically set the proxy, curlPerform works! >> myOpts = curlOptions(proxy="http://myproxyserver.com") >> curlPerform(url="http://www.omegahat.org/RCurl", writefunction = > h$update, .opts=myOpts) > OK > 0 > >> # and if I take it away again, it doesn't >> curlPerform(url="http://www.omegahat.org/RCurl", writefunction = > h$update) > Error in curlPerform(url = "http://www.omegahat.org/RCurl", > writefunction = h$update) : > couldn't connect to host > > > So, I'm not sure what to do here - either the biomaRt code needs > changing so that I can pass in my proxy server address for the Rcurl > functions, or the Rcurl code needs changing so that it picks up my > internet connection settings the same way that download.file() and > source() do.... > > Thanks > Mick
ADD COMMENT

Login before adding your answer.

Traffic: 780 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6