diff --git a/deep_sequencing_unit/source/html/downloader/openbis-dendrogram.html b/deep_sequencing_unit/source/html/downloader/openbis-dendrogram.html index 4af8cd8dd59ce8ce0bcb3aaeb98dbb64113ab681..c2846681ecef5ddec789a8f68a9b53497193abe2 100644 --- a/deep_sequencing_unit/source/html/downloader/openbis-dendrogram.html +++ b/deep_sequencing_unit/source/html/downloader/openbis-dendrogram.html @@ -336,20 +336,16 @@ function updateInspectors(duration) .data(downloadTableCaption) .enter() .append("caption").text(function(d) { return d; }); + + // We just want to see non-directories here var downloadTableRow = downloadTable.selectAll("tr") - .data(function(d) { return (d.flowlanes) ? d.flowlanes : [] }) + .data(function(d) { return (d.files) ? d.files.filter(function(file) { return !file.isDirectory }) : [] }) .enter() - .append("tr"); - downloadTableRow - .append("td") - .style("text-align", "left") - .text("metadata.tsv"); - downloadTableRow - .append("td") - .style("border-right", "0px") - .style("text-align", "right") - .text("fastq.gz"); + .append("tr") + .append("td") + .style("text-align", "left") + .text(function (d) { return d.pathInListing }); inspector.exit().transition() .duration(duration) @@ -375,9 +371,33 @@ function toggle_inspected(d) { function retrieveFilesForSequencingSample(sequencing) { - // dsu.retrieveFastqGzDataSetsForFlowLane(sequencing, function(data) { - // sequencing.files = data.result; - // }); + // No point getting files for a sample that hasn't been sequenced + if (!hasSampleBeenSequenced(sequencing)) return; + + dsu.retrieveDataSetsForSequencingSample(sequencing, function(data) { + if (!data.result) return; + + sequencing.datasets = data.result.map(function(bisds) { return {bis : bisds} }); + sequencing.files = []; + + // Get all the files and update the inspectors once all the data is avilable + var deferrer = + new actionDeferrer( + function() { updateInspectors(500) }, + sequencing.datasets.map(function(ds) { return ds.bis.code; })); + + sequencing.datasets.forEach(function(ds) { + dsu.server.listFilesForDataSet(ds.bis.code, "/", true, function(data) { + if (!data.result) { + deferrer.dependencyCompleted(ds.bis.code); + return; + } + + sequencing.files = sequencing.files.concat(data.result); + deferrer.dependencyCompleted(ds.bis.code); + }) + }); + }); } /** @@ -398,9 +418,15 @@ function props_to_pairs(d) return pairs; } + +function hasSampleBeenSequenced(d) +{ + return (d.flowlanes && d.flowlanes.length > 0); +} + function downloadTableCaption(d) { - return (d.flowlanes && d.flowlanes.length > 0) ? ["Files"] : ["Not Yet Sequenced"]; + return hasSampleBeenSequenced(d) ? ["Files"] : ["Not Yet Sequenced"]; } function enterApp() diff --git a/deep_sequencing_unit/source/html/downloader/openbis-dsu.js b/deep_sequencing_unit/source/html/downloader/openbis-dsu.js index 80f02391801d389dfde6e4823d6218baf41fa86d..433db05a19a29cba1d0ec8b0ad88d02b031c92a0 100644 --- a/deep_sequencing_unit/source/html/downloader/openbis-dsu.js +++ b/deep_sequencing_unit/source/html/downloader/openbis-dsu.js @@ -102,7 +102,7 @@ openbis_dsu.prototype.retrieveSequencingSamplesForExperiment = function(experime } /** - * Request the replicas for the grid + * Get the flow lanes for a sequencing sample. */ openbis_dsu.prototype.retrieveFlowLanesForSequencingSample = function(sample, action) { @@ -148,40 +148,9 @@ openbis_dsu.prototype.retrieveFlowLanesForSequencingSample = function(sample, ac } /** - * Request the replicas for the grid + * Get all data sets connected to a sequencing sample */ -openbis_dsu.prototype.retrieveFastqGzDataSetsForFlowLane = function(flowlane, action) +openbis_dsu.prototype.retrieveDataSetsForSequencingSample = function(sequencing, action) { - var flowLaneCriteria = - { - targetEntityKind : "SAMPLE", - criteria : { - matchClauses : [ - {"@type":"AttributeMatchClause", - "attribute":"CODE", - "fieldType":"ATTRIBUTE", - "desiredValue": flowlane.bis.code - }, {"@type":"AttributeMatchClause", - "attribute":"SPACE", - "fieldType":"ATTRIBUTE", - "desiredValue": flowlane.project.bis.spaceCode - } - ] - } - }; - - var dataSetCriteria = - { - subCriterias : [ flowLaneCriteria ], - matchClauses : [ - {"@type":"AttributeMatchClause", - attribute : "TYPE", - fieldType : "ATTRIBUTE", - desiredValue : "FASTQ_GZ" - } - ], - operator : "MATCH_ALL_CLAUSES" - }; - - this.server.searchForDataSets(dataSetCriteria, action); + this.server.listDataSetsForSample(sequencing.bis, false, action); } \ No newline at end of file diff --git a/deep_sequencing_unit/source/html/downloader/openbis-request-cache.js b/deep_sequencing_unit/source/html/downloader/openbis-request-cache.js index 986d2882d9c9bc67ff5820092596d5f89eb7610c..5a20c8e7391a97623bea51ec8fc6665b98d7fae8 100644 --- a/deep_sequencing_unit/source/html/downloader/openbis-request-cache.js +++ b/deep_sequencing_unit/source/html/downloader/openbis-request-cache.js @@ -9,6 +9,8 @@ * Be careful not to distribute it to your customers. * * <script type="text/javascript" src="openbis-request-cache.js"></script> + * + * To clear the cache, you can call "localStorage.clear()" in a browser console. */ var original_ajax_request_func = ajaxRequest; diff --git a/deep_sequencing_unit/source/html/downloader/openbis.js b/deep_sequencing_unit/source/html/downloader/openbis.js index 8daf9bdee3376d61bda7b45850a2ff42df6e28e7..4815067191df066a9075b6216132e12003db8de4 100644 --- a/deep_sequencing_unit/source/html/downloader/openbis.js +++ b/deep_sequencing_unit/source/html/downloader/openbis.js @@ -63,7 +63,7 @@ openbis.prototype.login = function(username, password, action) { url: this.generalInfoServiceUrl, data: { "method" : "tryToAuthenticateForAllServices", "params" : [ username, password ] - }, + }, success: function(data) { openbisObj.sessionToken = data.result; @@ -71,7 +71,7 @@ openbis.prototype.login = function(username, password, action) { action(data) }, error: function() { - alert("Login failed") + alert("Login failed") } }); } @@ -90,7 +90,7 @@ openbis.prototype.isSessionActive = function(action) { url: this.generalInfoServiceUrl, data: { "method" : "isSessionActive", "params" : [ this.sessionToken ] - }, + }, success: action }); } @@ -105,7 +105,7 @@ openbis.prototype.logout = function(action) { url: this.generalInfoServiceUrl, data: { "method" : "logout", "params" : [ this.sessionToken ] - }, + }, success: action }); } @@ -115,7 +115,7 @@ openbis.prototype.listProjects = function(action) { url: this.generalInfoServiceUrl, data: { "method" : "listProjects", "params" : [ this.sessionToken ] - }, + }, success: action }); } @@ -125,7 +125,7 @@ openbis.prototype.listExperiments = function(projects, experimentType, action) { url: this.generalInfoServiceUrl, data: { "method" : "listExperiments", "params" : [ this.sessionToken, projects, experimentType ] - }, + }, success: action }); } @@ -160,24 +160,34 @@ openbis.prototype.searchForDataSets = function(searchCriteria, action) { }); } - openbis.prototype.listFilesForDataSet = function(dataSetCode, path, recursive, action) { - ajaxRequest({ - url: this.dssUrl, - data: { "method" : "listFilesForDataSet", - "params" : [ this.sessionToken, dataSetCode, path, recursive ] - }, - success: action - }); +openbis.prototype.listDataSetsForSample = function(sample, restrictToDirectlyConnected, action) { + ajaxRequest({ + url: this.generalInfoServiceUrl, + data: { "method" : "listDataSetsForSample", + "params" : [ this.sessionToken, sample, restrictToDirectlyConnected ] + }, + success: action + }); +} + +openbis.prototype.listFilesForDataSet = function(dataSetCode, path, recursive, action) { + ajaxRequest({ + url: this.dssUrl, + data: { "method" : "listFilesForDataSet", + "params" : [ this.sessionToken, dataSetCode, path, recursive ] + }, + success: action + }); } openbis.prototype.getDownloadUrlForFileForDataSet = function(dataSetCode, filePath, action) { - ajaxRequest({ - url: openbis.dssUrl, - data: { "method" : "getDownloadUrlForFileForDataSet", - "params" : [ this.sessionToken, dataSetCode, filePath ] - }, - success: action - }); + ajaxRequest({ + url: openbis.dssUrl, + data: { "method" : "getDownloadUrlForFileForDataSet", + "params" : [ this.sessionToken, dataSetCode, filePath ] + }, + success: action + }); } openbis.prototype.listQueries = function(action) { diff --git a/deep_sequencing_unit/source/html/downloader/tree.css b/deep_sequencing_unit/source/html/downloader/tree.css index cfb774fe829a7b1128291da2eeac5a8fd43c7ba6..66ee9ed7c86c7b5b48885b3dfc700fa869c62302 100644 --- a/deep_sequencing_unit/source/html/downloader/tree.css +++ b/deep_sequencing_unit/source/html/downloader/tree.css @@ -69,9 +69,9 @@ div.inspector { table.downloads { font-family: "Trebuchet MS", sans-serif; - font-size: 18px; - font-variant: small-caps; + font-size: 14px; table-layout: fixed; + padding: 0px; } /* @@ -80,9 +80,13 @@ table.downloads { } */ +.downloads tr { + border-bottom: 2px solid #FFFFFF; +} + .downloads td { width: 50%; - border-right: 2px solid #FFFFFF; + border-bottom: 2px solid #FFFFFF; } .downloads td:hover {