function check_selected_values(){
    var errors = [];
    var samplesTableJSON = $("#grid").data("kendoGrid").dataSource.data().toJSON();
    var isSameSampleForDual = $('input[id=isOncoSameSample]').is(":checked");
    $.each(samplesTableJSON, function(i,row){
        if( row.irWorkflow && ($.grep(USERINPUT.workflows, function(obj){ return obj.Workflow == row.irWorkflow } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Previous Workflow for this plan is no longer available: " + row.irWorkflow)
            row.irWorkflow = "";
            row.irRelationRole = "Self";
        }
        if (irWorkflowNotValid(row)){
            $('#irWorkflowShowAll').prop('checked', true);
            /* allow all workflows selection
            errors.push("<br>Row "+ (row.row+1) + ": Selected Workflow not compatible: " + row.irWorkflow);
            row.irWorkflow = "";
            row.irRelationRole = "Self"; */
        }
        if (row.irRelationRole && ($.grep(USERINPUT.relations, function(obj){ return obj.Relation == row.irRelationRole } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Relation not found: " + row.irRelationRole);
            row.irRelationRole = "";
        }
        var workflowObj = getWorkflowObj(row.irWorkflow, row.irtag_isFactoryProvidedWorkflow);
        if (workflowObj && row.irRelationRole && (workflowObj.relations_list.indexOf(row.irRelationRole) == -1) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Relation not compatible: " + row.irRelationRole);
            row.irRelationRole = "";
        }
        if (row.irGender && ($.grep(USERINPUT.genders, function(obj){ return obj.Gender == row.irGender } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Gender not found: " + row.irGender);
            row.irGender = "";
        }
        if (row.ircancerType && ($.grep(USERINPUT.cancerTypes, function(obj){ return obj.CancerType == row.ircancerType } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Cancer Type not found: " + row.ircancerType);
            //row.ircancerType = ""; // allow TS-based annotation even if not present on IR
        }
        if (row.irPopulation && ($.grep(USERINPUT.populations, function(obj){ return obj.Population == row.irPopulation } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Population not found: " + row.irPopulation);
            //console.log("UnComment the above line once IRU implements the validation for population");
            //row.irPopulation = ""; // allow TS-based annotation even if not present on IR
        }
        if (row.irmouseStrains && ($.grep(USERINPUT.mouseStrains, function(obj){ return obj.MouseStrains == row.irmouseStrains } ).length == 0) ){
            //errors.push("<br>Row "+ (row.row+1) + ": Selected Mouse Strains not found: " + row.irmouseStrains);
            console.log("UnComment the above line once IRU implements the validation for population");
            //row.irmouseStrains = ""; // allow TS-based annotation even if not present on IR
        }
        if (!row.irSetID){
            if( i > 0 && row.irWorkflow) {
                if (planOpt.isDualNucleotideType && isSameSampleForDual && !isEven(i)){
                    row.irSetID = samplesTableJSON[i-1].irSetID;
                } else {
                    row.irSetID = generate_set_id(workflowObj, row, samplesTableJSON.slice(0, i));
                }
            } else {
                row.irSetID = (i > 0)? 1 + samplesTableJSON[i-1].irSetID : 1;
            }
        }
    });
    // update via local data to run dataSource initialization
    samplesTableInit = samplesTableJSON;
    $("#grid").data("kendoGrid").dataSource.read();
    $("#error").html(errors.toString());
    if (errors.length > 0) $('html, body').animate({scrollTop : $('#error').prop("scrollHeight")},500);
}
/**
* Validate selected values are compatible with data returned by IRU
*/
Validate selected values are compatible with data returned by IRU
Validate selected values are compatible with data returned by IRU
function check_selected_values(){
    var errors = [];
    var samplesTableJSON = $("#grid").data("kendoGrid").dataSource.data().toJSON();
    var isSameSampleForDual = $('input[id=isOncoSameSample]').is(":checked");
    $.each(samplesTableJSON, function(i,row){
        if( row.irWorkflow && ($.grep(USERINPUT.workflows, function(obj){ return obj.Workflow == row.irWorkflow } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Previous Workflow for this plan is no longer available: " + row.irWorkflow)
            row.irWorkflow = "";
            row.irRelationRole = "Self";
        }
        if (irWorkflowNotValid(row)){
            $('#irWorkflowShowAll').prop('checked', true);
        }
        if (row.irRelationRole && ($.grep(USERINPUT.relations, function(obj){ return obj.Relation == row.irRelationRole } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Relation not found: " + row.irRelationRole);
            row.irRelationRole = "";
        }
        var workflowObj = getWorkflowObj(row.irWorkflow, row.irtag_isFactoryProvidedWorkflow);
        if (workflowObj && row.irRelationRole && (workflowObj.relations_list.indexOf(row.irRelationRole) == -1) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Relation not compatible: " + row.irRelationRole);
            row.irRelationRole = "";
        }
        if (row.irGender && ($.grep(USERINPUT.genders, function(obj){ return obj.Gender == row.irGender } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Gender not found: " + row.irGender);
            row.irGender = "";
        }
        if (row.ircancerType && ($.grep(USERINPUT.cancerTypes, function(obj){ return obj.CancerType == row.ircancerType } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Cancer Type not found: " + row.ircancerType);
        }
        if (row.irPopulation && ($.grep(USERINPUT.populations, function(obj){ return obj.Population == row.irPopulation } ).length == 0) ){
            errors.push("<br>Row "+ (row.row+1) + ": Selected Population not found: " + row.irPopulation);
        }
        if (row.irmouseStrains && ($.grep(USERINPUT.mouseStrains, function(obj){ return obj.MouseStrains == row.irmouseStrains } ).length == 0) ){
            console.log("UnComment the above line once IRU implements the validation for population");
        }
        if (!row.irSetID){
            if( i > 0 && row.irWorkflow) {
                if (planOpt.isDualNucleotideType && isSameSampleForDual && !isEven(i)){
                    row.irSetID = samplesTableJSON[i-1].irSetID;
                } else {
                    row.irSetID = generate_set_id(workflowObj, row, samplesTableJSON.slice(0, i));
                }
            } else {
                row.irSetID = (i > 0)? 1 + samplesTableJSON[i-1].irSetID : 1;
            }
        }
    });
    samplesTableInit = samplesTableJSON;
    $("#grid").data("kendoGrid").dataSource.read();
    $("#error").html(errors.toString());
    if (errors.length > 0) $('html, body').animate({scrollTop : $('#error').prop("scrollHeight")},500);
}
function check_selected_values ( ) { var errors = [ ] ; var samplesTableJSON = $ ( "#grid" ) . data ( "kendoGrid" ) . dataSource . data ( ) . toJSON ( ) ; var isSameSampleForDual = $ ( 'input[id=isOncoSameSample]' ) . is ( ":checked" ) ; $ . each ( samplesTableJSON , function ( i , row ) { if ( row . irWorkflow && ( $ . grep ( USERINPUT . workflows , function ( obj ) { return obj . Workflow == row . irWorkflow } ) . length == 0 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Previous Workflow for this plan is no longer available: " + row . irWorkflow ) row . irWorkflow = "" ; row . irRelationRole = "Self" ; } if ( irWorkflowNotValid ( row ) ) { $ ( '#irWorkflowShowAll' ) . prop ( 'checked' , true ) ; } if ( row . irRelationRole && ( $ . grep ( USERINPUT . relations , function ( obj ) { return obj . Relation == row . irRelationRole } ) . length == 0 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Selected Relation not found: " + row . irRelationRole ) ; row . irRelationRole = "" ; } var workflowObj = getWorkflowObj ( row . irWorkflow , row . irtag_isFactoryProvidedWorkflow ) ; if ( workflowObj && row . irRelationRole && ( workflowObj . relations_list . indexOf ( row . irRelationRole ) == - 1 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Selected Relation not compatible: " + row . irRelationRole ) ; row . irRelationRole = "" ; } if ( row . irGender && ( $ . grep ( USERINPUT . genders , function ( obj ) { return obj . Gender == row . irGender } ) . length == 0 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Selected Gender not found: " + row . irGender ) ; row . irGender = "" ; } if ( row . ircancerType && ( $ . grep ( USERINPUT . cancerTypes , function ( obj ) { return obj . CancerType == row . ircancerType } ) . length == 0 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Selected Cancer Type not found: " + row . ircancerType ) ; } if ( row . irPopulation && ( $ . grep ( USERINPUT . populations , function ( obj ) { return obj . Population == row . irPopulation } ) . length == 0 ) ) { errors . push ( "<br>Row " + ( row . row + 1 ) + ": Selected Population not found: " + row . irPopulation ) ; } if ( row . irmouseStrains && ( $ . grep ( USERINPUT . mouseStrains , function ( obj ) { return obj . MouseStrains == row . irmouseStrains } ) . length == 0 ) ) { console . log ( "UnComment the above line once IRU implements the validation for population" ) ; } if ( ! row . irSetID ) { if ( i > 0 && row . irWorkflow ) { if ( planOpt . isDualNucleotideType && isSameSampleForDual && ! isEven ( i ) ) { row . irSetID = samplesTableJSON [ i - 1 ] . irSetID ; } else { row . irSetID = generate_set_id ( workflowObj , row , samplesTableJSON . slice ( 0 , i ) ) ; } } else { row . irSetID = ( i > 0 ) ? 1 + samplesTableJSON [ i - 1 ] . irSetID : 1 ; } } } ) ; samplesTableInit = samplesTableJSON ; $ ( "#grid" ) . data ( "kendoGrid" ) . dataSource . read ( ) ; $ ( "#error" ) . html ( errors . toString ( ) ) ; if ( errors . length > 0 ) $ ( 'html, body' ) . animate ( { scrollTop : $ ( '#error' ) . prop ( "scrollHeight" ) } , 500 ) ; }
Validate selected values are compatible with data returned by IRU
Validate selected values are compatible with data returned by IRU
/* allow all workflows selection
            errors.push("<br>Row "+ (row.row+1) + ": Selected Workflow not compatible: " + row.irWorkflow);
            row.irWorkflow = "";
            row.irRelationRole = "Self"; */ //row.ircancerType = ""; // allow TS-based annotation even if not present on IR //console.log("UnComment the above line once IRU implements the validation for population"); //row.irPopulation = ""; // allow TS-based annotation even if not present on IR //errors.push("<br>Row "+ (row.row+1) + ": Selected Mouse Strains not found: " + row.irmouseStrains); //row.irmouseStrains = ""; // allow TS-based annotation even if not present on IR // update via local data to run dataSource initialization