runQuery: Run InterMineR queries

Description Usage Arguments Details Value Methods Author(s) See Also Examples

Description

Returns results from a query against data held inside the mine. These queries are similar to SQL queries, in that they request certain defined output columns of output, filtering the results through a series of "constraints".

Usage

1
runQuery(im, qry, timeout = 60)

Arguments

im

a Service object containing the base URL and API token, created by initInterMine.

qry

an InterMineR or a list object, representing the query to the database.

timeout

an integer, representing the number of seconds to wait for the web service to respond.

Details

Use setQuery function to create an InterMineR object. For setting a single constraint with multiple values, the function setConstraints can be used.

Alternatively, the user can define manually the constraints, the selection of data to be returned and the value by which they are ordered, as a list object.

For more information checkout the vignette of the package.

Value

a data.frame containing the data which were retrieved from the InterMine instance.

Methods

# S4 method for class 'InterMineR'

runQuery(im, qry = "InterMineR")

The method accepts an object of the class InterMineR and uses its information to perform the query on the defined InterMine instance.

InterMineR-class objects can contain a single constraint with multiple values.

# S4 method for class 'list'

runQuery(im, qry = "list")

The method accepts an object of the class list and uses its information to perform the query on the defined InterMine instance.

Queries defined as lists can possess only constraints with one value.

Author(s)

InterMine Team

See Also

setConstraints, setQuery, InterMineR-class, newQuery

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 1. Adapt 'GO_Gene' template query from FlyMine to 'InterMineR'

# get FlyMine instance
im.fly = initInterMine(listMines()["FlyMine"])

# get GO_Gene template query
qGO_Gene = getTemplateQuery(im.fly, "GO_Gene")

# constraint with GO value
qGO_Gene$where[[3]]

# modify GO_Gene template query to have more than one GO values
go.constraints = setConstraints(
  values = list(c("DNA repair", "cellular response to DNA damage stimulus")),
  modifyQueryConstraints = qGO_Gene,
  m.index = 3
)

go.constraints[[3]]

# create 'InterMineR' object
go.query = setQuery(
  inheritQuery = qGO_Gene,
  where = go.constraints
)

go.query

# run InterMineR query
go.results = runQuery(
  im = im.fly,
  qry = go.query
)

head(go.results)

# 2. Create similar query manually for Homo sapiens, using HumanMine

# get HumanMine instance
im.human = initInterMine(listMines()["HumanMine"])

# create constraints using GO terms and organism as values
hsa.go.constraints = setConstraints(
  paths = c("Gene.goAnnotation.ontologyTerm.parents.name",
            "Gene.organism.name"),
  operators = rep("=", 2),
  values = list(c("DNA repair", "cellular response to DNA damage stimulus"),
                  "Homo sapiens")
)

hsa.go.constraints

# create 'InterMineR' object
hsa.go.query = setQuery(
  select = c("Gene.secondaryIdentifier",
             "Gene.symbol",
             "Gene.goAnnotation.ontologyTerm.parents.name",
             "Gene.goAnnotation.ontologyTerm.parents.identifier",
             "Gene.goAnnotation.ontologyTerm.name",
             "Gene.goAnnotation.ontologyTerm.identifier"),
  orderBy = list(c(Gene.secondaryIdentifier = "ASC")),
  where = hsa.go.constraints
)

hsa.go.query

# run InterMineR query
hsa.go.results = runQuery(
  im = im.human,
  qry = hsa.go.query
)

head(hsa.go.results)

intermine/rintermine documentation built on Jan. 10, 2022, 4:24 p.m.