Skip to content

Instantly share code, notes, and snippets.

@svigneau
Last active March 2, 2022 16:12
Show Gist options
  • Save svigneau/9699239 to your computer and use it in GitHub Desktop.
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 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")
@dkcoxie
Copy link

dkcoxie commented Nov 20, 2019

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