Skip to content

Commit

Permalink
Expression Angler working.
Browse files Browse the repository at this point in the history
  • Loading branch information
asherpasha committed Oct 7, 2016
1 parent 774e176 commit d1393b0
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,6 @@
},
dataType: "json",
type: "GET",
async: false,
cache: false,
url: this.webService + "id=" + this.geneticElement.identifier + "&samples=" + JSON.stringify(sampleNames),
success: $.proxy(function(response) {
this.eFPView.Xhrs.loadSamplesXhr =null;
Expand Down
115 changes: 66 additions & 49 deletions app/scripts/src/Eplant.ExpressionAngler.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@
url: ExpressionAnglerUrl + 'getData.php?id=' + dataId,
type: 'get',
success: $.proxy(function( res) {
$.get( tempDistributionLink, $.proxy(function(distribution) {
var jsondis = $.parseJSON( distribution.replace(/bin/g,'"bin"').replace(/val/g,'"val"'));
},this));
Eplant.rawEAText=res;
$.ajax({
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
url: ExpressionAnglerUrl + 'getHistogram.php?id=' + dataId,
type: 'get',
success: $.proxy(function(distribution) {
var jsondis = $.parseJSON( distribution.replace(/bin/g,'"bin"').replace(/val/g,'"val"'));
},this)
});
var list = Eplant.processEAList(res,mainIdentifier,resultCount);
Eplant.closeEADialog();
this.showFoundGenes(list,mainIdentifier,URL,resultCount);
Expand All @@ -83,10 +89,8 @@
Eplant.closeEADialog();
Eplant.expressionAnglerResultDialog = DialogManager.artDialogDynamic(dom[0],{
close:Eplant.cancelXhr
});

});
}

},this)
});
};
Expand Down Expand Up @@ -231,52 +235,65 @@
var eaRegEx = /(.*)\?(agi_id=.*)/gmi;
var eaMatch = eaRegEx.exec(Eplant.currentEAQuery);

Eplant.expressionXhrService = $.post(eaMatch[1], eaMatch[2], $.proxy(function( data ) {
var doc = $.parseHTML(data)
var tempLinkEle = $('b:contains("View data set as text")', doc);
if(tempLinkEle.length>0){
var tempFileLink = tempLinkEle.parent().attr('href').replace('..','//bar.utoronto.ca/ntools');
var tempDistributionLink = tempFileLink.replace("ExpressionAngler","pcc_histogram");
Eplant.expressionXhrLink = $.get( tempFileLink, $.proxy(function( res ) {
$.get( tempDistributionLink, $.proxy(function( distribution ) {
var jsondis = $.parseJSON( distribution.replace(/bin/g,'"bin"').replace(/val/g,'"val"'));
},this));
var list = this.processEAList(res,Eplant.mainIdentifier,resultCount);
if(list.length<resultCount){
alert("Only "+(list.length-resultCount+5)+" more genes are found and loaded.");
}
var sliceCount = Math.abs(resultCount);
list = list.slice(sliceCount - 5, sliceCount);
this.loadExpressionAnglerGenes(list,Eplant.mainIdentifier);
},this))
.always(function() {
Eplant.expressionXhrService = $.ajax({
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
url: eaMatch[1],
data: eaMatch[2],
type: "post",
success: $.proxy(function( data ) {
var doc = $.parseHTML(data)
var tempLinkEle = $('b:contains("View data set as text")', doc);
if(tempLinkEle.length>0){

var tempFileLink = tempLinkEle.parent().attr('href').replace(/..\/.+_/i,'');
var dataId = tempFileLink.replace(/.txt/i,'');
var tempDistributionLink = tempFileLink.replace("ExpressionAngler","pcc_histogram");

Eplant.expressionXhrLink = $.ajax({
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
url: ExpressionAnglerUrl + 'getData.php?id=' + dataId,
type: 'get',
success: $.proxy(function( res) {
$.ajax({
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
url: ExpressionAnglerUrl + 'getHistogram.php?id=' + dataId,
type: 'get',
success: $.proxy(function(distribution) {
var jsondis = $.parseJSON( distribution.replace(/bin/g,'"bin"').replace(/val/g,'"val"'));
},this)
});
var list = Eplant.processEAList(res,mainIdentifier,resultCount);
Eplant.closeEADialog();
this.showFoundGenes(list,mainIdentifier,URL,resultCount);
},this)
});
} else {
var dom = $('<div/>', {
});
dom.css({'text-align':'center'});
var p = $('<div/>', {
html: '<h4 style="font-weight:bold;font-size:25px">Results</h4> <br> Expression Angler found 0 matches. <br>'
}).css({
'max-height': '400px',
'overflow': 'auto'
});
$(dom).append(p);
Eplant.closeEADialog();
});
}
else{
var dom = $('<div/>', {
});
dom.css({'text-align':'center'});
var p = $('<div/>', {
html: '<h4 style="font-weight:bold;font-size:25px">Results</h4> <br> Expression Angler found 0 matches. <br>'
}).css({
'max-height': '400px',
'overflow': 'auto'
});
$(dom).append(p);
Eplant.closeEADialog();
Eplant.expressionAnglerResultDialog = DialogManager.artDialogDynamic(dom[0],{
close:Eplant.cancelXhr
});
Eplant.expressionAnglerResultDialog = DialogManager.artDialogDynamic(dom[0],{
close:Eplant.cancelXhr
});

}

},this))
.always(function() {
}
},this)
});

};

Eplant.showFoundGenes = function(list,mainIdentifier,URL,resultCount) {
var dom = $('<div/>', {
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
async: false,
cache: false,
type: 'GET',
url: 'https://api.araport.org/community/v0.3/araport/gene_summary_by_locus_v0.2/search?locus=' + this.geneticElement.identifier,
dataType: 'json',
Expand Down Expand Up @@ -228,8 +226,6 @@
},
type: "GET",
dataType: "json",
async: false,
cache: false,
url: 'https://api.araport.org/community/v0.3/araport/araport11_gff_region_to_jbrowse_v0.1/search?q=features&chr='+this.geneticElement.chromosome.identifier+'&start='+this.chromosome_start+'&end='+this.chromosome_end+'&completely_within=true&interbase=true',
//data: { locus: this.geneticElement.identifier },
success: $.proxy(function(data) {
Expand Down Expand Up @@ -381,8 +377,6 @@
},
type: "GET",
dataType: "json",
async: false,
cache: false,
url: 'https://api.araport.org/community/v0.3/aip/get_sequence_by_identifier_v0.3/search?identifier=' + this.geneticElement.identifier,
success: $.proxy(function(data) {

Expand All @@ -405,8 +399,6 @@
},
type: "GET",
dataType: "json",
async: false,
cache: false,
url: 'https://api.araport.org/community/v0.3/aip/get_protein_sequence_by_identifier_v0.2/search?identifier='+this.geneticElement.identifier+'.1',
error: $.proxy(function() {
$("#"+config.IDs.divProteinSequenceId,this.domContainer).text("The service is not responding, please try again later.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
dataType: "json",
async: false,
cache: false,
url: Eplant.ServiceUrl + 'JSMol.cgi?agi=' + this.geneticElement.identifier,
success: $.proxy(function(response) {
var moleculeSequenceStringArr = [];
Expand All @@ -177,8 +175,6 @@
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
dataType: "json",
async: false,
cache: false,
url: 'https://api.araport.org/community/v0.3/aip/get_protein_sequence_by_identifier_v0.2/search?identifier='+this.geneticElement.identifier+'.1',
type: 'GET',
error: $.proxy(function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
async: false,
cache: false,
type: "GET",
url: 'https://api.araport.org/community/v0.3/araport/publications_by_locus_v0.1/search?locus=' + this.geneticElement.identifier,
dataType: 'json',
Expand Down Expand Up @@ -209,8 +207,6 @@
beforeSend: function(request) {
request.setRequestHeader('Authorization', 'Bearer ' + Agave.token.accessToken);
},
async: false,
cache: false,
type: "GET",
url: 'https://api.araport.org/community/v0.3/araport/generifs_by_locus_v0.1/search?locus=' + this.geneticElement.identifier,
dataType: 'json',
Expand Down

0 comments on commit d1393b0

Please sign in to comment.