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
bcc8bcb5
Commit
bcc8bcb5
authored
Jul 05, 2016
by
Severine Duvaud
Browse files
Added the length to DEL or DUP as agreed for Beacon v0.4
parent
6853e4a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
app/node-app/arraymap-beacon/v0.3/beacon-query.js
View file @
bcc8bcb5
...
...
@@ -83,33 +83,27 @@ function checkPreconditions(params) {
if
(
!
params
.
alternateBases
)
{
return
{
hasError
:
true
,
msg
:
"
Alternate bases not defined, arrayMap supports DUP or DEL
"
msg
:
"
Alternate bases not defined, arrayMap supports DUP or DEL
followed by optional length
"
};
}
if
(
!
alternateBasesMap
[
params
.
alternateBases
])
{
// Beacon 0.4
// alternate bases: DEL[0-9]* AND DUP[0-9]*
var
alternate
=
params
.
alternateBases
.
replace
(
/
\d
+/
,
""
);
if
(
!
alternateBasesMap
[
alternate
])
{
return
{
hasError
:
true
,
msg
:
"
Alternate bases not supported, arrayMap supports DUP or DEL
"
msg
:
"
Alternate bases not supported, arrayMap supports DUP or DEL
followed by optional length
"
};
}
// Do not allow minLength and maxLength to be compliant with 0.3
/*
if (params.minlength && !Number(params.minlength)) {
if
(
params
.
length
&&
!
Number
(
params
.
length
))
{
return
{
hasError
:
true
,
msg: "
min. l
ength not a number"
msg
:
"
L
ength not a number
"
};
}
if (params.maxlength && !Number(params.maxlength)) {
return {
hasError: true,
msg: "max length not a number"
};
}*/
//TODO add additional checks
return
{
...
...
@@ -143,19 +137,7 @@ function checkPreconditions(params) {
function
buildMongoQuery
(
params
)
{
var
position
=
parseInt
(
params
.
start
);
// Do not allow minLength and maxLength to be compliant with 0.3
/*
if(params.alternateBases == 'DEL') {
var minLength = params.minlength ? parseInt(params.minlength) : 0;
var maxLength = params.maxlength ? parseInt(params.maxlength) : 0;
if(!minLength && (maxLength > 0)){
minLength = 1;
}
}*/
var
length
=
params
.
alternateBases
.
replace
(
/
(
DUP|DEL
)
/
,
""
)
?
parseInt
(
params
.
alternateBases
.
replace
(
/
(
DUP|DEL
)
/
,
""
))
:
0
;
var
andConditions
=
[];
var
orConditions
=
[];
...
...
@@ -170,7 +152,9 @@ function buildMongoQuery(params) {
}
}
var
segType
=
alternateBasesMap
[
params
.
alternateBases
]
// Beacon 0.4
// alternate bases: DEL[0-9]* AND DUP[0-9]*
var
segType
=
alternateBasesMap
[
params
.
alternateBases
.
replace
(
/
\d
+/
,
""
)]
var
convertedReference
=
referenceMap
[
params
.
assemblyId
||
defaultReference
];
var
condition
=
{};
...
...
@@ -183,22 +167,14 @@ function buildMongoQuery(params) {
//elem match element
var
condElemMatch
=
condition
[
convertedReference
][
'
$elemMatch
'
];
// Do not allow minLength and maxLength to be compliant with 0.3
/*
if (minLength > 0) { //There is a minLength
if (maxLength > 0) { //There is always a minLenght, if there is a max length specified (see code above)
condElemMatch.SEGSIZE = { $gte: minLength,$lte: maxLength } // min. and max lengths
condElemMatch.SEGSTART = position // exact position
}else { //If there is no max length specified
condElemMatch.SEGSIZE = { $gte: minLength }; // min. length
condElemMatch.SEGSTART = position; // exact position
}
}else { //If there is a position specific
*/
condElemMatch
.
SEGSTOP
=
{
$gte
:
position
};
condElemMatch
.
SEGSTART
=
{
$lte
:
position
};
//}
if
(
length
>
0
)
{
condElemMatch
.
SEGSIZE
=
length
;
condElemMatch
.
SEGSTART
=
position
;
}
else
{
condElemMatch
.
SEGSTOP
=
{
$gte
:
position
};
condElemMatch
.
SEGSTART
=
{
$lte
:
position
};
}
andConditions
.
push
(
condition
);
if
(
orConditions
.
length
>
0
)
{
...
...
@@ -226,23 +202,6 @@ function buildMongoQuery(params) {
function
checkResultAndGetResponse
(
params
,
datasets
)
{
// Do not allow minLength and maxLength to be compliant with 0.3
// var length = 0;
/*
if (typeof params.minlength != undefined && params.minlength != null && params.minlength != '')
{
length = parseInt(params.minlength);
if (params.alternateBases == 'DUP') {
responseResource.note = "Length provided but not considered when querying DUP";
}
}
var maxLength = 0;
if (typeof params.maxlength != undefined && params.maxlength != null && params.maxlength != '')
{
maxLength = parseInt(params.maxlength);
}
*/
var
responses
=
[];
// The query returns only datasets for which there is at least one sample with at least one matching SEGMENT...
...
...
@@ -299,7 +258,9 @@ function checkResultAndGetResponse(params, datasets) {
"
error
"
:
null
,
};
if
(
!
alternateBasesMap
[
params
.
alternateBases
])
{
// Beacon 0.4
// alternate bases: DEL[0-9]* AND DUP[0-9]*
if
(
!
alternateBasesMap
[
params
.
alternateBases
.
replace
(
/
\d
+/
,
""
)])
{
response
.
note
=
"
Type of variant not supported by arrayMap.
"
;
}
else
{
...
...
@@ -314,12 +275,9 @@ function checkResultAndGetResponse(params, datasets) {
"
start
"
:
params
.
start
,
"
assemblyId
"
:
params
.
assemblyId
,
"
datasetIds
"
:
params
.
datasetIds
,
// Beacon 0.4
// alternate bases: DEL[0-9]* AND DUP[0-9]*
"
alternateBases
"
:
params
.
alternateBases
// Do not allow minLength and maxLength to be compliant with 0.3
/*
"length": length,
"maxlength": maxLength
*/
};
// BeaconAlleleResponse
...
...
app/node-app/public/js/index.js
View file @
bcc8bcb5
...
...
@@ -22,7 +22,8 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
"
start
"
:
34439881
,
"
assemblyId
"
:
"
GRCh38
"
,
"
datasetIds
"
:
"
8070/3
"
,
"
alternateBases
"
:
"
DEL
"
"
alternateBases
"
:
"
DEL
"
,
"
length
"
:
''
// Do not allow minLength and maxLength to be compliant with 0.3
/*
"minlength": '',
...
...
@@ -44,7 +45,8 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
"
&start=
"
+
conf
.
start
+
"
&assemblyId=
"
+
conf
.
assemblyId
+
"
&datasetIds=
"
+
conf
.
datasetIds
+
((
conf
.
alternateBases
===
""
)
?
"
all
"
:
"
&alternateBases=
"
+
conf
.
alternateBases
);
((
conf
.
alternateBases
===
""
)
?
"
all
"
:
"
&alternateBases=
"
+
conf
.
alternateBases
)
+
((
conf
.
length
===
''
)
?
""
:
conf
.
length
);
// Do not allow minLength and maxLength to be compliant with 0.3
/*
((conf.minlength === '') ? "" : "&minlength=" + conf.minlength) +
...
...
app/node-app/public/partials/beacon-home.html
View file @
bcc8bcb5
<div
ng-controller=
"BeaconController"
ng-cloak
class=
"container"
>
<div
class=
"jumbotron"
>
<h1>
Beacon ArrayMap
</h1>
<p>
First Prototype of a
<a
target=
"_blank"
href=
"https://genomicsandhealth.org/work-products-demonstration-projects/beacon-project-0"
>
Beacon
</a>
<p><a
target=
"_blank"
href=
"https://genomicsandhealth.org/work-products-demonstration-projects/beacon-project-0"
>
Beacon
</a>
<a
target=
"_blank"
href=
"https://docs.google.com/document/d/1n7qtCBFwsExP_k2GPfWS_PN53Xeh8YxeCBOgyZ5itOw/edit#"
>
v0.3
</a>
implementation for
<a
target=
"_blank"
href=
"http://arraymap.org/"
>
ArrayMap
</a>
.
</p>
</div>
<form
class=
"form-horizontal"
>
...
...
@@ -37,17 +37,19 @@
<label
style=
"color:green"
for=
"alternateBases"
class=
"col-sm-2 control-label"
>
Alternate bases
</label>
<div
class=
"col-sm-4"
>
<select
id=
"alternateBases"
ng-model=
"config.alternateBases"
class=
"form-control"
>
<!--<option value="">Substitution (For precise variants)</option>-->
<option
value=
"DEL"
>
DEL (Deletion)
</option>
<!--<option value="INS">INS (Insertion)</option>-->
<option
value=
"DUP"
>
DUP (Duplication)
</option>
<!--<option value="INV">INV (Inversion)</option>
<option value="CNV">CNV (Copy Number Variation)</option>
<option value="BND">BND (Breakend???)</option>-->
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"length"
class=
"col-sm-2 control-label"
>
Length
</label>
<div
class=
"col-sm-4"
>
<input
type=
"text"
class=
"form-control"
id=
"length"
ng-model=
"config.length"
placeholder=
""
>
</div>
</div>
<!-- Do not allow minLength and maxLength to be compliant with 0.3
<div class="form-group">
<label for="minlength" class="col-sm-2 control-label">Minimal length</label>
...
...
Write
Preview
Markdown
is supported
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