Пример #1
0
    [['1', 'pos', 'ref'], ['1', 'pos', 'germline'], ['1', 'pos', 'somatic'],
     ['1', 'pos', 'somatic_and_germline'], ['1', 'neg', 'ref'],
     ['1', 'neg', 'germline'], ['1', 'neg', 'somatic'],
     ['1', 'neg', 'somatic_and_germline']])
def test_filter_infer_dna_pos(test_id, case, tmpdir, mutation_mode):
    tmpdir = str(tmpdir)
    test_name = 'test{}{}'.format(test_id, case)
    junction_kmer_file_path = os.path.join(
        groundtruth_dir, 'build', case, test_name,
        '{}_junction_kmer.txt'.format(mutation_mode))
    meta_file_path = os.path.join(groundtruth_dir, 'build', case, test_name,
                                  '{}_metadata.tsv.gz'.format(mutation_mode))
    output_file_path = os.path.join(tmpdir, 'junction_exact_dna_pos.txt')

    genome_path = os.path.join(data_dir, '{}.fa'.format(test_name))
    somatic_path = os.path.join(data_dir, '{}.maf'.format(test_name))
    germline_path = os.path.join(data_dir, '{}.vcf'.format(test_name))
    # infer dna pos output
    my_args = [
        'filter', '--junction-kmer-tsv-path', junction_kmer_file_path,
        '--output-file-path', output_file_path, '--output-dir', tmpdir,
        '--meta-file-path', meta_file_path, '--infer-dna-pos'
    ]
    split_mode(my_args)
    check_kmer_pos_valid(output_file_path,
                         genome_file=genome_path,
                         mutation_mode=mutation_mode,
                         sample=test_name,
                         germline_file_path=germline_path,
                         somatic_file_path=somatic_path)
Пример #2
0
                        '--output-dir', out_dir,
                        '--splice-path',
                        '{}/{}graph/spladder/genes_graph_conf3.merge_graphs.pickle'.format(
                            data_dir, case),
                        '--count-path',
                        '{}/{}graph/spladder/genes_graph_conf3.merge_graphs.count.hdf5'.format(
                            data_dir, case),
                        '--ann-path', '{}/test{}{}.gtf'.format(data_dir, test_id, case),
                        '--ref-path', '{}/test{}{}.fa'.format(data_dir, test_id, case),
                        '--germline', '{}/test{}{}.vcf'.format(data_dir, test_id, case),
                        '--somatic', '{}/test{}{}.maf'.format(data_dir, test_id, case),
                        '--gtex-junction-path','{}/{}graph/spladder/genes_graph_conf3.test1{}.junction.hdf5'.format(
                            data_dir, case, case),
                        '--mutation-mode', mutation_mode,
                        '--kmer', '4']
        ip.split_mode(my_args)

# make_bg mode
for case in case_list:
    output_dir = os.path.join(test_file_dir, 'test{}'.format(test_id), 'make_bg',case)
    output_file_name = os.path.join(out_dir,'{}_integrated_background_kmer.txt'.format(case))
    back_file_dir = os.path.join(test_file_dir,'test{}'.format(test_id),'build',case,'test{}{}'.format(test_id,case))
    bg_file_list = [os.path.join(back_file_dir,'{}_back_kmer.txt'.format(mode)) for mode in ['ref','somatic','somatic_and_germline','germline']]
    my_args = ['make_bg','--kmer-files']+bg_file_list+['--output-file-path',output_file_name]+['--output-dir',output_dir]
    ip.split_mode(my_args)

# diff mode
for case in case_list:
    for mutation_mode in mutation_list:
        junction_kmer_file_path = os.path.join(test_file_dir, 'test{}'.format(test_id), 'build',
                                               case, 'test{}{}'.format(test_id, case),'{}_junction_kmer.txt'.format(mutation_mode))
Пример #3
0
            data_dir, case), '--count-path',
        '{}/{}graph/spladder/genes_graph_conf3.merge_graphs.count.hdf5'.format(
            data_dir, case), '--ann-path',
        '{}/test{}{}.gtf'.format(data_dir, test_id, case), '--ref-path',
        '{}/test{}{}.fa'.format(data_dir, test_id, case), '--germline',
        '{}/test{}{}.vcf'.format(data_dir, test_id, case), '--somatic',
        '{}/test{}{}.maf'.format(data_dir, test_id,
                                 case), '--gtex-junction-path',
        '{}/{}graph/spladder/genes_graph_conf3.test1{}.junction.hdf5'.format(
            data_dir, case,
            case), '--mutation-mode', mutation_mode, '--kmer', '4'
    ]

    my_args = my_args_build
    sample_dir = sample_dir_build
    immunopepper.split_mode(my_args)
    _assert_files_equal(
        os.path.join(sample_dir, '{}_metadata.tsv.gz'.format(mutation_mode)),
        os.path.join(out_dir, 'test{}{}'.format(test_id, case),
                     '{}_metadata.tsv.gz'.format(mutation_mode)))
    # peptide
    _assert_files_equal(
        os.path.join(sample_dir, '{}_peptides.fa'.format(mutation_mode)),
        os.path.join(out_dir, 'test{}{}'.format(test_id, case),
                     '{}_peptides.fa'.format(mutation_mode)))
    _assert_files_equal(
        os.path.join(sample_dir, '{}_back_peptides.fa'.format(mutation_mode)),
        os.path.join(out_dir, 'test{}{}'.format(test_id, case),
                     '{}_back_peptides.fa'.format(mutation_mode)))
    #kmer
    _assert_files_equal(