cf97b091f2c45ee59d6b242095ba02bec724c37f
ceisenhart
  Fri May 12 12:58:38 2017 -0700
Fixing an error with column order and a syntax error with a print statement, refs #19155

diff --git src/utils/expMatrixToBarchartBed/expMatrixToBarchartBed src/utils/expMatrixToBarchartBed/expMatrixToBarchartBed
index 53e18f3..7ef4579 100755
--- src/utils/expMatrixToBarchartBed/expMatrixToBarchartBed
+++ src/utils/expMatrixToBarchartBed/expMatrixToBarchartBed
@@ -228,31 +228,31 @@
     the columns to the groups.  Go through the matrix line by line and get the median or average for each 
     group. Print this to an intermediate file, then use the unix 'join' command to link with
     the coordinates file via the first matrix column. This creates a file with many of the bed fields
     just in the wrong order.  Go through this file to re arrange the columns, check for and remove entries 
     where chromsomes names include "_" and chr start > chr end.  Finally run Max's bedJoinTabOffset to 
     index the matrix adding the dataOffset and dataLen columns and creating a bed 6+5 file.   
     """
 
     # Create a dictionary that maps the sample names to their group.
     sampleToGroup = dict()
     count = 0 
     for item in options.sampleFile:
         count +=1 
         splitLine = item.strip("\n").split()
         if (len(splitLine) is not 2):
-            print ("There was an error reading the sample file at line " + count)
+            print ("There was an error reading the sample file at line " + str(count))
             exit(1)
         sampleToGroup.setdefault(splitLine[0], splitLine[1])
 
     # Use an intermediate file to hold the average values for each group. 
     bedLikeFile = tempfile.NamedTemporaryFile( mode = "w+", bufsize = 1)
     # Keep a list of TPM scores greater than 0. This will be used later
     # to assign bed scores. 
     validTpms = []
 
     # Go through the matrix and condense it into a bed like file. Populate
     # the validTpms array and the bedInfo string.  
     bedInfo = condenseMatrixIntoBedCols(options.matrixFile, options.groupOrderFile, sampleToGroup, \
                     validTpms, bedLikeFile, options.useMean)
     # Find the number which divides the list of non 0 TPM scores into ten blocks. 
     tpmMedian = sorted(validTpms)
@@ -296,32 +296,32 @@
         if ("_" in splitLine[0]): 
             sys.stderr.write("This transcript " + splitLine[0] + " was dropped for having a '_' in the name.\n") 
             continue # Ignore alt sequences.  
         # Drop sequences where start is greater than end. 
         if (float(splitLine[2]) > float(splitLine[3])):
             sys.stderr.write("This transcript " + splitLine[0] + " was dropped since chr end, " + \
                     splitLine[3] + ", is smaller than chr start, " + splitLine[2] + "\n.") 
             continue
         chrom = splitLine[1]
         chrStart = splitLine[2]
         chrEnd = splitLine[3]
         name = splitLine[0]
         score = str(determineScore(tpmCutoffs, float(splitLine[7])))
         strand = splitLine[5]
         name2 = splitLine[6]
-        expCount = str(splitLine[7])
-        expScores = splitLine[8]
+        expCount = str(splitLine[8])
+        expScores = splitLine[9]
         
         bedLine = (chrom + "\t" + chrStart + "\t" + chrEnd + "\t" + name + "\t" \
                         + score + "\t" + strand + "\t" + name2 + "\t" + expCount + "\t" \
                         + expScores + "\n")
         bedFile.write(bedLine) 
 
     # Run Max's indexing script
     indexedBedFile = tempfile.NamedTemporaryFile(mode="w+", bufsize=1)
     cmd = "bedJoinTabOffset " + options.matrixFile.name + " " + bedFile.name + " " + indexedBedFile.name
     os.system(cmd)
 
     # Prepend the bed info to the start of the file.  
     cmd = "echo '" + bedInfo + "' > " + options.outputFile.name
     os.system(cmd)
     cmd = "cat " + indexedBedFile.name + " >> " + options.outputFile.name