Skip to content

Commit

Permalink
Merge branch 'master' into rc
Browse files Browse the repository at this point in the history
  • Loading branch information
jjgao committed Jan 26, 2016
2 parents 87b5856 + e4623f3 commit 0d3cd15
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<value>classpath:/portal.properties</value>
<value>file:///${PORTAL_HOME}/src/main/resources/portal.properties</value>
</list>
</property>
Expand Down
32 changes: 0 additions & 32 deletions core/src/main/java/org/mskcc/cbio/portal/dao/DaoCancerStudy.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ public static void addCancerStudy(CancerStudy cancerStudy, boolean overwrite) th
}

setImportDate(cancerStudy.getInternalId());
reCache();
}

/**
Expand All @@ -362,11 +361,6 @@ public static void addCancerStudy(CancerStudy cancerStudy, boolean overwrite) th
*/
public static CancerStudy getCancerStudyByInternalId(int internalId) throws DaoException
{
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& studyNeedsRecaching(null, internalId)) {
System.out.print("Study with internal ID of "+internalId+" updated.");
reCacheAll(System.currentTimeMillis());
}
return byInternalId.get(internalId);
}

Expand All @@ -378,11 +372,6 @@ && studyNeedsRecaching(null, internalId)) {
*/
public static CancerStudy getCancerStudyByStableId(String stableId) throws DaoException
{
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& studyNeedsRecaching(stableId)) {
System.out.print("Study "+stableId+" updated.");
reCacheAll(System.currentTimeMillis());
}
return byStableId.get(stableId);
}

Expand All @@ -393,11 +382,6 @@ && studyNeedsRecaching(stableId)) {
* @return true if the CancerStudy exists, otherwise false
*/
public static boolean doesCancerStudyExistByStableId(String cancerStudyStableId) {
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& studyNeedsRecaching(cancerStudyStableId)) {
System.out.print("Study "+cancerStudyStableId+" updated.");
reCacheAll(System.currentTimeMillis());
}
return byStableId.containsKey(cancerStudyStableId);
}

Expand All @@ -409,11 +393,6 @@ && studyNeedsRecaching(cancerStudyStableId)) {
* @return true if the CancerStudy exists, otherwise false
*/
public static boolean doesCancerStudyExistByInternalId(int internalCancerStudyId) {
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& studyNeedsRecaching(null, internalCancerStudyId)) {
System.out.print("Study with internal ID of "+internalCancerStudyId+" updated.");
reCacheAll(System.currentTimeMillis());
}
return byInternalId.containsKey(internalCancerStudyId);
}

Expand All @@ -423,11 +402,6 @@ && studyNeedsRecaching(null, internalCancerStudyId)) {
* @return ArrayList of all CancerStudy Objects.
*/
public static ArrayList<CancerStudy> getAllCancerStudies() {
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& cacheOutOfSyncWithDb()) {
System.out.print("cache out of sync updated.");
reCacheAll(System.currentTimeMillis());
}
return new ArrayList<CancerStudy>(byStableId.values());
}

Expand All @@ -436,11 +410,6 @@ && cacheOutOfSyncWithDb()) {
* @return number of cancer studies.
*/
public static int getCount() {
if (GlobalProperties.getRecacheStudyAfterUpdate()
&& cacheOutOfSyncWithDb()) {
System.out.print("cache out of sync updated.");
reCacheAll(System.currentTimeMillis());
}
return byStableId.size();
}

Expand Down Expand Up @@ -554,7 +523,6 @@ static void deleteCancerStudy(int internalCancerStudyId) throws DaoException {
JdbcUtil.closeAll(DaoCancerStudy.class, con, pstmt, rs);
}
System.out.print("delete a study "+internalCancerStudyId);
reCacheAll(System.currentTimeMillis());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re

private boolean validate(HttpServletRequest request) throws DaoException {
String cancerStudyID = request.getParameter(QueryBuilder.CANCER_STUDY_ID);

if (DaoCancerStudy.getStatus(cancerStudyID) == DaoCancerStudy.Status.UNAVAILABLE) {
request.setAttribute(ERROR, "The selected cancer study is currently being updated, please try back later.");
return false;
}

CancerStudy cancerStudy = DaoCancerStudy
.getCancerStudyByStableId(cancerStudyID);
Expand Down
10 changes: 0 additions & 10 deletions core/src/main/java/org/mskcc/cbio/portal/servlet/PatientView.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,6 @@ private boolean validate(HttpServletRequest request) throws DaoException {
request.setAttribute(ERROR, "Please specify cancer study ID. ");
return false;
}

if (cancerStudyUpdating(cancerStudyId)) {
request.setAttribute(ERROR, "The selected cancer study is currently being updated, please try back later.");
return false;
}

CancerStudy cancerStudy = DaoCancerStudy.getCancerStudyByStableId(cancerStudyId);
if (cancerStudy==null) {
Expand Down Expand Up @@ -309,11 +304,6 @@ private boolean validate(HttpServletRequest request) throws DaoException {
return true;
}

private boolean cancerStudyUpdating(String cancerStudyId) throws DaoException
{
return (DaoCancerStudy.getStatus(cancerStudyId) == DaoCancerStudy.Status.UNAVAILABLE);
}

private void sortSampleIds(int cancerStudyId, int patientId, List<String> sampleIds) {
if (sampleIds.size()==1) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ protected void doPost(HttpServletRequest httpServletRequest,

httpServletRequest.setAttribute(XDEBUG_OBJECT, xdebug);

checkAndRedirectOnStudyStatus(httpServletRequest, httpServletResponse, cancerTypeId);

boolean errorsExist = validateForm(action, profileList, geneticProfileIdSet, geneList,
patientSetId, patientIds, httpServletRequest);
if (action != null && action.equals(ACTION_SUBMIT) && (!errorsExist)) {
Expand Down Expand Up @@ -334,8 +332,6 @@ private void processData(String cancerStudyStableId,
HttpServletResponse response,
XDebug xdebug) throws IOException, ServletException, DaoException {

checkAndRedirectOnStudyStatus(request, response, cancerStudyStableId);

// parse geneList, written in the OncoPrintSpec language (except for changes by XSS clean)
double zScore = ZScoreUtil.getZScore(geneticProfileIdSet, profileList, request);
double rppaScore = ZScoreUtil.getRPPAScore(request);
Expand Down Expand Up @@ -551,13 +547,6 @@ private void outputPlainText(HttpServletResponse response, ProfileData mergedPro
writer.close();
}

private void checkAndRedirectOnStudyStatus(HttpServletRequest request, HttpServletResponse response, String cancerStudyId) throws ServletException, IOException, DaoException
{
if (DaoCancerStudy.getStatus(cancerStudyId) == DaoCancerStudy.Status.UNAVAILABLE) {
redirectStudyUnavailable(request, response);
}
}

private void redirectStudyUnavailable(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
request.setAttribute(QueryBuilder.USER_ERROR_MESSAGE, "The selected cancer study is currently being updated, please try back later.");
Expand Down Expand Up @@ -695,4 +684,4 @@ private void forwardToErrorPage(HttpServletRequest request, HttpServletResponse
getServletContext().getRequestDispatcher("/WEB-INF/jsp/error.jsp");
dispatcher.forward(request, response);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@
for (var i=0; i<caseIds.length; i++) {
var caseId = caseIds[i];
var clinicalData = clinicalDataMap[caseId];
var compareAgainstIds = [caseId];
var OtherSampleId = guessClinicalData(clinicalData,["OTHER_SAMPLE_ID"]);
if (!OtherSampleId) OtherSampleId = caseId;
if (OtherSampleId) {
compareAgainstIds = compareAgainstIds.concat(OtherSampleId);
}
var circle = d3.selectAll(".timelineSeries_0").filter(function (x) {
if (x.tooltip_tables.length === 1) {
var specRefNum = x.tooltip_tables[0].filter(function(x) {
return x[0] === "SpecimenReferenceNumber" || x[0] === "SPECIMEN_REFERENCE_NUMBER";
})[0];
if (specRefNum) {
return specRefNum[1] === OtherSampleId;
return compareAgainstIds.indexOf(specRefNum[1]) !== -1;
}
}
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,14 @@ function initTabs() {
function fixCytoscapeWebRedraw() {
// to initially hide the network tab
$("#pathways").attr('style', 'display: none !important; height: 0px; width: 0px; visibility: hidden;');
$("#tab_pathways").attr('style', 'display: none !important; height: 0px; width: 0px; visibility: hidden;');
// to fix problem of flash repainting
$("a.patient-tab").click(function(){
if($(this).attr("href")==="#pathways") {
$("#pathways").removeAttr('style');
if($(this).attr("href")==="#tab_pathways") {
$("#tab_pathways").removeAttr('style');
} else {
$("#pathways").attr('style', 'display: block !important; height: 0px; width: 0px; visibility: hidden;');
$("#tab_pathways").attr('style', 'display: block !important; height: 0px; width: 0px; visibility: hidden;');
}
});
}
Expand All @@ -475,7 +475,7 @@ function switchToTab(toTab) {
$('#patient-tabs').tabs("option",
"active",
$('#patient-tabs ul a[href="#'+toTab+'"]').parent().index());
if (toTab==='images') {
if (toTab==='tab_images') {
loadImages();
}
}
Expand Down
25 changes: 19 additions & 6 deletions portal/src/main/webapp/js/src/study-view/data/StudyViewProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ var StudyViewProxy = (function() {
_dataLength = _data.length,
_sampleIds = Object.keys(sampleToPatientMapping),
_sequencedSampleIds = [],
_cnaSampleIds = [],
_allSampleIds = [],
_locks=0;

//Keep original data format.
Expand Down Expand Up @@ -219,17 +221,26 @@ var StudyViewProxy = (function() {
var filteredA3 = removeExtraData(_sampleIds,a3[0]);

//Find sequenced sample Ids
// TODO: this is very hacky, we should switch to the cbioportal-client.js
if(a5[0]) {
var _lists = a5[0].split('\n');
for(var i = 0; i < _lists.length; i++) {
if(_lists[i].indexOf('sequenced samples') !== -1) {
var _info = _lists[i].split('\t');
if(_info.length === 5) {
_sequencedSampleIds = _info[4].split(' ');
}
break;
var _parts = _lists[i].split('\t');
if(_parts.length < 5) continue;
if (_parts[0] === parObject.studyId+"_sequenced") {
_sequencedSampleIds = _parts[4].split(' ');
} else if (_parts[0] === parObject.studyId+"_cna") {
_cnaSampleIds = _parts[4].split(' ');
} else if (_parts[0] === parObject.studyId+"_all") {
_allSampleIds = _parts[4].split(' ');
}
}

obtainDataObject.sequencedSampleIds =
_sequencedSampleIds.length>0 ? _sequencedSampleIds : _allSampleIds;
obtainDataObject.cnaSampleIds =
_cnaSampleIds.length>0 ? _cnaSampleIds : _allSampleIds;

}

//Add new attribute MUTATION COUNT for each case if have any
Expand Down Expand Up @@ -616,6 +627,8 @@ var StudyViewProxy = (function() {
getSampleidToPatientidMap: function(){return obtainDataObject.sampleidToPatientidMap;},
getPatientIdsBySampleIds: getPatientIdsBySampleIds,
getSampleIdsByPatientIds: getSampleIdsByPatientIds,
getSequencedSampleIds: function() {return obtainDataObject.sequencedSampleIds;},
getCnaSampleIds: function() {return obtainDataObject.cnaSampleIds;},
getPatientIds: function () {
return Object.keys(patientToSampleMapping);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,24 @@ var StudyViewInitCharts = (function(){
}

function initTables() {
var initParams = {data: {attr: [], arr: {}}, numOfCases: numOfCases};
var initParams = {data: {attr: [], arr: {}}, numberOfSamples: {}};

if(hasMutation) {
var numberOfSequencedSamples = StudyViewProxy.getSequencedSampleIds().length;
initParams.data.attr.push({
name: 'mutatedGenes',
displayName: 'Mutated Genes'
displayName: 'Mutated Genes (<span id="number-of-selected-sequenced-samples">'+numberOfSequencedSamples+'</span> profiled samples)'
});
initParams.numberOfSamples.numberOfSequencedSamples = numberOfSequencedSamples;
}

if(hasCNA) {
var numberOfCnaSamples = StudyViewProxy.getCnaSampleIds().length;
initParams.data.attr.push({
name: 'cna',
displayName: 'Copy Number Altered Genes'
displayName: 'CNA Genes (<span id="number-of-selected-cna-samples">'+numberOfCnaSamples+'</span> profiled samples)'
});
initParams.numberOfSamples.numberOfCnaSamples = numberOfCnaSamples;
}

StudyViewInitTables.init(initParams);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ var StudyViewInitTables = (function() {
_worker.data.getData = function (callback, workerId){
StudyViewProxy.getMutatedGenesData().then(
function( data ) {
callback(mutatedGenesData(data, numOfCases), workerId);
callback(mutatedGenesData(data, input.numberOfSamples.numberOfSequencedSamples), workerId);
},
function( status ) {
callback(mutatedGenesData(null, numOfCases), workerId);
callback(mutatedGenesData(null, input.numberOfSamples.numberOfSequencedSamples), workerId);
console.log( status + ", you fail this time" );
},
function( status ) {
Expand Down Expand Up @@ -131,10 +131,10 @@ var StudyViewInitTables = (function() {
_worker.data.getData = function (callback, workerId){
StudyViewProxy.getCNAData().then(
function( data ) {
callback(cnaData(data, numOfCases), workerId);
callback(cnaData(data, input.numberOfSamples.numberOfCnaSamples), workerId);
},
function( status ) {
callback(cnaData(null, numOfCases), workerId);
callback(cnaData(null, input.numberOfSamples.numberOfCnaSamples), workerId);
console.log( status + ", you fail this time" );
},
function( status ) {
Expand Down Expand Up @@ -356,6 +356,7 @@ var StudyViewInitTables = (function() {
var genes = [];

if(data) {
$('#number-of-selected-sequenced-samples').html(numOfCases);
for(var i = 0, dataL = data.length; i < dataL; i++){
var datum = {},
caseIds = data[i].caseIds;
Expand Down Expand Up @@ -390,6 +391,7 @@ var StudyViewInitTables = (function() {
var genes = [];

if(data) {
$('#number-of-selected-cna-samples').html(numOfCases);
for(var i = 0, dataL = data.gene.length; i < dataL; i++){
var datum = {},
_altType = '';
Expand Down Expand Up @@ -444,10 +446,12 @@ var StudyViewInitTables = (function() {
if (numSelectedCasesL.length !== 0) {
switch (worker.opts.name) {
case 'mutatedGenes':
worker.data.arr = mutatedGenesData(StudyViewProxy.getMutatedGeneDataBasedOnSampleIds(data.selectedCases), numSelectedCasesL);
var selectedSequencedSamples = _.intersection(StudyViewProxy.getSequencedSampleIds(), data.selectedCases);
worker.data.arr = mutatedGenesData(StudyViewProxy.getMutatedGeneDataBasedOnSampleIds(data.selectedCases), selectedSequencedSamples.length);
break;
case 'cna':
worker.data.arr = cnaData(StudyViewProxy.getCNABasedOnSampleIds(data.selectedCases), numSelectedCasesL);
var selectedCnaSamples = _.intersection(StudyViewProxy.getCnaSampleIds(), data.selectedCases);
worker.data.arr = cnaData(StudyViewProxy.getCNABasedOnSampleIds(data.selectedCases), selectedCnaSamples.length);
break;
default:
break;
Expand Down

0 comments on commit 0d3cd15

Please sign in to comment.