This will produce a 400 error in the current (June 2019) InterMineR version.
library(InterMineR)
# Begin by initialising against an InterMine - in this case HumanMine
im <- initInterMine(mine=listMines()["HumanMine"], "SOME TOP SECRET TOKEN")
# initialise a variable to hold a new query
expressedPancreas = newQuery()
# Fetch
data("PL_DiabetesGenes")
pancreasConstraint1 = setConstraints(
paths = c("Gene", "Gene.proteinAtlasExpression.level", "Gene.proteinAtlasExpression.tissue.name"),
operators = c("IN", "ONE OF", "="),
values = list("PL_DiabetesGenes", c("Medium", "High"), "Pancreas")
)
expressedPancreas = setQuery(
select = c("Gene.primaryIdentifier",
"Gene.symbol",
"Gene.proteinAtlasExpression.cellType",
"Gene.proteinAtlasExpression.level",
"Gene.proteinAtlasExpression.tissue.name"
),
where = pancreasConstraint1
)
query_results <- runQuery(im = im, qry = expressedPancreas)
The reason for the error is that the query is malformed - this is the XML InterMineR produces
<query name="" model="genomic" view="Gene.primaryIdentifier Gene.symbol Gene.proteinAtlasExpression.cellType Gene.proteinAtlasExpression.level Gene.proteinAtlasExpression.tissue.name" longDescription="" sortOrder="Gene.primaryIdentifier ASC">
<constraint path="Gene" value="PL_DiabetesGenes" code="A" op="IN" extraValue=""/>
<constraint path="Gene.proteinAtlasExpression.level" value="Medium" code="B" op="ONE OF" extraValue=""/>
<constraint path="Gene.proteinAtlasExpression.tissue.name" value="Pancreas" code="C" op="=" extraValue=""/>
</query>
But ONE OF
should convert to XML like this:
<query name="" model="genomic" view="Gene.primaryIdentifier Gene.symbol Gene.proteinAtlasExpression.cellType Gene.proteinAtlasExpression.level Gene.proteinAtlasExpression.tissue.name" longDescription="" sortOrder="Gene.primaryIdentifier ASC">
<constraint path="Gene" value="PL_DiabetesGenes" code="A" op="IN" extraValue=""/>
<constraint path="Gene.proteinAtlasExpression.level" op="ONE OF" code="B" >
<value>Medium</value>
<value>High</value>
</constraint>
<constraint path="Gene.proteinAtlasExpression.tissue.name" value="Pancreas" code="C" op="=" extraValue=""/>
</query>