Entering edit mode
michael watson IAH-C
★
3.4k
@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