Last active
March 2, 2022 16:12
-
-
Save svigneau/9699239 to your computer and use it in GitHub Desktop.
This snippet illustrates how to query David from R, using the RDAVIDWebService package.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This snippet illustrates how to query David from R, using the RDAVIDWebService package. | |
# Load RDAVIDWebService. | |
library("RDAVIDWebService") | |
# Create a DAVIDWebService object connected to David, using your registration email. | |
# To register, go to: http://david.abcc.ncifcrf.gov/content.jsp?file=WS.html. | |
david <- DAVIDWebService$new(email='[email protected]') | |
# Define foreground and background gene lists. | |
# The foreground list should be contained within the background list. | |
FG <- addList(david, myForegroundGenes, idType="REFSEQ_MRNA", listName="isClass", listType="Gene") | |
BG <- addList(david, myBackgroundGenes, idType="REFSEQ_MRNA", listName="all", listType="Background") | |
# Inspect FG and BG to see the proportion of genes recognized by David, and those that are unmapped. | |
FG | |
BG | |
# Inspect "david" object to see the gene lists selected as foreground and background. | |
david | |
# Specifiy annotation categories. | |
setAnnotationCategories(david, c("GOTERM_BP_ALL", "GOTERM_MF_ALL", "GOTERM_CC_ALL")) | |
# Get functional annotation chart as R object. | |
FuncAnnotChart <- getFunctionalAnnotationChart(david) | |
# Print functional annotation chart to file. | |
getFunctionalAnnotationChartFile(david, "FuncAnnotChart.tsv") | |
# Get functional annotation clustering (limited to 3000 genes). | |
FuncAnnotClust <- getClusterReport(david) | |
# Print functional annotation clustering to file (limited to 3000 genes). | |
getClusterReportFile(david, "FuncAnnotClust.tsv") |
Due to changes in the link to DAVID, will need to specify the correct url:
david <- DAVIDWebService$new(email='[email protected]', url="https://david.ncifcrf.gov/webservice/services/DAVIDWebService.DAVIDWebServiceHttpSoap12Endpoint/")
Found this to be true even with the current release of the DAVID Web Service tool (RDAVIDWebService_1.22.0)
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the reference. To use a specified background you need to set it. Note that when you call david it tells you which background it is using. For example, mine is called Backgrnd:
Available Background List/s:
Name Using
1 Backgrnd
2 Homo sapiens *
The list is there but it is not being used (look at *), You check the default with :
You can change the background with:
setCurrentBackgroundPosition(david, 1)
Now if you call david you should get the following:
Available Background List/s:
Name Using
1 Backgrnd *
2 Homo sapiens