Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ST
ga4gh-arraymap
Commits
576aa549
Commit
576aa549
authored
Apr 13, 2016
by
Severine Duvaud
Browse files
Beacon version 0.3: Handling of datasetIds
parent
4817ee85
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/node-app/arraymap-beacon/v0.3/beacon-query.js
View file @
576aa549
...
...
@@ -56,6 +56,13 @@ function checkPreconditions(params) {
};
}
if
(
!
params
.
datasetIds
)
{
return
{
hasError
:
true
,
msg
:
"
No dataset provided
"
};
}
console
.
log
(
Boolean
(
variantClassMap
[
params
.
variantClass
]));
if
(
!
params
.
variantClass
)
{
...
...
@@ -78,20 +85,21 @@ function checkPreconditions(params) {
}
function
buildMongoQuery
(
params
)
{
var
position
=
parseInt
(
params
.
start
);
var
conditions
=
[];
//add constraint on dataset if it exsits
if
(
params
.
dataset
)
conditions
.
push
({
ICDMORPHOLOGYCODE
:
params
.
dataset
});
var
andConditions
=
[];
var
orConditions
=
[];
//add constraint on datasets if required
if
(
params
.
datasetIds
){
var
identifiers
=
params
.
datasetIds
.
split
(
'
,
'
);
// comma separated list of datasets
identifiers
.
forEach
(
function
(
id
)
{
orConditions
.
push
({
ICDMORPHOLOGYCODE
:
id
});
});
}
var
segType
=
variantClassMap
[
params
.
variantClass
]
var
convertedReference
=
referenceMap
[
params
.
assemblyId
||
defaultReference
];
var
cond
=
{};
...
...
@@ -107,10 +115,11 @@ function buildMongoQuery(params) {
}
}
}
andConditions
.
push
(
cond
);
andConditions
.
push
({
$or
:
orConditions
});
conditions
.
push
(
cond
);
return
{
$and
:
c
onditions
$and
:
andC
onditions
};
}
...
...
@@ -142,7 +151,7 @@ function checkResultAndGetResponse(params, samples, countTotal) {
"
referenceName
"
:
params
.
referenceName
,
"
start
"
:
params
.
start
,
"
assemblyId
"
:
params
.
assemblyId
,
"
dataset
id
"
:
params
.
dataset
"
dataset
Ids
"
:
params
.
dataset
Ids
};
...
...
@@ -156,15 +165,13 @@ function checkResultAndGetResponse(params, samples, countTotal) {
function
checkResult
(
params
,
sample
)
{
var
convertedReference
=
referenceMap
[
params
.
reference
||
defaultReference
];
var
convertedReference
=
referenceMap
[
params
.
assemblyId
||
defaultReference
];
var
expectedSegType
=
variantClassMap
[
params
.
variantClass
]
var
position
=
parseInt
(
params
.
start
);
//TODO should check for dataset and genomre reference as well
//TODO should check for datasets and genome reference as well
var
foundSegment
;
sample
[
convertedReference
].
forEach
(
function
(
segment
)
{
if
(
segment
.
CHRO
===
params
.
referenceName
)
{
...
...
@@ -179,7 +186,6 @@ function checkResult(params, sample) {
}
})
var
result
=
{
matchedSampleUID
:
sample
.
UID
,
matchedDataSet
:
sample
.
ICDMORPHOLOGYCODE
,
...
...
@@ -188,7 +194,6 @@ function checkResult(params, sample) {
return
result
;
}
module
.
exports
.
checkPreconditions
=
checkPreconditions
;
module
.
exports
.
buildMongoQuery
=
buildMongoQuery
;
module
.
exports
.
checkResultAndGetResponse
=
checkResultAndGetResponse
;
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment