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
443b2412
Commit
443b2412
authored
May 09, 2016
by
Severine Duvaud
Browse files
Beacon v0.3 compliance: Length for DEL only
parent
50c64d18
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/node-app/arraymap-beacon/v0.3/beacon-query.js
View file @
443b2412
...
...
@@ -63,8 +63,6 @@ function checkPreconditions(params) {
};
}
console
.
log
(
Boolean
(
alternateBasesMap
[
params
.
alternateBases
]));
if
(
!
params
.
alternateBases
)
{
return
{
hasError
:
true
,
...
...
@@ -82,8 +80,11 @@ function checkPreconditions(params) {
function
buildMongoQuery
(
params
)
{
var
position
=
parseInt
(
params
.
start
);
// not handled for now...
// var length = (params.length.length == 0 ? 0 : parseInt(params.length));
var
length
=
0
;
if
(
params
.
alternateBases
==
'
DEL
'
)
{
length
=
(
params
.
length
.
length
==
0
?
0
:
parseInt
(
params
.
length
));
}
var
andConditions
=
[];
var
orConditions
=
[];
...
...
@@ -104,15 +105,27 @@ function buildMongoQuery(params) {
var
convertedReference
=
referenceMap
[
params
.
assemblyId
||
defaultReference
];
var
cond
=
{};
cond
[
convertedReference
]
=
{
'
$elemMatch
'
:
{
'
CHRO
'
:
params
.
referenceName
,
'
SEGTYPE
'
:
segType
,
'
SEGSTOP
'
:
{
$gte
:
position
},
'
SEGSTART
'
:
{
$lte
:
position
if
(
length
>
0
)
{
cond
[
convertedReference
]
=
{
'
$elemMatch
'
:
{
'
CHRO
'
:
params
.
referenceName
,
'
SEGTYPE
'
:
segType
,
'
SEGSTOP
'
:
position
+
length
,
// exact position
'
SEGSTART
'
:
position
// exact position
}
}
}
else
{
cond
[
convertedReference
]
=
{
'
$elemMatch
'
:
{
'
CHRO
'
:
params
.
referenceName
,
'
SEGTYPE
'
:
segType
,
'
SEGSTOP
'
:
{
$gte
:
position
},
'
SEGSTART
'
:
{
$lte
:
position
}
}
}
}
...
...
@@ -159,6 +172,9 @@ function checkResultAndGetResponse(params, samples, countTotal) {
if
(
typeof
params
.
length
!=
undefined
&&
params
.
length
!=
null
&&
params
.
length
!=
''
)
{
length
=
parseInt
(
params
.
length
);
if
(
params
.
alternateBases
==
'
DUP
'
)
{
responseResource
.
note
=
"
Length provided but not considered when querying DUP
"
;
}
}
var
queryResource
=
{
...
...
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