Example #1
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     var_dir = os.path.join(self.data_dir, "variants")
     files = [
         os.path.join(var_dir, "S1-variants.vcf"),
         os.path.join(var_dir, "S2-variants.vcf")
     ]
     out_file = os.path.join(var_dir, "S1_S2-combined.vcf")
     ref_file = os.path.join(self.data_dir, "genomes", "hg19", "seq",
                             "hg19.fa")
     config = load_config(
         os.path.join(self.data_dir, "automated",
                      "post_process-sample.yaml"))
     run_parallel = parallel_runner({
         "type": "local",
         "cores": 1
     }, {}, config)
     region_dir = os.path.join(var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(out_file):
         os.remove(out_file)
     vcfutils.parallel_combine_variants(files, out_file, ref_file, config,
                                        run_parallel)
Example #2
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     files = [
         os.path.join(self.var_dir, "S1-variants.vcf"),
         os.path.join(self.var_dir, "S2-variants.vcf")
     ]
     ref_file = os.path.join(self.data_dir, "genomes", "hg19", "seq",
                             "hg19.fa")
     with make_workdir() as workdir:
         config = load_config(
             get_post_process_yaml(self.automated_dir, workdir))
         config["algorithm"] = {}
     region_dir = os.path.join(self.var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(self.combo_file):
         os.remove(self.combo_file)
     with prun.start({
             "type": "local",
             "cores": 1
     }, [[config]], config) as run_parallel:
         vcfutils.parallel_combine_variants(files, self.combo_file,
                                            ref_file, config, run_parallel)
     for fname in files:
         if os.path.exists(fname + ".gz"):
             subprocess.check_call(["gunzip", fname + ".gz"])
         if os.path.exists(fname + ".gz.tbi"):
             os.remove(fname + ".gz.tbi")
Example #3
0
 def test_1_parallel_vcf_combine(self, global_config):
     """Parallel combination of VCF files, split by chromosome.
     """
     from bcbio.variation import vcfutils
     files = [
         os.path.join(self.var_dir, "S1-variants.vcf"),
         os.path.join(self.var_dir, "S2-variants.vcf")
     ]
     config = load_config(global_config)
     config["algorithm"] = {}
     region_dir = os.path.join(self.var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(self.combo_file):
         os.remove(self.combo_file)
     reqs = {"type": "local", "cores": 1}
     with prun.start(reqs, [[config]], config) as run_parallel:
         vcfutils.parallel_combine_variants(files, self.combo_file,
                                            self.ref_file, config,
                                            run_parallel)
     for fname in files:
         if os.path.exists(fname + ".gz"):
             subprocess.check_call(["gunzip", fname + ".gz"])
         if os.path.exists(fname + ".gz.tbi"):
             os.remove(fname + ".gz.tbi")
Example #4
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     from bcbio.variation import vcfutils
     files = [
         os.path.join(self.var_dir, "S1-variants.vcf"),
         os.path.join(self.var_dir, "S2-variants.vcf")
     ]
     with make_workdir() as workdir:
         config = load_config(
             get_post_process_yaml(self.automated_dir, workdir))
         config["algorithm"] = {}
     region_dir = os.path.join(self.var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(self.combo_file):
         os.remove(self.combo_file)
     reqs = {"type": "local", "cores": 1}
     with prun.start(reqs, [[config]], config) as run_parallel:
         vcfutils.parallel_combine_variants(
             files, self.combo_file, self.ref_file, config, run_parallel)
     for fname in files:
         if os.path.exists(fname + ".gz"):
             subprocess.check_call(["gunzip", fname + ".gz"])
         if os.path.exists(fname + ".gz.tbi"):
             os.remove(fname + ".gz.tbi")
Example #5
0
def merge_vcf_files(sample_files, cores, config):
    out_file = config["outputs"]["merge"]
    config["algorithm"] = {}
    run_parallel = parallel_runner({"type": "local", "cores": min(cores, 8)}, {}, config)
    vcfutils.parallel_combine_variants(sample_files, out_file, config["ref"]["GRCh37"],
                                       config, run_parallel)
    return out_file
Example #6
0
def merge_vcf_files(sample_files, cores, config):
    out_file = config["outputs"]["merge"]
    config["algorithm"] = {}
    run_parallel = parallel_runner({
        "type": "local",
        "cores": min(cores, 8)
    }, {}, config)
    vcfutils.parallel_combine_variants(sample_files, out_file,
                                       config["ref"]["GRCh37"], config,
                                       run_parallel)
    return out_file
Example #7
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     var_dir = os.path.join(self.data_dir, "variants")
     files = [os.path.join(var_dir, "S1-variants.vcf"), os.path.join(var_dir, "S2-variants.vcf")]
     out_file = os.path.join(var_dir, "S1_S2-combined.vcf")
     ref_file = os.path.join(self.data_dir, "genomes", "hg19", "seq", "hg19.fa")
     config = load_config(os.path.join(self.data_dir, "automated",
                                       "post_process-sample.yaml"))
     run_parallel = parallel_runner({"type": "local", "cores": 1}, {}, config)
     region_dir = os.path.join(var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(out_file):
         os.remove(out_file)
     vcfutils.parallel_combine_variants(files, out_file, ref_file, config, run_parallel)
Example #8
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     files = [os.path.join(self.var_dir, "S1-variants.vcf"), os.path.join(self.var_dir, "S2-variants.vcf")]
     ref_file = os.path.join(self.data_dir, "genomes", "hg19", "seq", "hg19.fa")
     config = load_config(os.path.join(self.data_dir, "automated",
                                       "post_process-sample.yaml"))
     run_parallel = parallel_runner({"type": "local", "cores": 1}, {}, config)
     region_dir = os.path.join(self.var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(self.combo_file):
         os.remove(self.combo_file)
     vcfutils.parallel_combine_variants(files, self.combo_file, ref_file, config, run_parallel)
     for fname in files:
         if os.path.exists(fname + ".gz"):
             subprocess.check_call(["gunzip", fname + ".gz"])
         if os.path.exists(fname + ".gz.tbi"):
             os.remove(fname + ".gz.tbi")
Example #9
0
 def test_1_parallel_vcf_combine(self):
     """Parallel combination of VCF files, split by chromosome.
     """
     # Be back compatible with 0.7.6 -- remove after 0.7.7 release
     if prun is None:
         return
     files = [os.path.join(self.var_dir, "S1-variants.vcf"), os.path.join(self.var_dir, "S2-variants.vcf")]
     ref_file = os.path.join(self.data_dir, "genomes", "hg19", "seq", "hg19.fa")
     config = load_config(os.path.join(self.data_dir, "automated",
                                       "post_process-sample.yaml"))
     region_dir = os.path.join(self.var_dir, "S1_S2-combined-regions")
     if os.path.exists(region_dir):
         shutil.rmtree(region_dir)
     if os.path.exists(self.combo_file):
         os.remove(self.combo_file)
     with prun.start({"type": "local", "cores": 1}, [[config]], config) as run_parallel:
         vcfutils.parallel_combine_variants(files, self.combo_file, ref_file, config, run_parallel)
     for fname in files:
         if os.path.exists(fname + ".gz"):
             subprocess.check_call(["gunzip", fname + ".gz"])
         if os.path.exists(fname + ".gz.tbi"):
             os.remove(fname + ".gz.tbi")