def test_homGeneMapping_without_hints(self):
        '''
        test without hints
        gtffilenames_without_hints.tbl - is gtffilenames.tbl with hints removed
        .../bin/homGeneMapping --noDupes --gtfs=.../gtffilenames_without_hints.tbl
            --halfile=aln.hal --tmpdir=.../tmp --outdir=...//outdir
            --printHomologs=.../homologs.txt > .../homGeneMapping.out)
        '''
        os.chdir(os.path.join(default_wd, testdir))
        refdir = os.path.join(referencedir, 'without_hints')
        outputdir = os.path.join(resultdir, 'without_hints')
        aug_path.mkdir_if_not_exists(refdir)
        aug_path.mkdir_if_not_exists(outputdir)
        resfile = os.path.join(outputdir, 'homGeneMapping.out')

        args = '--noDupes --gtfs=' + gtffilenames_without_hints + ' --halfile=aln.hal \
            --tmpdir=' + outputdir + '/tmp --outdir=' + outputdir + '/outdir \
            --printHomologs=' + outputdir + '/homologs.txt'

        aug_process.execute(self, hgmbin + ' ' + args, resfile)

        # compare results
        if TestHomGeneMapping.opt_compare:
            aug_assertions.assertEqualDirectory(self, refdir, outputdir,
                                                TestHomGeneMapping.opt_html,
                                                htmldir)
Exemple #2
0
    def test_homGeneMapping_with_sql_hints(self):
        '''
        test with hints provided by SQLite databaseX
        .../bin/homGeneMapping --noDupes --gtfs=.../gtffilenames_without_hints.tbl
            --dbaccess=.../homGeneMapping_hints.db --halfile=aln.hal
            --tmpdir=.../tmp --outdir=.../outdir
            --printHomologs=.../homologs.txt > .../homGeneMapping.out
        '''
        os.chdir(os.path.join(default_wd, testdir))
        refdir = os.path.join(referencedir, 'with_hints')
        outputdir = os.path.join(resultdir, 'with_sql_hints')
        aug_path.mkdir_if_not_exists(refdir)
        aug_path.mkdir_if_not_exists(outputdir)
        resfile = os.path.join(outputdir, 'homGeneMapping.out')

        args = f'--noDupes --gtfs={gtffilenames_without_hints} \
            --dbaccess={sqlitedb} --halfile=aln.hal \
            --tmpdir={outputdir}/tmp --outdir={outputdir}/outdir \
            --printHomologs={outputdir}/homologs.txt'

        aug_process.execute(self, f'{hgmbin} {args}', resfile)

        # compare results
        if TestHomGeneMapping.opt_compare:
            aug_assertions.assertEqualDirectory(self, refdir, outputdir,
                                                TestHomGeneMapping.opt_html,
                                                htmldir)
Exemple #3
0
    def test_bam2hints_pipes(self):
        os.chdir(default_wd)
        testfile = os.path.join(tmpdir, testfilename)
        reffile = os.path.join(referencedir, reffilename)
        resfile = os.path.join(resultdir, reffilename)

        aug_process.execute(self, f'cat {testfile} | {bam2hintsbin}', resfile)

        # compare results
        if TestBam2Hints.opt_compare:
            aug_assertions.assertEqualFiles(self, reffile, resfile,
                                            TestBam2Hints.opt_html, htmldir)
            os.remove(resfile)
Exemple #4
0
    def test_bam2wig(self):
        os.chdir(default_wd)
        testfile = os.path.join(tmpdir, exampletestfile)
        reffile = os.path.join(referencedir, 'test.s.wig')
        resfile = os.path.join(resultdir, 'test.s.wig')

        aug_process.execute(
            self, f'{bam2wigbin} {testfile} | grep -v track',  resfile)

        # compare results
        if TestBam2Wig.opt_compare:
            aug_assertions.assertEqualFiles(
                self, reffile, resfile, TestBam2Wig.opt_html, htmldir)
            os.remove(resfile)
Exemple #5
0
    def setUpClass(cls):
        os.chdir(default_wd)
        clean(force_tmp_dir=False, force_html_dir=True, force_result_dir=True)
        aug_path.mkdir_if_not_exists(resultdir)
        aug_path.mkdir_if_not_exists(tmpdir)

        inputfile = os.path.join(exampledir, exampletestfile)
        testfile = os.path.join(tmpdir, exampletestfile)
        shutil.copyfile(inputfile, testfile)

        os.chdir(tmpdir)
        aug_process.execute(None, 'samtools index ' + exampletestfile)

        if os.path.isfile(os.path.join(tmpdir, f'{exampletestfile}.bai')):
            assert False, 'Test file not indexed.'
    def test_bam2wig_region(self):
        os.chdir(default_wd)
        testfile = os.path.join(tmpdir, exampletestfile)
        reffile = os.path.join(referencedir, 'test.s.chr3L.wig')
        resfile = os.path.join(resultdir, 'test.s.chr3L.wig')

        aug_process.execute(self,
                            bam2wigbin + ' -t "my_specified_track" -r chr3L ' + testfile + ' | grep -v track',
                            resfile)

        # compare results
        if TestBam2Wig.opt_compare:
            aug_assertions.assertEqualFiles(
                self, reffile, resfile, TestBam2Wig.opt_html, htmldir)
            os.remove(resfile)
Exemple #7
0
 def test_case(self, testfilename, refsamfilename, filterbamoptions):
     os.chdir(default_wd)
     testfile = os.path.join(exampledir, testfilename)
     refsamfile = os.path.join(referencedir, refsamfilename)
     resbamfile = os.path.join(resultdir, refsamfilename + '.bam')
     ressamfile = os.path.join(resultdir, refsamfilename)
     
     aug_process.execute(self, binfilterbam + ' --in ' + testfile + ' --out ' + resbamfile + ' ' + filterbamoptions)
     
     if "--no-PG" in aug_process.execute(None, 'samtools view -?'):
         aug_process.execute(None, 'samtools view -h --no-PG ' + resbamfile + ' -o ' + ressamfile)
     else: 
         aug_process.execute(None, 'samtools view -h ' + resbamfile + ' -o ' + ressamfile)
     
     self.test_compare(refsamfile, resbamfile, ressamfile)
    def setUpClass(cls):
        os.chdir(default_wd)
        clean(force_tmp_dir=False, force_html_dir=True, force_result_dir=True)
        aug_path.mkdir_if_not_exists(resultdir)
        aug_path.mkdir_if_not_exists(tmpdir)

        # create file with gtf filenames without hint file references
        aug_process.execute(
            None,
            'cat ' + gtffilenames_with_hints + ' | sed "s/gtf\\t.*/gtf/g"',
            gtffilenames_without_hints)

        # create sqllite database
        out_load2sqlitedb = os.path.join(tmpdir, 'out_load2sqlitedb.txt')
        if os.path.exists(sqlitedb):
            os.remove(sqlitedb)

        aug_process.execute(
            None, load2sqlbin + ' --species=hg19 --dbaccess=' + sqlitedb +
            ' ' + examplesdir + '/cgp/human.fa', out_load2sqlitedb)
        aug_process.execute(
            None, load2sqlbin + ' --species=mm9 --dbaccess=' + sqlitedb + ' ' +
            examplesdir + '/cgp/mouse.fa', out_load2sqlitedb)
        aug_process.execute(
            None, load2sqlbin + ' --noIdx --species=hg19 --dbaccess=' +
            sqlitedb + ' ' + testdir + '/gtfs/human.hints.gff',
            out_load2sqlitedb)
        aug_process.execute(
            None, load2sqlbin + ' --noIdx --species=mm9 --dbaccess=' +
            sqlitedb + ' ' + testdir + '/gtfs/mouse.hints.gff',
            out_load2sqlitedb)
        aug_process.execute(None,
                            load2sqlbin + ' --makeIdx --dbaccess=' + sqlitedb,
                            out_load2sqlitedb)