Commit 4351ecca authored by Ariane Mora's avatar Ariane Mora

Updated to have the flower type vis

parent af41dc59
......@@ -14,7 +14,7 @@ function getNetworksFromBedFile() {
data : {request: "status"},
success : function(data) {
run_networks_in_bed(JSON.parse(data));
data['threeD_attr'] = set_up_3D_attr();
//data['threeD_attr'] = set_up_3D_attr();
},
error : function(e) {
console.log("ERROR: ", e);
......@@ -42,11 +42,15 @@ function getNetworkByChromAndPosition(chrom, start, end) {
data : data,
success : function(data) {
// Run the two D version
dna_attr.data = JSON.parse(data)[0];
run_dna_visualisation();
dna_attr.data = JSON.parse(data);
// Set up the facts for the data so we can easily filter
// in dataProcessing we create a crossfilter instance.
process_networks();
// Always run the vis with the default network
run_dna_visualisation(0);
// Run the 3D version
// Clear the inner HTML first
threeD_attr = set_up_3D_attr();
//threeD_attr = set_up_3D_attr();
},
error : function(e) {
......
......@@ -198,3 +198,139 @@ var filter_on_gene = function(gene) {
/**
* ====================================================================================================================
* Create a new crossfilter instance for each network range
* ====================================================================================================================
*/
var set_up_network_data = function (data) {
// Set up the crossfilter facts. --> use a JSON object i.e. data
// that contains elements (array) these get translated to facts.
// Data contains the following:
// 1.start 2.end 3. Array of networks that have that start and end.
var network_facts = crossfilter(data);
// Store globally
processed_data["network_facts"] = network_facts;
}
// Need to remove the facts when we get a new network
var remove_network_data = function() {
if (processed_data.network_facts != []) {
processed_data.network_facts.remove();
}
}
/**
* ============================================================================
* Create interaction dimensions
* ============================================================================
*/
/**
* Make a dimension on the network ID to make it quick to filter on that ID.
*/
var create_network_dimension = function() {
// Create a dimesnsion on the chromosone of the gene or network
var network_dimension = processed_data.network_facts.dimension(function (d) {
return d.network_id;
});
// Store Globally
processed_data["network_dimension"] = network_dimension;
};
/**
* Make a dimension tpo easily filter between edges and interactions
*/
var create_network_type_dimension = function() {
// Create a dimesnsion on the chromosone of the gene or network
var network_type_dimension = processed_data.network_facts.dimension(function (d) {
return d.type;
});
// Store Globally
processed_data["network_type_dimension"] = network_type_dimension;
};
/**
* Make a dimension on the start to make it easy to filter.
*/
var create_interaction_start_dimension = function() {
// Create a dimesnsion on the chromosone of the gene or network
var interaction_start_dimension = processed_data.network_facts.dimension(function (d) {
return d.start;
});
// Store Globally
processed_data["interaction_start_dimension"] = interaction_start_dimension;
};
/**
* Make a dimension on the start to make it easy to filter.
*/
var create_interaction_end_dimension = function() {
// Create a dimesnsion on the chromosone of the gene or network
var interaction_end_dimension = processed_data.network_facts.dimension(function (d) {
return d.end;
});
// Store Globally
processed_data["interaction_end_dimension"] = interaction_end_dimension;
}
/**
* ===================================================================================================================
* Want filters: 1. Networks (need to check if in array)
* ===================================================================================================================
*/
var remove_network_filters = function() {
processed_data.network_dimension.filterAll();
processed_data.network_type_dimension.filterAll();
processed_data.interaction_start_dimension.filterAll();
processed_data.interaction_end_dimension.filterAll();
}
var filter_on_network = function(network_id) {
processed_data.network_dimension.filterAll();
// want the interactions with that network
processed_data.network_dimension.filterExact(network_id);
return processed_data.network_type_dimension.top(Infinity);
}
// Either returns all interactions or all egdes
var filter_on_network_type = function(type) {
processed_data.network_type_dimension.filterAll();
// Only want interactions not edges
type_filter = processed_data.network_type_dimension.filterExact(type);
return processed_data.network_dimension.top(Infinity);
}
var filter_interactions_on_position = function(start, end) {
// Clear the associated filters.
processed_data.interaction_start_dimension.filterAll();
processed_data.interaction_end_dimension.filterAll();
// Filters the data based on the start and end positions
// filterRange([>=min, <max]); Can also do on strings
processed_data.interaction_start_dimension.filterRange([start, end]);
processed_data.interaction_end_dimension.filterRange([start, end]);
// Now the underlying data has changed (will need to redraw)
return get_filter(processed_data.network_facts);
}
\ No newline at end of file
......@@ -34,7 +34,9 @@
</div>
</div>
<div class="form-group row col-sm-offset-1 col-sm-8 pad-top-bottom" style="padding-top:30px;"><button type="submit" name="submitGnv" class="btn btn-default col-xs-12" style="background-color: #C8D3BB;" id="submit-btn" onclick="javascript:displayLoad();">Perform reconstruction</button></div> </form>
<div class="form-group row col-sm-offset-1 col-sm-8 pad-top-bottom" style="padding-top:30px;">
</div>
</form>
</div>
</div>
</div>
......
......@@ -41,7 +41,7 @@
<div id="genomevis-div">
<button id="diff-dna-view" onclick="diff_dna_view();" >change stand view</button>
<!-- Contains the D3 strand vis. -->
<svg id="strandvis" width="1200" height="400"></svg>
<svg id="strandvis" width="1200" height="800"></svg>
</div>
<div id="interactionvis-div">
<svg id="interactionvis" width="200" height="300"></svg>
......
Markdown is supported
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