Skip to content
This repository was archived by the owner on Apr 27, 2021. It is now read-only.

Commit

Permalink
Major commit!
Browse files Browse the repository at this point in the history
GatingSet query modified to include gating set description column to be used as a tool tip in the combo box, for which this query is used. Also had to include gsid column into the query in order for the LABKEY.ext.store to properly fetch the data generated by the query.

Population query modified to include the analysis column, so that proper filtering of the population set can be done. (not yet tested)

StudyVars query created to contain the set of associated study variables for each of the generated gating sets (analyses).

Plot.r :
Parameter added for the usage of hexbin - smoothing of the data for display, for large data sets can result in faster rendering times.
Now the table of gating sets is used, the path of the selected gating set/analysis is passed from JS so that R can read it from disk.

begin.html :
Modified to not load the module contents if the StudyVars query is not present in the opencyto_preprocessing schema, meaning that the OpenCytoVisualization module has been disabled (but its interface, the web part has not been removed from the home dashboard and still rendered by the server). Once issue #18 is resolved on the server side, this would need to be removed.

ClearableComboBox.js control added to allow for a one-button approach to clearing a combo box value.

OpenCytoVisualization.js :
All of the common functionality needed for the entire suite moved to OpenCyto.js.
strStudyVarName modified to include the Display field, the Value field and the Analysis field (the latter for filtering). The source for the strStudyVarName's data now comes from a custom table containing selected study variables for the selected analysis: the additional fields are now heavily used in order to speed up the computation time.
Added a slider for selecting the hexbin parameter value.
Fixed the generated graphic, so that if 2 identical web parts are present, each of the Resizable widgets is attached to the corresponding graphic.
Moved the analysis selection combo box to the first tab.
Replaced the 'drag and drop' instruction label with a quick tip, when hovering over the corresponding panel's header.
Implemented the logic so that once a value is selected from either x-axis or y-axis combo box, that value is not present in the other combo box's choices (close issue #14).

Overall streamlined and improved the layout design.
  • Loading branch information
Lev Dashevskiy committed Jan 10, 2013
1 parent 33ea01d commit 06b4aee
Show file tree
Hide file tree
Showing 9 changed files with 1,289 additions and 1,209 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
OpenCytoVisualization
=====================

Interface within LabKey for visualizing FCS Files with the ability to display gated data
Labkey module with the interface for visualizing FCS Files with the ability to display gated data.

Depends on the OpenCytoPreprocessing module.
8 changes: 5 additions & 3 deletions src/queries/opencyto_preprocessing/GatingSet.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SELECT
gsname AS Name,
objlink AS Path
gsid,
gsname AS Name,
objlink AS Path,
gsdescription AS Tooltip
FROM
gstbl
gstbl
1 change: 1 addition & 0 deletions src/queries/opencyto_preprocessing/Population.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SELECT DISTINCT
projections.path AS path
, projections.name AS name
, projections.gsid.gsname AS analysis
FROM
projections
ORDER BY
Expand Down
2 changes: 2 additions & 0 deletions src/queries/opencyto_preprocessing/StudyVars.query.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<query name="StudyVars" schemaName="opencyto_preprocessing" xmlns="http://labkey.org/data/xml/query"/>
5 changes: 5 additions & 0 deletions src/queries/opencyto_preprocessing/StudyVars.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SELECT
study_vars.svname
,study_vars.gsid.gsname AS analysis
FROM
study_vars
36 changes: 15 additions & 21 deletions src/reports/schemas/Plot.r
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ suppressMessages( library( Rlabkey ) );

imageWidth <- as.numeric(labkey.url.params$imageWidth);
product <- as.numeric(labkey.url.params$dimension);
bin <- as.numeric(labkey.url.params$bin);
bin <- 256; # temp will be replaced by the above
bin <- as.numeric(labkey.url.params$xbin);
xAxis <- labkey.url.params$xAxis;
yAxis <- labkey.url.params$yAxis;
filesString <- labkey.url.params$filesNames;
rootPath <- labkey.url.params$path;
gsPath <- labkey.url.params$gsPath;
studyVarsString <- labkey.url.params$studyVars;

population <- labkey.url.params$population;

if ( labkey.url.params$flagEnableGrouping == 'YES' ){
Expand All @@ -38,15 +36,14 @@ CairoPNG( filename='${imgout:Graph.png}', width=3/4*imageWidth, height=3/4*image

proc.time() - ptm;

filesArray <- unlist( strsplit( filesString, split=',' ) );
studyVarsArray <- unlist( strsplit( studyVarsString, split=';' ) );
colNames <- sub( ' ', '_', studyVarsArray );
filesArray <- unlist( strsplit( filesString, split = ',' ) );
studyVarsArray <- unlist( strsplit( studyVarsString, split = ';' ) );

# flowSetToDisplay <- read.flowSet(files = filesArray, phenoData = list( Sample_Order = 'Sample Order', Replicate = 'Replicate' ) )

if ( population == '' ){

fullPathToCDF <- paste( rootPath, '/Files.cdf', sep='' );
fullPathToCDF <- paste( dirname(gsPath), '/Files.cdf', sep='' );
suppressWarnings( flowSetToDisplay <- ncdfFlowSet_open( fullPathToCDF ) );

fs <- flowSetToDisplay[ filesArray ];
Expand All @@ -60,28 +57,23 @@ if ( population == '' ){
print('LOADING DATA');
ptm <- proc.time();

G <- unarchive( paste( rootPath, '/GatingSet.tar', sep = '' ) );

meta <- labkey.selectRows( baseUrl = labkey.url.base, folderPath = labkey.url.path, schemaName = 'Samples', queryName = 'Samples' );
meta[,2] <- NULL; meta[,2] <- NULL; meta[,2] <- NULL;
colnames(meta)[1] <- 'name';
pData(G) <- meta;
G <- suppressMessages( unarchive( gsPath ) );

parentId <- match( population, getNodes( G[[1]] ) );

proc.time() - ptm;
}

if ( length(colNames) > 0 ){
colNames <- paste('factor(', colNames, ')', sep='');
cond <- paste( cond, paste( colNames, collapse = separator ), sep = '' );
if ( length(studyVarsArray) > 0 ){
studyVarsArray <- paste('factor(`', studyVarsArray, '`)', sep = '' );
cond <- paste( cond, paste( studyVarsArray, collapse = separator ), sep = '' );

if ( population == '' ){
studyVarsList <- list();
studyVarsList <- c( studyVarsList, studyVarsArray );
names(studyVarsList) <- colNames;
names(studyVarsList) <- studyVarsArray;
studyVarsList <- c( list( name='$FIL' ), studyVarsList );
pData(fs) <- as.data.frame( keyword( fs, studyVarsList ) );
pData(fs) <- as.data.frame( keyword( fs, studyVarsList ) );
}
}

Expand Down Expand Up @@ -159,11 +151,13 @@ if ( xAxis == 'Time' ){
print(yAxis)
print(cond)
print(product)
print(layoutArg)
# print( ls.str() )

if ( cond == '' ){
plotGate_labkey( G[ filesArray ], parentID = parentId, x = xAxis, y = yAxis, xbin = bin ); #, layout = layoutArg );
plotGate_labkey( G[ filesArray ], parentID = parentId, x = xAxis, y = yAxis, margin = T, xbin = bin ); #, layout = layoutArg );
} else {
plotGate_labkey( G[ filesArray ], parentID = parentId, x = xAxis, y = yAxis, cond = cond, xbin = bin ); #, layout = layoutArg );
plotGate_labkey( G[ filesArray ], parentID = parentId, x = xAxis, y = yAxis, margin = T, xbin = bin, cond = cond, layout = layoutArg );
}

}
Expand Down
39 changes: 36 additions & 3 deletions src/views/begin.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@

<script type='text/javascript'>

var initOpenCytoVisualization = function()
{
var initOpenCytoVisualization = function(){
var webPartDiv = <%=webpartContext%>.wrapperDivId;

// REMOVE once issue #18 in OpenCytoVisualization is taken care of
LABKEY.Query.getQueries({
schemaName: 'opencyto_preprocessing',
success: function(queriesInfo){
var i, array = queriesInfo.queries, length = queriesInfo.queries.length;
for ( i = 0; i < length; i ++ ){
if ( array[i].name == 'StudyVars' ){
i = length + 1;
}
}
if ( i != length ){
// END REMOVE

var OpenCytoVisualization = new LABKEY.ext.OpenCytoVisualization({
webPartDivId: webPartDiv
});

var resizeModule = function(w, h) {
var resizeModule = function(w, h){

LABKEY.Utils.resizeToViewport( OpenCytoVisualization, w, -1, null, null, -5 );

Expand All @@ -21,6 +33,27 @@

Ext.EventManager.onWindowResize( resizeModule );
Ext.EventManager.fireWindowResize();

// REMOVE once issue #18 in OpenCytoVisualization is taken care of
} else {
var temp = new Ext.Panel({
border: false,
frame: false,
height: 100,
layout: 'fit',
renderTo: webPartDiv,
resize: function(){
temp.getEl().mask('Seems like you have not enabled the OpenCytoVisualization module, click <a href="' + LABKEY.ActionURL.buildURL('admin', 'folderManagement', LABKEY.ActionURL.getContainer(), { tabId: 'folderType' } ) + '">here</a> to do so.', 'infoMask');
}
});

Ext.EventManager.onWindowResize( temp.resize );
Ext.EventManager.fireWindowResize();
}
}
});
// END REMOVE

}

Ext.onReady( initOpenCytoVisualization );
Expand Down
12 changes: 4 additions & 8 deletions src/views/begin.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@
<dependency path='OpenCyto/OpenCyto.css'/>
<dependency path='OpenCyto/jQuery/css/base/jquery-ui.css'/>
<dependency path='OpenCyto/SuperBoxSelect/superboxselect-gray-extend.css'/>
<dependency path='Ext.ux.form.LovCombo.js'/>
<dependency path='OpenCyto/ResizableCombo.js'/>
<dependency path='OpenCyto/ResizableLovCombo.js'/>
<dependency path='OpenCyto/ClearableComboBox.js'/>
<dependency path='Ext.ux.form.LovCombo.js'/>
<dependency path='OpenCyto/ExtendedLovCombo.js'/>
<dependency path='OpenCyto/SuperBoxSelect/SuperBoxSelect.js'/>
<dependency path='OpenCyto/GridPanelHeaderResize.js'/>
<dependency path='OpenCyto/ColumnModelChromePatch.js'/>
<dependency path='OpenCyto/OpenCyto.js'/>

<dependency path='OpenCytoVisualization.js'/>
</dependencies>
</view>

<!--'SearchBox/Ext.ux.form.SearchBox.css'-->
<!--'ExtendedComboBox/Ext.ux.form.ExtendedComboBox.css'-->
<!--'SearchBox/Ext.ux.form.SearchBox.js',-->
<!--'ExtendedComboBox/Ext.ux.form.ExtendedComboBox.js'-->
Loading

0 comments on commit 06b4aee

Please sign in to comment.