<commit_before><%@page import="edu.wustl.catissuecore.bizlogic.magetab.MagetabExportBizLogic"%>
<%@page import="java.util.ListIterator"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page import="edu.wustl.catissuecore.bizlogic.magetab.MagetabExportWizardBean"%>
<%@ page import="edu.wustl.catissuecore.domain.Specimen"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.Set"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="gov.nih.nci.logging.api.util.StringUtils" %>
<%
MagetabExportWizardBean wizardBean = (MagetabExportWizardBean)session.getAttribute(
		MagetabExportWizardBean.MAGETAB_EXPORT_WIZARD_BEAN);

MagetabExportWizardBean.SseTable sseTable = wizardBean.getSseTable();
List<List<Specimen>> chains = sseTable.getSpecimenChains();
Set<Integer> chainSelections = sseTable.getChainSelections();
int maxChainLength = sseTable.getMaxChainLength();
boolean isCaArrayCompatible=wizardBean.getCaArrayEnabled()!=null?true:false;
int counter=0;
%>

<script type="text/javascript">

function checkIfAllNA(columnPosition){
    var allNA=false;
    var ct1 = 0
    var ct2 = 0;
    $j('#sdrfData tr td:nth-child('+columnPosition+')').each(function(){
         var content=$j(this).html();  
         ct1++;
         if(content.trim()=='&nbsp;N/A'){           
            ct2++;
         }
    }); 
    if (ct1 == ct2) {
    	allNA =true;
    }
    return allNA;
}
function removeColumn(columnPosition){
	//alert (columnPosition);
     $j('#sdrfData tr th:nth-child('+columnPosition+')').each(function(){
         $j(this).remove();
    });
    $j('#sdrfData tr td:nth-child('+columnPosition+')').each(function(){
         $j(this).remove();
    });   
}

function removeDuplicates(inputArray) {
    var i;
    var len = inputArray.length;
    var outputArray = [];
    var temp = {};

    for (i = 0; i < len; i++) {
        temp[inputArray[i]] = 0;
    }
    for (i in temp) {
        outputArray.push(parseInt(i));
    }
    return outputArray;
}
function displayColumns() {
	var allCols = "";
    $j('#sdrfData tr th').each(function(){
    	allCols = allCols + "XX" + $j(this).html().substring(0,8);
    });
    $j('#displayColumns').val(allCols);
}

$j(function(){
    var caArrayCompatible="true";
    
	if($j('input[type="checkbox"]').length>0){
		if($j('input[type="checkbox"]:checked').length==0)		
			$j('input[type="button"][value="Next"]').attr('disabled', 'disabled');	
            }
            else{
                //no chains so disable the next button.
                $j('input[type="button"][value="Next"]').attr('disabled', 'disabled');
            }
         if(caArrayCompatible&&$j('#sdrfData tr').length>0){
             //alert('compatible');
             //now search the table if it has any sample column which is N/A.
             var listOfColumnsIn= new Array();
             var listOfColumns;<commit_msg>* Task/Bug Id: Bug 21555 - Error while exporting MAGE TAB * Code Reviewed By: <Reviewed By> On : <Review date> * Technical Details:  <Technical details for the changes made if any> * Unit tested:   <Names of the test cases> * Developer Notes: <Free form comments, typically will involve names of the methods changed etc> * Current Build++ Counts for this file : <B++ counts before the file is checked-in> * PMD - X     Checkstyle - X     Findbugs - X     CPD – X<commit_after><%@page import="edu.wustl.catissuecore.bizlogic.magetab.MagetabExportBizLogic"%>
<%@page import="java.util.ListIterator"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page import="edu.wustl.catissuecore.bizlogic.magetab.MagetabExportWizardBean"%>
<%@ page import="edu.wustl.catissuecore.domain.Specimen"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.Set"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="gov.nih.nci.logging.api.util.StringUtils" %>
<%
MagetabExportWizardBean wizardBean = (MagetabExportWizardBean)session.getAttribute(
		MagetabExportWizardBean.MAGETAB_EXPORT_WIZARD_BEAN);

MagetabExportWizardBean.SseTable sseTable = wizardBean.getSseTable();
List<List<Specimen>> chains = sseTable.getSpecimenChains();
Set<Integer> chainSelections = sseTable.getChainSelections();
int maxChainLength = sseTable.getMaxChainLength();
boolean isCaArrayCompatible=wizardBean.getCaArrayEnabled()!=null?true:false;
int counter=0;
%>

<script type="text/javascript">

function checkIfAllNA(columnPosition){
    var allNA=false;
    var ct1 = 0
    var ct2 = 0;
    $j('#sdrfData tr td:nth-child('+columnPosition+')').each(function(){
         var content=$j(this).html();  
         ct1++;
         if(content.trim()=='&nbsp;N/A'){           
            ct2++;
         }
    }); 
    if (ct1 == ct2) {
    	allNA =true;
    }
    return allNA;
}
function removeColumn(columnPosition){
	//alert (columnPosition);
     $j('#sdrfData tr th:nth-child('+columnPosition+')').each(function(){
         $j(this).remove();
    });
    $j('#sdrfData tr td:nth-child('+columnPosition+')').each(function(){
         $j(this).remove();
    });   
}

function removeDuplicates(inputArray) {
    var i;
    var len = inputArray.length;
    var outputArray = [];
    var temp = {};

    for (i = 0; i < len; i++) {
        temp[inputArray[i]] = 0;
    }
    for (i in temp) {
        outputArray.push(parseInt(i));
    }
    return outputArray;
}
function displayColumns() {
	var allCols = "";
    $j('#sdrfData tr th').each(function(){
    	allCols = (allCols + "XX" + $j(this).html().substring(0,8)).replace(/<|>/,"");
    });    
    //alert(allCols);
    $j('#displayColumns').val(allCols);
}

$j(function(){
    var caArrayCompatible="true";
    
	if($j('input[type="checkbox"]').length>0){
		if($j('input[type="checkbox"]:checked').length==0)		
			$j('input[type="button"][value="Next"]').attr('disabled', 'disabled');	
            }
            else{
                //no chains so disable the next button.
                $j('input[type="button"][value="Next"]').attr('disabled', 'disabled');
            }
         if(caArrayCompatible&&$j('#sdrfData tr').length>0){
             //alert('compatible');
             //now search the table if it has any sample column which is N/A.
             var listOfColumnsIn= new Array();
             var listOfColumns;
{'fraction_non_alphanumeric': 0.17874027756596003, 'fraction_numerical': 0.005642824462406588, 'mean_word_length': 3.5103163686382395, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6206133', 'n_tokens_mistral': 2314, 'n_tokens_neox': 2222, 'n_words': 396}