def write_size_distribution_dataframe(readDict, size_distribution_file, pol=["both"] ):
  '''refactored on 7-9-2014'''
  with open(size_distribution_file, 'w') as size_distrib:
    print >>size_distrib, "gene\tpolarity\tsize\tcount\tsample"
    for sample in readDict.keys():
      if args.gff:
        dict=readDict[sample]
      else:
        dict=readDict[sample].instanceDict
      for gene in dict.keys():
        histogram = dict[gene].size_histogram()
        for polarity in pol:
          for size, count in histogram[polarity].iteritems():
            print >>size_distrib, "%s\t%s\t%s\t%s\t%s" % (gene, polarity, size, count, sample)
dataset/ETHPy150Open ARTbio/tools-artbio/tools/msp_sr_size_histograms/size_histogram.py/write_size_distribution_dataframe/original