Beispiel #1
0
    def calculate_hs_metrics(self):
        jobs = []

        created_interval_lists = []

        for sample in self.samples:
            coverage_bed = bvatools.resolve_readset_coverage_bed(sample.readsets[0])
            if coverage_bed:
                interval_list = re.sub("\.[^.]+$", ".interval_list", coverage_bed)

                recal_file_prefix = os.path.join("alignment", sample.name, sample.name + ".sorted.dup.recal.")
                job = picard.calculate_hs_metrics(recal_file_prefix + "bam", recal_file_prefix + "onTarget.tsv", interval_list)
                if not interval_list in created_interval_lists:
                    job = concat_jobs([tools.bed2interval_list(None, coverage_bed, interval_list), job])
                    created_interval_lists.append(interval_list)

                job.name = "calculate_hs_metrics." + sample.name
                jobs.append(job)
        return jobs
Beispiel #2
0
    def metrics(self):
        jobs = []
        for sample in self.samples:
            recal_file_prefix = os.path.join("alignment", sample.name, sample.name + ".sorted.dup.recal.")
            input = recal_file_prefix + "bam"

            job = picard.collect_multiple_metrics(input, recal_file_prefix + "all.metrics")
            job.name = "collect_multiple_metrics." + sample.name
            jobs.append(job)

            # Compute genome coverage
            job = gatk.depth_of_coverage(input, recal_file_prefix + "all.coverage")
            job.name = "genome_coverage." + sample.name
            jobs.append(job)

            # Compute CCDS coverage
            job = gatk.depth_of_coverage(input, recal_file_prefix + "all.coverage", config.param('metrics', 'coverageTargets'))
            job.name = "target_coverage." + sample.name
            jobs.append(job)

            job = bvatools.depth_of_coverage(input, recal_file_prefix + "coverage.tsv", bvatools.resolve_readset_coverage_bed(sample.readsets[0]))
            job.name = "depth_of_coverage." + sample.name
            jobs.append(job)

            job = igvtools.compute_tdf(input, input + ".tdf")
            job.name = "igvtools." + sample.name
            jobs.append(job)

            job = samtools.flagstat(input, recal_file_prefix + "bam.flagstat")
            job.name = "flagstat." + sample.name
            jobs.append(job)
        return jobs