def test_resampling_adaptive(self): args = [ ctrl_data_txt, exp_data_txt, annotation, output, "-s", "1000", "-a" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output))
def test_resampling_ZINFNB(self): args = [ ctrl_rep1, ctrl_rep2, small_annotation, output, "-s", "1000", "-n", "zinfnb" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output))
def test_resampling_multistrain(self): args = [ctrl_data_txt, exp_data_txt, ','.join([small_annotation, small_annotation]), output, "-h"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) self.assertTrue( os.path.isdir(hist_path), "histpath expected: %s" % (hist_path))
def test_resampling_histogram(self): args = [ctrl_data_txt, exp_data_txt, small_annotation, output, "-s", "1000", "-h"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) self.assertTrue( os.path.isdir(hist_path), "histpath expected: %s" % (hist_path))
def test_resampling_TotReads(self): args = [ctrl_rep1, ctrl_rep2, small_annotation, output, "-s", "1000", "-n", "totreads"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) pvals, qvals = significant_pvals_qvals(output) self.assertLessEqual(len(pvals), 5) self.assertLessEqual(len(qvals), 1)
def test_resampling_TTR(self): args = [ ctrl_rep1, ctrl_rep2, annotation, output, "-s", "1000", "-n", "TTR" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) hits = count_hits(output) self.assertLessEqual(hits, 10)
def test_resampling_multistrain(self): args = [ ctrl_data_txt, exp_data_txt, ','.join([small_annotation, small_annotation]), output, "-h" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) self.assertTrue(os.path.isdir(hist_path), "histpath expected: %s" % (hist_path))
def test_resampling_histogram(self): args = [ ctrl_data_txt, exp_data_txt, small_annotation, output, "-s", "1000", "-h" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) self.assertTrue(os.path.isdir(hist_path), "histpath expected: %s" % (hist_path))
def test_resampling_NZMean(self): args = [ ctrl_rep1, ctrl_rep2, small_annotation, output, "-s", "1000", "-n", "nzmean" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) pvals, qvals = significant_pvals_qvals(output) self.assertLessEqual(len(pvals), 5) self.assertLessEqual(len(qvals), 1)
def test_resampling(self): args = [ctrl_data_txt, exp_data_txt, small_annotation, output, "-l"] G = ResamplingMethod.fromargs(args) G.Run() (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 2, "sig_qvals expected in range: %s, actual: %d" % ("[33, 37]", len(sig_qvals)))
def test_resampling_adaptive(self): args = [ctrl_data_txt, exp_data_txt, small_annotation, output, "-a"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 1, "sig_qvals expected in range: %s, actual: %d" % ("[34, 36]", len(sig_qvals)))
def test_resampling(self): args = [ctrl_data_txt, exp_data_txt, small_annotation, output, "-l"] G = ResamplingMethod.fromargs(args) G.Run() (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 2, "sig_qvals expected in range: %s, actual: %d" % ("[33, 37]", len(sig_qvals)))
def test_resampling_combined_wig(self): # The conditions in the args should be matched case-insensitively. args = ["-c", combined_wig, samples_metadata, "Glycerol", "cholesterol", small_annotation, output, "-a"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) print(len(sig_pvals)) print(len(sig_qvals)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 1, "sig_qvals expected in range: %s, actual: %d" % ("[34, 36]", len(sig_qvals)))
def test_resampling_adaptive(self): args = [ ctrl_data_txt, exp_data_txt, small_annotation, output, "-a", "--ctrl_lib", "AA", "--exp_lib", "AAA" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 2, "sig_qvals expected in range: %s, actual: %d" % ("[34, 36]", len(sig_qvals)))
def test_resampling_combined_wig(self): # The conditions in the args should be matched case-insensitively. args = [ "-c", combined_wig, samples_metadata, "Glycerol", "cholesterol", small_annotation, output, "-a" ] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output)) (sig_pvals, sig_qvals) = (significant_pvals_qvals(output, pcol=-2, qcol=-1)) print(len(sig_pvals)) print(len(sig_qvals)) self.assertLessEqual( abs(len(sig_pvals) - 37), 2, "sig_pvals expected in range: %s, actual: %d" % ("[35, 39]", len(sig_qvals))) self.assertLessEqual( abs(len(sig_qvals) - 35), 1, "sig_qvals expected in range: %s, actual: %d" % ("[34, 36]", len(sig_qvals)))
def test_resampling_ZINFNB(self): args = [ctrl_rep1, ctrl_rep2, small_annotation, output, "-s", "1000", "-n", "zinfnb"] G = ResamplingMethod.fromargs(args) G.Run() self.assertTrue(os.path.exists(output))