Program: 56769
Project: 56769
Buggy source:
private DataSetDescription setUpClusteredMatrixData(EDataSetType type,IDSpecification rowIDSpecification,IDSpecification columnIDSpecification,Pair<TCGAFileInfo,Boolean> pair){
  if (pair == null || pair.getFirst() == null)   return null;
  TCGAFileInfo fileInfo=pair.getFirst();
  final File matrixFile=fileInfo.getFile();
  final boolean loadFullGenes=pair.getSecond();
  MetaDataElement metaData=new MetaDataElement();
  DataSetDescription dataSet=new DataSetDescription(ECreateDefaultProperties.NUMERICAL);
  dataSet.setDataSetName(dataSetName);
  dataSet.setColor(dataSetType.getColor());
  dataSet.setDataSourcePath(matrixFile.getPath());
  dataSet.setMetaData(metaData);
  MetaDataElement dataset=new MetaDataElement("String_Node_Str");
  metaData.addElement(dataset);
  addDataSourceMetaData(dataset,fileInfo);
  dataset.addAttribute("String_Node_Str",new Boolean(loadFullGenes).toString());
  if (!loadFullGenes) {
    dataSet.setNumberOfHeaderLines(3);
    dataSet.getDataDescription().getNumericalProperties().setDataCenter(0d);
  }
 else {
    dataSet.setNumberOfHeaderLines(2);
    dataSet.setRowOfColumnIDs(0);
  }
  ParsingRule parsingRule=new ParsingRule();
  parsingRule.setFromColumn(2);
  parsingRule.setParseUntilEnd(true);
  parsingRule.setColumnDescripton(new ColumnDescription());
  dataSet.addParsingRule(parsingRule);
  dataSet.setTransposeMatrix(true);
  dataSet.setRowIDSpecification(rowIDSpecification);
  dataSet.setColumnIDSpecification(columnIDSpecification);
  MetaDataElement columnGroupings=new MetaDataElement("String_Node_Str" + columnIDSpecification.getIdCategory() + "String_Node_Str");
  TCGAFileInfo cnmfGroupingFile=fileFinder.findCNMFGroupingFile(type);
  if (cnmfGroupingFile != null) {
    GroupingParseSpecification grouping=new GroupingParseSpecification(cnmfGroupingFile.getFile().getPath());
    grouping.setContainsColumnIDs(false);
    grouping.setRowIDSpecification(columnIDSpecification);
    grouping.setGroupingName("String_Node_Str");
    dataSet.addColumnGroupingSpecification(grouping);
    MetaDataElement cnmfClustering=new MetaDataElement("String_Node_Str");
    addDataSourceMetaData(cnmfClustering,cnmfGroupingFile);
    columnGroupings.addElement(cnmfClustering);
  }
 else {
    System.out.println("String_Node_Str");
  }
  TCGAFileInfo hierarchicalGroupingFile=fileFinder.findHiearchicalGrouping(type);
  if (hierarchicalGroupingFile != null) {
    GroupingParseSpecification grouping=new GroupingParseSpecification(hierarchicalGroupingFile.getFile().getPath());
    grouping.setContainsColumnIDs(false);
    grouping.setRowIDSpecification(columnIDSpecification);
    grouping.setGroupingName("String_Node_Str");
    dataSet.addColumnGroupingSpecification(grouping);
    MetaDataElement hierarchicalClustering=new MetaDataElement("String_Node_Str");
    addDataSourceMetaData(hierarchicalClustering,hierarchicalGroupingFile);
    columnGroupings.addElement(hierarchicalClustering);
  }
 else {
    System.out.println("String_Node_Str");
  }
  if (!columnGroupings.getElements().isEmpty()) {
    metaData.addElement(columnGroupings);
  }
  DataProcessingDescription dataProcessingDescription=new DataProcessingDescription();
  dataSet.setDataProcessingDescription(dataProcessingDescription);
  MetaDataElement rowGroupings=new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory() + "String_Node_Str");
  ClusterConfiguration clusterConfiguration=new ClusterConfiguration();
  clusterConfiguration.setDistanceMeasure(EDistanceMeasure.EUCLIDEAN_DISTANCE);
switch (settings.getCluster()) {
case NONE:
    break;
case AFFINITY:
  AffinityClusterConfiguration affinityAlgo=new AffinityClusterConfiguration();
Integer clusterFactor=9;
affinityAlgo.setClusterFactor(clusterFactor);
affinityAlgo.setCacheVectors(true);
clusterConfiguration.setClusterAlgorithmConfiguration(affinityAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement affinityCluster=new MetaDataElement("String_Node_Str");
affinityCluster.addAttribute("String_Node_Str",clusterFactor.toString());
rowGroupings.addElement(affinityCluster);
break;
case KMEANS:
KMeansClusterConfiguration kMeansAlgo=new KMeansClusterConfiguration();
Integer numClusters=5;
kMeansAlgo.setNumberOfClusters(numClusters);
kMeansAlgo.setCacheVectors(true);
clusterConfiguration.setClusterAlgorithmConfiguration(kMeansAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement kmeansCluster=new MetaDataElement("String_Node_Str");
kmeansCluster.addAttribute("String_Node_Str",numClusters.toString());
rowGroupings.addElement(kmeansCluster);
break;
case TREE:
TreeClusterConfiguration treeAlgo=new TreeClusterConfiguration();
ETreeClustererAlgo algo=ETreeClustererAlgo.AVERAGE_LINKAGE;
treeAlgo.setTreeClustererAlgo(algo);
clusterConfiguration.setClusterAlgorithmConfiguration(treeAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement treeCluster=new MetaDataElement("String_Node_Str");
treeCluster.addAttribute("String_Node_Str",algo.getName());
rowGroupings.addElement(treeCluster);
break;
default :
log.log(Level.ALL,"String_Node_Str" + settings.getCluster());
break;
}
if (!rowGroupings.getElements().isEmpty()) {
metaData.addElement(rowGroupings);
}
if (loadFullGenes) {
NumericalProperties numProp=dataSet.getDataDescription().getNumericalProperties();
numProp.setzScoreNormalization(NumericalProperties.ZSCORE_ROWS);
Float stdDevFactor=4f;
numProp.setClipToStdDevFactor(stdDevFactor);
Integer numRowsInSample=1500;
dataProcessingDescription.setNrRowsInSample(numRowsInSample);
MetaDataElement processing=new MetaDataElement("String_Node_Str");
processing.addElement(new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory()));
processing.addElement(new MetaDataElement("String_Node_Str" + stdDevFactor.toString() + "String_Node_Str"));
processing.addElement(new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory() + "String_Node_Str"+ numRowsInSample.toString()+ "String_Node_Str"));
metaData.addElement(processing);
dataProcessingDescription.setNrRowsInSample(1500);
numProp.setImputeDescription(new KNNImputeDescription());
processing.addElement(new MetaDataElement("String_Node_Str"));
}
return dataSet;
}

Fixed version (ground truth):
private DataSetDescription setUpClusteredMatrixData(EDataSetType type,IDSpecification rowIDSpecification,IDSpecification columnIDSpecification,Pair<TCGAFileInfo,Boolean> pair){
  if (pair == null || pair.getFirst() == null)   return null;
  TCGAFileInfo fileInfo=pair.getFirst();
  final File matrixFile=fileInfo.getFile();
  final boolean loadFullGenes=pair.getSecond();
  MetaDataElement metaData=new MetaDataElement();
  DataSetDescription dataSet=new DataSetDescription(ECreateDefaultProperties.NUMERICAL);
  dataSet.setDataSetName(dataSetName);
  dataSet.setColor(dataSetType.getColor());
  dataSet.setDataSourcePath(matrixFile.getPath());
  dataSet.setMetaData(metaData);
  MetaDataElement dataset=new MetaDataElement("String_Node_Str");
  metaData.addElement(dataset);
  addDataSourceMetaData(dataset,fileInfo);
  dataset.addAttribute("String_Node_Str",new Boolean(loadFullGenes).toString());
  ParsingRule parsingRule=new ParsingRule();
  parsingRule.setParseUntilEnd(true);
  parsingRule.setColumnDescripton(new ColumnDescription());
  if (!loadFullGenes) {
    parsingRule.setFromColumn(2);
    dataSet.setNumberOfHeaderLines(3);
    dataSet.getDataDescription().getNumericalProperties().setDataCenter(0d);
  }
 else {
    parsingRule.setFromColumn(1);
    dataSet.setNumberOfHeaderLines(1);
    dataSet.setRowOfColumnIDs(0);
  }
  dataSet.addParsingRule(parsingRule);
  dataSet.setTransposeMatrix(true);
  dataSet.setRowIDSpecification(rowIDSpecification);
  dataSet.setColumnIDSpecification(columnIDSpecification);
  MetaDataElement columnGroupings=new MetaDataElement("String_Node_Str" + columnIDSpecification.getIdCategory() + "String_Node_Str");
  TCGAFileInfo cnmfGroupingFile=fileFinder.findCNMFGroupingFile(type);
  if (cnmfGroupingFile != null) {
    GroupingParseSpecification grouping=new GroupingParseSpecification(cnmfGroupingFile.getFile().getPath());
    grouping.setContainsColumnIDs(false);
    grouping.setRowIDSpecification(columnIDSpecification);
    grouping.setGroupingName("String_Node_Str");
    dataSet.addColumnGroupingSpecification(grouping);
    MetaDataElement cnmfClustering=new MetaDataElement("String_Node_Str");
    addDataSourceMetaData(cnmfClustering,cnmfGroupingFile);
    columnGroupings.addElement(cnmfClustering);
  }
 else {
    System.out.println("String_Node_Str");
  }
  TCGAFileInfo hierarchicalGroupingFile=fileFinder.findHiearchicalGrouping(type);
  if (hierarchicalGroupingFile != null) {
    GroupingParseSpecification grouping=new GroupingParseSpecification(hierarchicalGroupingFile.getFile().getPath());
    grouping.setContainsColumnIDs(false);
    grouping.setRowIDSpecification(columnIDSpecification);
    grouping.setGroupingName("String_Node_Str");
    dataSet.addColumnGroupingSpecification(grouping);
    MetaDataElement hierarchicalClustering=new MetaDataElement("String_Node_Str");
    addDataSourceMetaData(hierarchicalClustering,hierarchicalGroupingFile);
    columnGroupings.addElement(hierarchicalClustering);
  }
 else {
    System.out.println("String_Node_Str");
  }
  if (!columnGroupings.getElements().isEmpty()) {
    metaData.addElement(columnGroupings);
  }
  DataProcessingDescription dataProcessingDescription=new DataProcessingDescription();
  dataSet.setDataProcessingDescription(dataProcessingDescription);
  MetaDataElement rowGroupings=new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory() + "String_Node_Str");
  ClusterConfiguration clusterConfiguration=new ClusterConfiguration();
  clusterConfiguration.setDistanceMeasure(EDistanceMeasure.EUCLIDEAN_DISTANCE);
switch (settings.getCluster()) {
case NONE:
    break;
case AFFINITY:
  AffinityClusterConfiguration affinityAlgo=new AffinityClusterConfiguration();
Integer clusterFactor=9;
affinityAlgo.setClusterFactor(clusterFactor);
affinityAlgo.setCacheVectors(true);
clusterConfiguration.setClusterAlgorithmConfiguration(affinityAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement affinityCluster=new MetaDataElement("String_Node_Str");
affinityCluster.addAttribute("String_Node_Str",clusterFactor.toString());
rowGroupings.addElement(affinityCluster);
break;
case KMEANS:
KMeansClusterConfiguration kMeansAlgo=new KMeansClusterConfiguration();
Integer numClusters=5;
kMeansAlgo.setNumberOfClusters(numClusters);
kMeansAlgo.setCacheVectors(true);
clusterConfiguration.setClusterAlgorithmConfiguration(kMeansAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement kmeansCluster=new MetaDataElement("String_Node_Str");
kmeansCluster.addAttribute("String_Node_Str",numClusters.toString());
rowGroupings.addElement(kmeansCluster);
break;
case TREE:
TreeClusterConfiguration treeAlgo=new TreeClusterConfiguration();
ETreeClustererAlgo algo=ETreeClustererAlgo.AVERAGE_LINKAGE;
treeAlgo.setTreeClustererAlgo(algo);
clusterConfiguration.setClusterAlgorithmConfiguration(treeAlgo);
dataProcessingDescription.addRowClusterConfiguration(clusterConfiguration);
MetaDataElement treeCluster=new MetaDataElement("String_Node_Str");
treeCluster.addAttribute("String_Node_Str",algo.getName());
rowGroupings.addElement(treeCluster);
break;
default :
log.log(Level.ALL,"String_Node_Str" + settings.getCluster());
break;
}
if (!rowGroupings.getElements().isEmpty()) {
metaData.addElement(rowGroupings);
}
if (loadFullGenes) {
NumericalProperties numProp=dataSet.getDataDescription().getNumericalProperties();
numProp.setzScoreNormalization(NumericalProperties.ZSCORE_ROWS);
Float stdDevFactor=4f;
numProp.setClipToStdDevFactor(stdDevFactor);
Integer numRowsInSample=1500;
dataProcessingDescription.setNrRowsInSample(numRowsInSample);
MetaDataElement processing=new MetaDataElement("String_Node_Str");
processing.addElement(new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory()));
processing.addElement(new MetaDataElement("String_Node_Str" + stdDevFactor.toString() + "String_Node_Str"));
processing.addElement(new MetaDataElement("String_Node_Str" + rowIDSpecification.getIdCategory() + "String_Node_Str"+ numRowsInSample.toString()+ "String_Node_Str"));
metaData.addElement(processing);
dataProcessingDescription.setNrRowsInSample(1500);
numProp.setImputeDescription(new KNNImputeDescription());
processing.addElement(new MetaDataElement("String_Node_Str"));
}
return dataSet;
}