482d460b09a00806e44c9df3005fad97ce173ec1 kent Tue Jan 12 11:13:48 2021 -0800 Fixing an off by one bug Jonathan spotted during code review. diff --git src/utils/clusterMatrixToBarChartBed/clusterMatrixToBarChartBed.c src/utils/clusterMatrixToBarChartBed/clusterMatrixToBarChartBed.c index 20cfd80..c82d45a 100644 --- src/utils/clusterMatrixToBarChartBed/clusterMatrixToBarChartBed.c +++ src/utils/clusterMatrixToBarChartBed/clusterMatrixToBarChartBed.c @@ -81,31 +81,31 @@ int bedRowSize = 0; struct hash *geneHash = hashTsvBy(geneBed, 3, &bedRowSize); verbose(2, "%d columns about %d genes in %s\n", bedRowSize, geneHash->elCount, geneBed); /* Deal with external gene hash */ struct hash *nameToName2 = NULL; if (clName2 != NULL) { int colCount = 0; nameToName2 = hashTsvBy(clName2, 0, &colCount); if (colCount != 2) errAbort("Expecting %s to be a two column tab separated file", clName2); } /* Keep track of how many fields gene bed has to have and locate name2 */ -int geneBedMinSize = 6; +int geneBedMinSize = 7; int name2Ix = bedRowSize - 1; // Last field if it is in bed if (clName2 != NULL) geneBedMinSize -= 1; if (bedRowSize < geneBedMinSize) { if (clName2 == NULL) errAbort("%s needs to have at least 6 standard BED fields and a name2 field\n", geneBed); else errAbort("%s needs to have at least 6 standard BED fields\n", geneBed); } /* Load up the sample clustering */ struct hash *sampleHash = NULL, *clusterHash = NULL; hashSamplesAndClusters(sampleClusters, &sampleHash, &clusterHash);