コード例 #1
0
ファイル: test_end_to_end.py プロジェクト: ratschlab/spladder
def test_end_to_end_merge(test_id, case, tmpdir):
    data_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'data')
    result_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'results_merged_{}'.format(case))

    out_dir = str(tmpdir)

    my_args = ['spladder',
               'build',
               '-a', os.path.join(data_dir, 'annotation_{}.gtf'.format(case)),
               '-o', out_dir,
               '-b', ','.join([os.path.join(data_dir, 'align', '{}_{}.bam'.format(case, i+1)) for i in range(5)]),
               '--merge-strat', 'merge_graphs',
               '--extract-as',
               '-n', '15',
               '--output-conf-icgc',
               '--output-txt',
               '--output-txt-conf',
               '--output-gff3',
               '--output-struc',
               '--output-struc-conf',
               '--output-bed',
               '--output-conf-bed',
               '--output-conf-tcga',
               '--set-mm-tag', 'NM',
               '-v']

    spladder.main(my_args)

    ### check that files are identical
    _check_files_spladder(result_dir, out_dir, prefix='merge_graphs')
コード例 #2
0
ファイル: test_end_to_end.py プロジェクト: szkabel/spladder
def test_end_to_end_testing_cram(test_id, tmpdir):
    data_dir = os.path.join(os.path.dirname(__file__),
                            'testcase_{}'.format(test_id), 'data')
    result_dir = os.path.join(os.path.dirname(__file__),
                              'testcase_{}'.format(test_id),
                              'results_merged_cram')

    out_dir = str(tmpdir)

    my_args = [
        'spladder', 'build', '-a',
        os.path.join(data_dir, 'testcase_{}_spladder.gtf'.format(test_id)),
        '-o', out_dir, '-b', ','.join([
            os.path.join(
                data_dir, 'align',
                'testcase_{}_1_sample{}.cram'.format(test_id, idx + 1))
            for idx in range(20)
        ]), '--cram-reference',
        os.path.join(data_dir, 'genome.fa'), '--event-types',
        'exon_skip,intron_retention,alt_3prime,alt_5prime,mutex_exons,mult_exon_skip',
        '--merge-strat', 'merge_graphs', '--extract-ase', '--readlen', '50',
        '--output-conf-icgc', '--output-txt', '--output-txt-conf',
        '--output-gff3', '--output-struc', '--output-struc-conf',
        '--output-bed', '--output-conf-bed', '--output-conf-tcga',
        '--output-conf-icgc', '-v'
    ]

    spladder.main(my_args)

    ### check that event files are identical
    _check_files_spladder(result_dir, out_dir, prefix='merge_graphs')

    bamsA = os.path.join(out_dir, 'cramlistA.txt')
    bamsB = os.path.join(out_dir, 'cramlistB.txt')
    with open(bamsA, 'w') as fh:
        fh.write('\n'.join([
            os.path.join(
                data_dir, 'align', 'testcase_{}_1_sample{}.cram'.format(
                    test_id, idx + 1)) for idx in range(10)
        ]) + '\n')
    with open(bamsB, 'w') as fh:
        fh.write('\n'.join([
            os.path.join(
                data_dir, 'align', 'testcase_{}_1_sample{}.cram'.format(
                    test_id, idx + 11)) for idx in range(10)
        ]) + '\n')

    my_args = [
        'spladder', 'test', '-o', out_dir, '-v', '--diagnose-plots', '-f',
        'ps', '--readlen', '50', '--merge-strat', 'merge_graphs',
        '--event-types', 'exon_skip', '-a', bamsA, '-b', bamsB
    ]

    spladder.main(my_args)

    ### check that files are identical
    _check_files_testing(os.path.join(result_dir, 'testing'),
                         os.path.join(out_dir, 'testing'),
                         suffixes=['*.tsv'])
コード例 #3
0
ファイル: test_end_to_end.py プロジェクト: ratschlab/spladder
def test_end_to_end_testing(test_id, tmpdir):
    data_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'data')
    result_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'results_merged')

    out_dir = str(tmpdir)

    my_args = ['spladder',
               'build',
               '-a', os.path.join(data_dir, 'testcase_{}_spladder.gtf'.format(test_id)),
               '-o', out_dir,
               '-b', ','.join([os.path.join(data_dir, 'align', 'testcase_{}_1_sample{}.bam'.format(test_id, idx+1)) for idx in range(20)]),
               '--event-types', 'exon_skip,intron_retention,alt_3prime,alt_5prime,mutex_exons,mult_exon_skip',
               '--merge-strat', 'merge_graphs',
               '--extract-ase',
               '--readlen', '50',
               '--output-conf-icgc',
               '--output-txt',
               '--output-txt-conf',
               '--output-gff3',
               '--output-struc',
               '--output-struc-conf',
               '--output-bed',
               '--output-conf-bed',
               '--output-conf-tcga',
               '--output-conf-icgc',
               '-v']

    spladder.main(my_args)

    ### check that event files are identical
    _check_files_spladder(result_dir, out_dir, prefix='merge_graphs')

    bamsA = os.path.join(out_dir, 'bamlistA.txt')
    bamsB = os.path.join(out_dir, 'bamlistB.txt')
    with open(bamsA, 'w') as fh:
        fh.write('\n'.join([os.path.join(data_dir, 'align', 'testcase_{}_1_sample{}.bam'.format(test_id, idx+1)) for idx in range(10)]) + '\n')
    with open(bamsB, 'w') as fh:
        fh.write('\n'.join([os.path.join(data_dir, 'align', 'testcase_{}_1_sample{}.bam'.format(test_id, idx+11)) for idx in range(10)]) + '\n')

    my_args = ['spladder',
               'test',
               '-o', out_dir,
               '-v',
               '--diagnose-plots',
               '-f', 'ps',
               '--readlen', '50',
               '--merge-strat', 'merge_graphs',
               '--event-types', 'exon_skip',
               '-a', bamsA,
               '-b', bamsB]

    spladder.main(my_args)

    ### check that files are identical
    _check_files_testing(os.path.join(result_dir, 'testing'), os.path.join(out_dir, 'testing'), suffixes=['*.tsv'])
コード例 #4
0
ファイル: test_end_to_end.py プロジェクト: ratschlab/spladder
def test_end_to_end_single(test_id, case, tmpdir):
    data_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'data')
    result_dir = os.path.join(os.path.dirname(__file__), 'testcase_{}'.format(test_id), 'results_single_{}'.format(case))

    out_dir = str(tmpdir)

    my_args = ['spladder',
               'build',
               '-a', os.path.join(data_dir, 'annotation_{}.gtf'.format(case)),
               '-o', out_dir,
               '-b', os.path.join(data_dir, 'align', '{}_1.bam'.format(case)),
               '--merge-strat', 'single',
               '--extract-ase',
               '-n', '15',
               '--output-conf-icgc',
               '-v']

    spladder.main(my_args)

    my_args = ['spladder',
               'build',
               '-a', os.path.join(data_dir, 'annotation_{}.gtf'.format(case)),
               '-o', out_dir,
               '-b', os.path.join(data_dir, 'align', '{}_1.bam'.format(case)),
               '--merge-strat', 'single',
               '--extract-ase',
               '-n', '15',
               '--output-conf-icgc',
               '--sparse-bam',
               '-v']

    spladder.main(my_args)


    ### check that files are identical
    _check_files_spladder(result_dir, out_dir, prefix='{}_1'.format(case))
コード例 #5
0
ファイル: test_end_to_end.py プロジェクト: silvidc/spladder
               '--merge-strat', 'merge_graphs',
               '--extract-as',
               '-n', '15',
               '--output-conf-icgc',
               '--output-txt',
               '--output-txt-conf',
               '--output-gff3',
               '--output-struc',
               '--output-struc-conf',
               '--output-bed',
               '--output-conf-bed',
               '--output-conf-tcga',
               '--set-mm-tag', 'NM',
               '-v']

    spladder.main(my_args)

    ### check that files are identical
    _check_files_spladder(result_dir, out_dir, prefix='merge_graphs')

    #### test visualization
    #my_args = ['spladder',
    #           'viz',
    #           '-o', out_dir,
    #           '-b', ':'.join([','.join([os.path.join(data_dir, 'align', '{}_{}.bam'.format(case, i+1)) for i in range(3)]),
    #                           ','.join([os.path.join(data_dir, 'align', '{}_{}.bam'.format(case, i+4)) for i in range(2)])]),
    #           '-L', 'group1,group2',
    #           '-f', 'ps',
    #           '-v']

    #spladder.main(my_args)