コード例 #1
0
ファイル: similarity_cmp.py プロジェクト: ngannguyen/aimseqtk
def group_cmp(pair2count, g2s, ymin, ymax, outdir):
    groups = sorted(g2s.keys())
    if len(groups) < 2:
        return
    for i in xrange(0, len(groups) - 1):
        g1 = groups[i]
        names1 = g2s[g1]
        vec11 = pair_vec(names1, names1, pair2count, sep=',')
        vec11_ = remove_outliers(vec11, ymin, ymax)
        for j in xrange(i + 1, len(groups)):
            g2 = groups[j]
            names2 = g2s[g2]
            vec12 = pair_vec(names1, names2, pair2count, sep=',')
            vec22 = pair_vec(names2, names2, pair2count, sep=',')
            plotfile = os.path.join(outdir, "%s_%s" % (g1, g2))
            draw_group_pairwise_similarity(g1, g2, vec11, vec12,
                                         vec22, plotfile, ymin=ymin, ymax=ymax)
            tabfile = os.path.join(outdir, "%s_%s.txt" % (g1, g2))
            table_group_pairwise_similarity(g1, g2, vec11, vec12, vec22,
                                            tabfile, "ttest")
            # remove outliers:
            vec12_ = remove_outliers(vec12, ymin, ymax)
            vec22_ = remove_outliers(vec22, ymin, ymax)
            tabfile = os.path.join(outdir, "rmoutliers_%s_%s.txt" % (g1, g2))
            table_group_pairwise_similarity(g1, g2, vec11_, vec12_, vec22_,
                                            tabfile, "ttest")
コード例 #2
0
ファイル: similarity.py プロジェクト: ngannguyen/aimseqtk
 def run(self):
     vec11 = statcommon.pair_vec(self.names1, self.names1,
                                     self.pair2stat, self.attr)
     vec22 = statcommon.pair_vec(self.names2, self.names2,
                                     self.pair2stat, self.attr)
     vec12 = statcommon.pair_vec(self.names1, self.names2,
                                     self.pair2stat, self.attr)
     # draw boxplots
     plotfmt = self.opts.plotformat
     plotfile = "%s" % self.outbase
     simiplot.draw_group_pairwise_similarity(self.g1, self.g2, vec11,
                        vec12, vec22, plotfile, plotfmt, self.opts.dpi)
     # ttests 
     tabfile = "%s.txt" % self.outbase
     table_group_pairwise_similarity(self.g1, self.g2, vec11, vec12, vec22,
                                     tabfile)