Commit 19b8cbc2 authored by Daniel Teixeira's avatar Daniel Teixeira
Browse files

adding 20K samples

parent af225b8a
...@@ -2,7 +2,6 @@ var beacon = {}; ...@@ -2,7 +2,6 @@ var beacon = {};
beacon.info = require('./beacon-info.js').info beacon.info = require('./beacon-info.js').info
beacon.checkResultAndGetResponse = require('./beacon-query.js').checkResultAndGetResponse
beacon.checkResultAndGetResponse = require('./beacon-query.js').checkResultAndGetResponse beacon.checkResultAndGetResponse = require('./beacon-query.js').checkResultAndGetResponse
beacon.checkPreconditions = require('./beacon-query.js').checkPreconditions beacon.checkPreconditions = require('./beacon-query.js').checkPreconditions
beacon.buildMongoQuery = require('./beacon-query.js').buildMongoQuery beacon.buildMongoQuery = require('./beacon-query.js').buildMongoQuery
......
...@@ -9,8 +9,8 @@ var referenceMap = { ...@@ -9,8 +9,8 @@ var referenceMap = {
//correspondence to arraymap class //correspondence to arraymap class
var variantClassMap = { var variantClassMap = {
"DEL": "-1", "DEL": -1,
"DUP": "1" "DUP": 1
}; };
// By default doe Maximilien takes Reference 37. https://github.com/maximilianh/ucscBeacon/blob/master/help.txt // By default doe Maximilien takes Reference 37. https://github.com/maximilianh/ucscBeacon/blob/master/help.txt
...@@ -78,6 +78,8 @@ function checkPreconditions(params) { ...@@ -78,6 +78,8 @@ function checkPreconditions(params) {
} }
function buildMongoQuery(params) { function buildMongoQuery(params) {
var position = parseInt(params.position); var position = parseInt(params.position);
...@@ -112,7 +114,7 @@ function buildMongoQuery(params) { ...@@ -112,7 +114,7 @@ function buildMongoQuery(params) {
}; };
} }
function checkResultAndGetResponse(params, samples) { function checkResultAndGetResponse(params, samples, countTotal) {
var responseResource = { var responseResource = {
"exists": null, "exists": null,
...@@ -123,9 +125,8 @@ function checkResultAndGetResponse(params, samples) { ...@@ -123,9 +125,8 @@ function checkResultAndGetResponse(params, samples) {
if (samples && samples.length > 0) { // a value was found by mongodb if (samples && samples.length > 0) { // a value was found by mongodb
var sample = samples[0];
responseResource.observed = samples.length; responseResource.observed = samples.length;
responseResource.NOT_BEACON_totalInDataSet = countTotal;
var matchedSegments = samples.map(function (s) { return checkResult(params, s)}); var matchedSegments = samples.map(function (s) { return checkResult(params, s)});
if (!matchedSegments || !matchedSegments[0] || !matchedSegments[0].matchedSegment) { if (!matchedSegments || !matchedSegments[0] || !matchedSegments[0].matchedSegment) {
...@@ -133,7 +134,7 @@ function checkResultAndGetResponse(params, samples) { ...@@ -133,7 +134,7 @@ function checkResultAndGetResponse(params, samples) {
responseResource.error = "Internal error, DB returned a value but post check is not valid." responseResource.error = "Internal error, DB returned a value but post check is not valid."
} else { } else {
responseResource.exists = "overlap"; responseResource.exists = "overlap";
responseResource.ARRAYMAP_DEBUG_INFO = {"matchedSegments" : matchedSegments}; responseResource.NOT_BEACON_ARRAYMAP_DEBUG_INFO = {"matchedSegments" : matchedSegments};
} }
} }
...@@ -191,4 +192,4 @@ function checkResult(params, sample) { ...@@ -191,4 +192,4 @@ function checkResult(params, sample) {
module.exports.checkPreconditions = checkPreconditions; module.exports.checkPreconditions = checkPreconditions;
module.exports.buildMongoQuery = buildMongoQuery; module.exports.buildMongoQuery = buildMongoQuery;
module.exports.checkResultAndGetResponse = checkResultAndGetResponse; module.exports.checkResultAndGetResponse = checkResultAndGetResponse;
\ No newline at end of file
...@@ -15,9 +15,12 @@ arrayMap.config(['$routeProvider', '$locationProvider', ...@@ -15,9 +15,12 @@ arrayMap.config(['$routeProvider', '$locationProvider',
arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope, $location) { arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope, $location) {
$scope.references = ['GRCh38','GRCh37','GRCh36'];
$scope.config = { $scope.config = {
"chromosome": "11", "chromosome": "11",
"position": 34439881, "position": 34439881,
"reference": "GRCh37",
"dataset": "8070/3", "dataset": "8070/3",
"variantClass": "DEL" "variantClass": "DEL"
} }
...@@ -33,6 +36,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope ...@@ -33,6 +36,7 @@ arrayMap.controller('BeaconController', ['$scope', '$location', function ($scope
return $location.absUrl() + "v0.2/query?chromosome=" + return $location.absUrl() + "v0.2/query?chromosome=" +
conf.chromosome + conf.chromosome +
"&position=" + conf.position + "&position=" + conf.position +
"&reference=" + conf.reference +
"&dataset=" + conf.dataset + "&dataset=" + conf.dataset +
((conf.variantClass === "") ? "" : "&variantClass=" + conf.variantClass); ((conf.variantClass === "") ? "" : "&variantClass=" + conf.variantClass);
} }
......
...@@ -18,6 +18,14 @@ ...@@ -18,6 +18,14 @@
<input type="text" class="form-control" id="position" ng-model="config.position" placeholder="Position"> <input type="text" class="form-control" id="position" ng-model="config.position" placeholder="Position">
</div> </div>
</div> </div>
<div class="form-group">
<label for="datasetSelect" class="col-sm-2 control-label">Reference</label>
<div class="col-sm-4">
<select id="datasetSelect" ng-model="config.reference" class="form-control">
<option ng-repeat="ref in references" value="{{ref}}" >{{ref}}</option>
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label for="datasetSelect" class="col-sm-2 control-label">Dataset</label> <label for="datasetSelect" class="col-sm-2 control-label">Dataset</label>
<div class="col-sm-4"> <div class="col-sm-4">
......
...@@ -50,14 +50,18 @@ router.get('/v0.2/query/', function (req, res) { ...@@ -50,14 +50,18 @@ router.get('/v0.2/query/', function (req, res) {
res.json(preconditions.msg); //Gets error messages res.json(preconditions.msg); //Gets error messages
return; return;
} }
var mongoQuery = beacon.buildMongoQuery(req.query); var mongoQuery = beacon.buildMongoQuery(req.query);
console.log("Building MongoDB query params: " + JSON.stringify(mongoQuery)); console.log("Building MongoDB query params: " + JSON.stringify(mongoQuery));
req.db.samples.find(mongoQuery, {}, function (err, docs){ req.db.samples.count({'ICDMORPHOLOGYCODE': req.query.dataset}, function(err, count){
var response = beacon.checkResultAndGetResponse(req.query, docs);
res.json(response); req.db.samples.find(mongoQuery, {}, function (err, docs){
}); var response = beacon.checkResultAndGetResponse(req.query, docs, count);
res.json(response);
});
}
)
}); });
......
cd ../mongo-queries/
./runquery.sh convert-positions-to-integer.js
cd -
wget "http://arraymap.org/api/?db=arraymap&qcveto=1&api_out=samples&icdm_m=8,9&withfollowup=y&api_doctype=jsondata" -O 89.json wget "http://arraymap.org/api/?db=arraymap&qcveto=1&api_out=samples&icdm_m=8,9&api_doctype=jsondata" -O 20Ksamples.json
## a smaller dataset
##wget "http://arraymap.org/api/?db=arraymap&qcveto=1&api_out=samples&icdm_m=8,9&withfollowup=y&api_doctype=jsondata" -O 89.json
mongoimport --db arraymap --collection samples -j 2 --file 89.json mongoimport --drop --db arraymap --collection samples < 20Ksamples.json --batchSize 1
\ No newline at end of file
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