Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
ga4gh-arraymap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Baudis
ga4gh-arraymap
Commits
6579bbf6
Commit
6579bbf6
authored
May 24, 2016
by
Severine Duvaud
Browse files
Options
Downloads
Patches
Plain Diff
Implementing latest changes in the API spec
parent
7047dc4f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/node-app/arraymap-beacon/v0.3/beacon-query.js
+12
-2
12 additions, 2 deletions
app/node-app/arraymap-beacon/v0.3/beacon-query.js
app/node-app/routes/index.js
+8
-3
8 additions, 3 deletions
app/node-app/routes/index.js
with
20 additions
and
5 deletions
app/node-app/arraymap-beacon/v0.3/beacon-query.js
+
12
−
2
View file @
6579bbf6
...
...
@@ -176,12 +176,22 @@ function checkResultAndGetResponse(params, samples, countTotal) {
if
(
samples
&&
samples
.
length
>
0
)
{
// a value was found by mongodb
responseResource
.
observed
=
samples
.
length
;
// SD, May 2016: according to the specs, observed parameter was removed from BeaconDatasetAlleleResponse.
// We could divide the sample.length by the total number of samples in order to fill the frequency parameters
// for instance (and if of interest for arrayMap).
// responseResource.observed = samples.length;
responseResource
.
NOT_BEACON_numberMatchedSamples
=
samples
.
length
;
var
matchedSegments
=
samples
.
map
(
function
(
s
)
{
return
checkResult
(
params
,
s
)});
if
(
!
matchedSegments
||
!
matchedSegments
[
0
]
||
!
matchedSegments
[
0
].
matchedSegment
)
{
responseResource
.
exists
=
null
;
responseResource
.
error
=
"
Internal error, DB returned a value but post check is not valid.
"
// BeaconError instead of simple string
// (error is not null if and only of exists is null)
responseResource
.
error
=
{
errorCode
:
500
,
message
:
"
Internal error, DB returned a value but post check is not valid.
"
};
}
else
{
responseResource
.
exists
=
true
;
responseResource
.
NOT_BEACON_ARRAYMAP_DEBUG_INFO
=
{
"
matchedSegments
"
:
matchedSegments
};
...
...
This diff is collapsed.
Click to expand it.
app/node-app/routes/index.js
+
8
−
3
View file @
6579bbf6
...
...
@@ -54,7 +54,6 @@ router.get('/v0.2/query/', function (req, res) {
console
.
log
(
"
Building MongoDB query params:
"
+
JSON
.
stringify
(
mongoQuery
));
req
.
db
.
samples
.
count
({
'
ICDMORPHOLOGYCODE
'
:
req
.
query
.
dataset
},
function
(
err
,
count
){
req
.
db
.
samples
.
find
(
mongoQuery
,
{},
function
(
err
,
docs
){
var
response
=
beacon
.
checkResultAndGetResponse
(
req
.
query
,
docs
,
count
);
response
.
NOT_BEACON_totalInDataSet
=
count
;
...
...
@@ -77,8 +76,14 @@ router.get('/v0.3/query/', function (req, res) {
var
mongoQuery
=
beacon
.
buildMongoQuery
(
req
.
query
);
console
.
log
(
"
Building MongoDB query params:
"
+
JSON
.
stringify
(
mongoQuery
));
req
.
db
.
samples
.
count
({
'
ICDMORPHOLOGYCODE
'
:
req
.
query
.
dataset
},
function
(
err
,
count
){
// Count: list of datasets (and not 1 dataset)
var
orConditions
=
[];
var
identifiers
=
req
.
query
.
datasetIds
.
split
(
'
,
'
);
// comma separated list of datasets
identifiers
.
forEach
(
function
(
id
)
{
orConditions
.
push
({
ICDMORPHOLOGYCODE
:
id
});
});
req
.
db
.
samples
.
count
({
$or
:
orConditions
},
function
(
err
,
count
){
req
.
db
.
samples
.
find
(
mongoQuery
,
{},
function
(
err
,
docs
){
var
response
=
beacon
.
checkResultAndGetResponse
(
req
.
query
,
docs
,
count
);
response
.
NOT_BEACON_totalInDataSet
=
count
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment