Commit c6e3e391 authored by Severine Duvaud's avatar Severine Duvaud
Browse files

Replaced variantClass by alternateBases + Beacon v0.3 as a default + handle...

Replaced variantClass by alternateBases + Beacon v0.3 as a default + handle all datasets + all datasets as default
parent b19561a2
......@@ -8,7 +8,7 @@ var referenceMap = {
};
//correspondence to arraymap class
var variantClassMap = {
var alternateBasesMap = {
"DEL": -1,
"DUP": 1
};
......@@ -63,26 +63,25 @@ function checkPreconditions(params) {
};
}
console.log(Boolean(variantClassMap[params.variantClass]));
console.log(Boolean(alternateBasesMap[params.alternateBases]));
if (!params.variantClass) {
if (!params.alternateBases) {
return {
hasError: true,
msg: "variant class is not defined, arrayMap supports be DUP or DEL"
};
}
if (!variantClassMap[params.variantClass]) {
if (!alternateBasesMap[params.alternateBases]) {
return {
hasError: true,
msg: params.variantClass + " variant class is not supported by arrayMap , only supports DUP or DEL"
msg: params.alternateBases + " variant class is not supported by arrayMap , only supports DUP or DEL"
};
} //TODO add additional checks
return {
hasError: false
};
}
function buildMongoQuery(params) {
......@@ -93,13 +92,15 @@ function buildMongoQuery(params) {
//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});
});
if (params.datasetIds != 'all') {
var identifiers = params.datasetIds.split(','); // comma separated list of datasets
identifiers.forEach(function (id) {
orConditions.push({ICDMORPHOLOGYCODE: id});
});
}
}
var segType = variantClassMap[params.variantClass]
var segType = alternateBasesMap[params.alternateBases]
var convertedReference = referenceMap[params.assemblyId || defaultReference];
var cond = {};
......@@ -116,7 +117,9 @@ function buildMongoQuery(params) {
}
}
andConditions.push(cond);
andConditions.push({$or: orConditions});
if (orConditions.length > 0) {
andConditions.push({$or: orConditions});
}
return {
$and: andConditions
......@@ -131,7 +134,6 @@ function checkResultAndGetResponse(params, samples, countTotal) {
"error": null
}
if (samples && samples.length > 0) { // a value was found by mongodb
responseResource.observed = samples.length;
......@@ -144,7 +146,6 @@ function checkResultAndGetResponse(params, samples, countTotal) {
responseResource.exists = "overlap";
responseResource.NOT_BEACON_ARRAYMAP_DEBUG_INFO = {"matchedSegments" : matchedSegments};
}
}
var queryResource = {
......@@ -154,19 +155,17 @@ function checkResultAndGetResponse(params, samples, countTotal) {
"datasetIds": params.datasetIds
};
return {
"beacon_id": info.id,
"response": responseResource,
"query": queryResource
};
}
function checkResult(params, sample) {
var convertedReference = referenceMap[params.assemblyId || defaultReference];
var expectedSegType = variantClassMap[params.variantClass]
var expectedSegType = alternateBasesMap[params.alternateBases]
var position = parseInt(params.start);
//TODO should check for datasets and genome reference as well
......
......@@ -22,16 +22,19 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
"position": 34439881,
"reference": "GRCh38",
"dataset": "8070/3",
"variantClass": "DEL"
"alternateBases": "DEL"
}
$scope.getNewApiUrl = function () {
var conf = $scope.config;
return $location.absUrl() + "v0.3/query?" +
"referenceName=11" +
"&start=34439881" +
"&assemblyId=GRCh38" +
"&datasetIds=8070/3" +
"&variantClass=DEL";
"referenceName=" + conf.chromosome +
"&start=" + conf.position +
"&assemblyId=" + conf.reference +
"&datasetIds=" + conf.dataset +
((conf.alternateBases === "") ? "all" : "&alternateBases=" + conf.alternateBases);
};
$scope.getInfoUrl = function () {
......@@ -48,10 +51,14 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
"&reference=" + conf.reference +
"&dataset=" + conf.dataset +
((conf.variantClass === "") ? "" : "&variantClass=" + conf.variantClass);
}
};
$scope.datasets = [
{
"code": "all",
"description": "All datasets"
},
{
"code": "0000/0",
"description": "not classified in icd-o 3 [e.g. non-neoplastic or benign]"
......
......@@ -2,26 +2,26 @@
<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>
<a target="_blank" href="https://docs.google.com/document/d/154GBOixuZxpoPykGKcPOyrYUcgEXVe2NvKx61P4Ybn4/edit"> v0.2</a> implementation for <a target="_blank" href="http://arraymap.org/">ArrayMap</a>.</p>
<p>See <a href="documentation">documentation and open questions</a>.</p>
<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>
<p>See <a href="documentation">documentation and open questions (OUTDATED)</a>.</p>
</div>
<form class="form-horizontal">
<div class="form-group">
<label for="chromosome" class="col-sm-2 control-label">Chromosome</label>
<label for="chromosome" class="col-sm-2 control-label">Reference name</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="chromosome" ng-model="config.chromosome" placeholder="Chromosome">
</div>
</div>
<div class="form-group">
<label for="position" class="col-sm-2 control-label">Position</label>
<label for="position" class="col-sm-2 control-label">Start</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="position" ng-model="config.position" placeholder="Position">
</div>
</div>
<div class="form-group">
<label for="datasetSelect" class="col-sm-2 control-label">Reference</label>
<label for="referenceSelect" class="col-sm-2 control-label">Assembly ID</label>
<div class="col-sm-4">
<select id="datasetSelect" ng-model="config.reference" class="form-control">
<select id="referenceSelect" ng-model="config.reference" class="form-control">
<option ng-repeat="ref in references" value="{{ref}}" >{{ref}}</option>
</select>
</div>
......@@ -35,9 +35,9 @@
</div>
</div>
<div class="form-group">
<label style="color:green" for="variantClass" class="col-sm-2 control-label">Variant Class</label>
<label style="color:green" for="alternateBases" class="col-sm-2 control-label">Alternate bases</label>
<div class="col-sm-4">
<select id="variantClass" ng-model="config.variantClass" class="form-control">
<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>
......@@ -48,14 +48,16 @@
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<a target="beacon" ng-href="{{getApiUrl()}}">{{getApiUrl()}}</a>
<a target="beacon" ng-href="{{getNewApiUrl()}}">{{getNewApiUrl()}}</a>
</div>
<div class="col-sm-2">
<a target="beacon" ng-href="{{getApiUrl()}}" class="btn btn-info">Beacon Query</a>
<a target="beacon" ng-href="{{getNewApiUrl()}}" class="btn btn-info">Beacon Query</a>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<a target="beacon" ng-href="{{getInfoUrl()}}">{{getInfoUrl()}}</a>
......@@ -64,13 +66,16 @@
<a target="beacon" ng-href="{{getInfoUrl()}}" class="btn btn-info">Beacon Info</a>
</div>
</div>
<!--
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<a target="beacon" ng-href="{{getNewApiUrl()}}">{{getNewApiUrl()}}</a>
<a target="beacon" ng-href="{{getApiUrl()}}">{{getApiUrl()}}</a>
</div>
<div class="col-sm-2">
<a target="beacon" ng-href="{{getNewApiUrl()}}" class="btn btn-info">Beacon v0.3</a>
<a target="beacon" ng-href="{{getApiUrl()}}" class="btn btn-info">Beacon v0.2</a>
</div>
</div>
-->
</form>
</div>
\ No newline at end of file
var express = require('express');
var router = express.Router();
var _ = require('underscore')
var beacon = require('../arraymap-beacon/v0.3/arraymap-beacon.js');
/* GET home page. */
router.get('/', function (req, res, next) {
......@@ -64,10 +65,9 @@ router.get('/v0.2/query/', function (req, res) {
});
/* Returns response for API v 0.2 */
/* Returns response for API v 0.3 */
router.get('/v0.3/query/', function (req, res) {
var beacon = require('../arraymap-beacon/v0.3/arraymap-beacon.js');
var preconditions = beacon.checkPreconditions(req.query);
if (preconditions.hasError) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment