示例#1
0
    def test_main_index_bam(self, tmpdir, tasic2016_unprocessed, bam_filenames,
                            tasic2016_outrigger_output_bam):
        from outrigger.commandline import CommandLine

        output_folder = tmpdir.strpath

        gtf = os.path.join(tasic2016_unprocessed, 'gtf',
                           'gencode.vM10.annotation.subset.gtf')
        arguments = ['index', '--bam']
        arguments.extend(bam_filenames)
        arguments.extend(['--gtf', gtf, '--output', output_folder])
        # import pdb; pdb.set_trace()
        # assert False
        CommandLine(arguments)

        dir1 = os.path.join(output_folder, 'index')
        dir2 = os.path.join(tasic2016_outrigger_output_bam, 'index')
        ignore = [
            'psi',
            '.DS_Store',
            'validated',
            'splice_sites.csv',
            # Databases get stored in a weird random way... we're still
            # checking that the final gtfs are the same
            'gencode.vM10.annotation.subset.gtf.db'
        ]
        assert_directories_equal(dir1, dir2, ignore)
示例#2
0
    def test_main_psi_parallelized(self, tmpdir, tasic2016_unprocessed,
                                   tasic2016_outrigger_output, sj_filenames):
        from outrigger.commandline import CommandLine

        output_folder = tmpdir.strpath

        gtf = os.path.join(tasic2016_unprocessed, 'gtf',
                           'gencode.vM10.annotation.subset.gtf')
        arguments = ['index', '--sj-out-tab']
        arguments.extend(sj_filenames)
        arguments.extend(['--gtf', gtf, '--output', output_folder])
        CommandLine(arguments)

        args = ['psi', '--output', output_folder, '--n-jobs', '-1']
        CommandLine(args)

        dir1 = output_folder
        dir2 = tasic2016_outrigger_output
        assert_directories_equal(dir1, dir2, ignore=['.DS_Store'])
示例#3
0
    def test_main_version(self, capsys):
        from outrigger.commandline import CommandLine
        from outrigger import __version__

        with pytest.raises(SystemExit):
            CommandLine(['--version'])

        out, err = capsys.readouterr()

        # Argparse for Python2 sends the version info to stderr, but Python3
        # argparse sends the info to stdout so we concatenate here
        outerr = out + err
        assert 'outrigger' in outerr
        assert __version__ in outerr
示例#4
0
    def test_help(self, capsys):
        """
        User asks for help, should SystemExit and give helpful output
        """
        from outrigger.commandline import CommandLine

        with pytest.raises(SystemExit):
            CommandLine(['--help'])

        out, err = capsys.readouterr()
        assert 'outrigger' in out
        assert 'psi' in out
        assert 'validate' in out
        assert 'usage' in out
示例#5
0
    def test_main_psi_bam(self, tmpdir, tasic2016_outrigger_output_index,
                          tasic2016_outrigger_output_bam, bam_filenames):
        from outrigger.commandline import CommandLine

        output_folder = tmpdir.strpath

        args = [
            'psi', '--output', output_folder, '--n-jobs', '1', '--index',
            tasic2016_outrigger_output_index, '--bam'
        ]
        args.extend(bam_filenames)
        CommandLine(args)

        dir1 = output_folder
        dir2 = tasic2016_outrigger_output_bam
        assert_directories_equal(dir1, dir2, ignore=['.DS_Store', 'index'])
示例#6
0
    def test_no_arguments(self, capsys):
        """
        User passes no args, should fail with SystemExit
        """

        from outrigger.commandline import CommandLine

        CommandLine()

        text = '[-h] [--version] {index,validate,psi} ...'
        out, err = capsys.readouterr()

        # Argparse for Python2 sends the version info to stderr, but Python3
        # argparse sends the info to stdout so we concatenate here
        outerr = out + err
        assert 'usage' in outerr
        assert text in outerr
示例#7
0
    def test_main_validate(self, tmpdir, negative_control_folder,
                           negative_control_output):
        from outrigger.commandline import CommandLine

        args = [
            'validate', '--genome',
            '{folder}/chromsizes'.format(folder=negative_control_folder),
            '--fasta',
            '{folder}/genome.fasta'.format(folder=negative_control_folder),
            '--output', tmpdir.strpath, '--index',
            os.path.join(negative_control_output, 'index')
        ]
        CommandLine(args)

        dir1 = tmpdir.strpath
        dir2 = negative_control_output
        assert_directories_equal(dir1,
                                 dir2,
                                 ignore=['.DS_Store', 'junctions', 'gtf'])