+ if not matchkey in results[f[:-4]]:
+ results[f[:-4]][matchkey] = linecols + [1]
+ else:
+ results[f[:-4]][matchkey][ len(results[f[:-4]][matchkey]) - 1 ] = \
+ results[f[:-4]][matchkey][ len(results[f[:-4]][matchkey]) - 1 ] + 1
+
+ for imeancol in range(0,len(meancols)):
+ results[f[:-4]][matchkey][int(meancols[imeancol])-1] = \
+ float(results[f[:-4]][matchkey][int(meancols[imeancol])-1]) + \
+ float(linecols[int(meancols[imeancol])-1])
+
+for fileid in results:
+ print "\n[" + fileid + "]"
+
+ if writetofile:
+ outfile = open(outdir + "/" + fileid + "_meanstep.dat", "w+")
+
+ for matchkey in results[fileid]:
+ for imeancol in range(0,len(meancols)):
+ results[fileid][matchkey][int(meancols[imeancol])-1] = \
+ float(results[fileid][matchkey][int(meancols[imeancol])-1]) / \
+ results[fileid][matchkey][ len(results[f[:-4]][matchkey]) - 1 ]
+
+ for icol in range(0,len(results[fileid][matchkey])-1):
+ sys.stdout.write(str(results[fileid][matchkey][icol]))
+ if writetofile:
+ outfile.write(str(results[fileid][matchkey][icol]));
+
+ if icol != len(results[fileid][matchkey])-2:
+ sys.stdout.write("\t")
+ if writetofile:
+ outfile.write("\t")
+
+ print ""
+ if writetofile:
+ outfile.write("\n")