comparison ttest/stats.py @ 8:f55d3b781adb

check file input ignore bad lines`
author jingchunzhu@gmail.com
date Thu, 30 Jul 2015 21:42:15 -0700
parents 14c406f8fca6
children fd8529cd1564
comparison
equal deleted inserted replaced
7:14c406f8fca6 8:f55d3b781adb
26 args.a, args.b) 26 args.a, args.b)
27 outfile = open(args.outfile, "w") 27 outfile = open(args.outfile, "w")
28 outfile.write("%s\tStatistic\tpValue\tMedian1\tMedian2\tDelta\n" % (headerTokens[0])) 28 outfile.write("%s\tStatistic\tpValue\tMedian1\tMedian2\tDelta\n" % (headerTokens[0]))
29 for row in genomicFp: 29 for row in genomicFp:
30 tokens = row.rstrip().split("\t") 30 tokens = row.rstrip().split("\t")
31 if len(tokens)!= len(headerTokens):
32 continue
31 symbol = tokens[0] 33 symbol = tokens[0]
32 groupATokens = [tokens[ii] for ii in columnsGroupA] 34 groupATokens = [tokens[ii] for ii in columnsGroupA]
33 groupBTokens = [tokens[ii] for ii in columnsGroupB] 35 groupBTokens = [tokens[ii] for ii in columnsGroupB]
34 groupAValues = [float(xx) for xx in groupATokens if xx != "NA"] 36 groupAValues = [float(xx) for xx in groupATokens if xx != "NA"]
35 groupBValues = [float(xx) for xx in groupBTokens if xx != "NA"] 37 groupBValues = [float(xx) for xx in groupBTokens if xx != "NA"]