Exemplo n.º 1
0
 def testGOVolcano(self):
     infile = testfile('go_tested.tab')
     run_viz('volcano', self.img, infile,
             textannot="id",
             fc_name="log2fc_s1_over_s2",
             fc_corr_p="corrected_p_s1_over_s2",
             gosplit=True)
Exemplo n.º 2
0
 def testPCA(self):
     infile = testfile('go_tested.tab')
     run_viz('pca',
             self.img,
             infile,
             sinfo=TTEST_SINFO,
             calculate_sep=False)
Exemplo n.º 3
0
 def testBasicTaxBar(self):
     infile = testfile('taxonomy_write_simple.tab')
     tabfile = testfile('taxonomy_plot_out.tab')
     run_viz('bar', self.img, infile, mode='t',
             nterms='2', meancol='samp1_mean',
             target_rank="genus", barcol="6",
             tabfile=tabfile)
     self.assertTrue(os.path.exists(tabfile))
     os.remove(tabfile)
     run_viz('bar', self.img, infile, mode='t',
             nterms='2', meancol='samp1_mean',
             target_rank="genus", barcol="6")
Exemplo n.º 4
0
    def testVolcano(self):
        infile = testfile('cli_mult_test_out.tab')
        run_viz('volcano', self.img, infile,
                textannot="id",
                fc_corr_p="corrected_p_s1_over_s2",
                fc_name="log2fc_s1_over_s2")

        # test tabfile
        tabfile = testfile('taxonomy_plot_out.tab')
        run_viz('volcano', self.img, infile,
                textannot="id",
                fc_name="log2fc_s1_over_s2",
                fc_corr_p="corrected_p_s1_over_s2",
                tabfile=tabfile)
        self.assertTrue(os.path.exists(tabfile))
        os.remove(tabfile)
Exemplo n.º 5
0
    def testFtDist(self):
        infile = testfile('ft_out.tab')
        run_viz('ft_dist', self.img, infile,
                meancol="s1_mean",
                whichway='t_dist',
                id="GO:0008150",
                target_rank="genus",
                nterms="all")

        # f dist
        run_viz('ft_dist', self.img, infile,
                meancol="s1_mean",
                whichway='f_dist',
                target_onto="bp",
                nterms="all", id=209)

        # test tabfile
        tabfile = testfile("tmp")
        run_viz('ft_dist', self.img, infile,
                meancol="s1_mean",
                whichway='t_dist',
                id="GO:0008150",
                target_rank="genus",
                nterms="all",
                tabfile=tabfile)
        self.assertTrue(os.path.exists(tabfile))
        os.remove(tabfile)
Exemplo n.º 6
0
    def testFuncBar(self):
        infile = testfile('eggnog_out.tab')
        tabfile = testfile('viz_f_filt.tab')
        # bp
        run_viz('bar', self.img, infile, mode='f',
                nterms='2', meancol='NS_mean',
                target_onto='bp', barcol='1', tabfile=tabfile)
        df = pd.read_csv(tabfile, sep='\t')
        namespace = df.namespace.unique()
        self.assertEqual(namespace, ['biological_process'])

        # cc
        run_viz('bar', self.img, infile, mode='f',
                nterms='2', meancol='NS_mean',
                target_onto='cc', barcol='1', tabfile=tabfile)
        df = pd.read_csv(tabfile, sep='\t')
        namespace = df.namespace.unique()
        self.assertEqual(namespace, ['cellular_component'])

        # mf
        run_viz('bar', self.img, infile, mode='f',
                nterms='2', meancol='NS_mean',
                target_onto='mf', barcol='1', tabfile=tabfile)
        df = pd.read_csv(tabfile, sep='\t')
        namespace = df.namespace.unique()
        self.assertEqual(namespace, ['molecular_function'])
Exemplo n.º 7
0
def cli():
    """
    Command line interface; main entry point to metaQuantome

    :return: exit code
    """
    # initialize logger
    logging.basicConfig(level=logging.INFO,
                        format='%(message)s',
                        stream=sys.stderr)
    args = parse_args_cli()
    if args.command == "db":
        db_download_handler(args.dbs, args.dir, args.update)
    elif args.command == "expand":
        expand(mode=args.mode,
               sinfo=args.samps,
               int_file=args.int_file,
               pep_colname_int=args.pep_colname_int,
               pep_colname_func=args.pep_colname_func,
               pep_colname_tax=args.pep_colname_tax,
               data_dir=args.data_dir,
               outfile=args.outfile,
               func_file=args.func_file,
               func_colname=args.func_colname,
               ontology=args.ontology,
               slim_down=args.slim_down,
               tax_file=args.tax_file,
               tax_colname=args.tax_colname,
               nopep=args.nopep,
               nopep_file=args.nopep_file,
               ft_tar_rank=args.ft_tar_rank)
    elif args.command == "filter":
        run_filter(expanded_file=args.expand_file,
                   sinfo=args.samps,
                   ontology=args.ontology,
                   mode=args.mode,
                   qthreshold=args.qthreshold,
                   min_child_non_leaf=args.min_children_non_leaf,
                   min_child_nsamp=args.min_child_nsamp,
                   min_peptides=args.min_peptides,
                   min_pep_nsamp=args.min_pep_nsamp,
                   outfile=args.outfile)
    elif args.command == "stat":
        stat(infile=args.file,
             sinfo=args.samps,
             paired=args.paired,
             parametric=args.parametric,
             ontology=args.ontology,
             mode=args.mode,
             outfile=args.outfile)
    elif args.command == "viz":
        run_viz(plottype=args.plottype,
                img=args.img,
                infile=args.infile,
                mode=args.mode,
                meancol=args.meancol,
                nterms=args.nterms,
                strip=args.strip,
                target_rank=args.target_rank,
                barcol=args.barcol,
                textannot=args.textannot,
                calculate_sep=args.calculate_sep,
                fc_name=args.fc_name,
                flip_fc=args.flip_fc,
                gosplit=args.gosplit,
                sinfo=args.samps,
                filter_to_sig=args.filter_to_sig,
                alpha=args.alpha,
                whichway=args.whichway,
                name=args.name,
                id=args.id,
                target_onto=args.target_onto,
                width=args.width,
                height=args.height,
                tabfile=args.tabfile)
    else:
        ValueError(
            'incorrect mode. please provide one of "db", "expand", "filter", "stat", or "viz".'
        )
    sys.exit(0)
Exemplo n.º 8
0
 def testPCABig(self):
     infile = testfile('tax_filt_out.tab')
     sampfile = testfile('rudney_samples.tab')
     run_viz('pca', self.img, infile,
             sinfo=sampfile,
             calculate_sep=True)
Exemplo n.º 9
0
 def testHeatmap(self):
     infile = testfile('go_expanded_ttest.tab')
     run_viz('heatmap', self.img, infile,
             sinfo=TTEST_SINFO)