Skip to content

Commit

Permalink
fix: sam validation error (#1019)
Browse files Browse the repository at this point in the history
* add fixmate command

* changelog
  • Loading branch information
khurrammaqbool authored Nov 16, 2022
1 parent 4ff1b8f commit 95b49f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
12 changes: 10 additions & 2 deletions BALSAMIC/snakemake_rules/variant_calling/mergetype_normal.rule
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,23 @@ rule mergeBam_normal:
params:
housekeeper_id = {"id": normal_sample, "tags": "normal"},
picard = params.common.picard_RG_normal,
sample = normal_sample
sample = normal_sample,
tmpdir= tempfile.mkdtemp(prefix=tmp_dir),
threads:
get_threads(cluster_config, "mergeBam_normal")
message:
"Replacing bam header using Picardtools for {params.sample}"
shell:
"""
picard AddOrReplaceReadGroups {params.picard} INPUT={input.bam} OUTPUT={output.bam};
samtools collate --threads {threads} -Ou {input.bam} {params.tmpdir}/{params.sample} |\
samtools fixmate - - |\
samtools sort --threads {threads} -O BAM -o {params.tmpdir}/normal.fixed.bam -;
picard AddOrReplaceReadGroups {params.picard} INPUT={params.tmpdir}/normal.fixed.bam OUTPUT={output.bam};
samtools index {output.bam};
samtools view -h -T {input.fasta} --threads {threads} -C -o {output.cram} {output.bam};
samtools index {output.cram};
"""
12 changes: 10 additions & 2 deletions BALSAMIC/snakemake_rules/variant_calling/mergetype_tumor.rule
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,23 @@ rule mergeBam_tumor:
params:
housekeeper_id = {"id": tumor_sample, "tags": "tumor"},
picard = params.common.picard_RG_tumor,
sample = tumor_sample
sample = tumor_sample,
tmpdir= tempfile.mkdtemp(prefix=tmp_dir),
threads:
get_threads(cluster_config, "mergeBam_tumor")
message:
"Replacing bam header using Picardtools for {params.sample}"
shell:
"""
picard AddOrReplaceReadGroups {params.picard} INPUT={input.bam} OUTPUT={output.bam};
samtools collate --threads {threads} -Ou {input.bam} {params.tmpdir}/{params.sample} |\
samtools fixmate - - |\
samtools sort --threads {threads} -O BAM -o {params.tmpdir}/tumor.fixed.bam -;
picard AddOrReplaceReadGroups {params.picard} INPUT={params.tmpdir}/tumor.fixed.bam OUTPUT={output.bam};
samtools index {output.bam};
samtools view -h -T {input.fasta} --threads {threads} -C -o {output.cram} {output.bam};
samtools index {output.cram};
"""
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changed:
* Update `TIDDIT` to v3.3.0, `SVDB` to v2.6.4, `delly` to v1.1.3, `vcf2cytosure` to v0.8 https://github.com/Clinical-Genomics/BALSAMIC/pull/987
* toml config file for vcfanno https://github.com/Clinical-Genomics/BALSAMIC/pull/1012
* Split `vep_germline` rule into `tumor` and `normal` https://github.com/Clinical-Genomics/BALSAMIC/pull/1018
* Fix mate in realined bam file https://github.com/Clinical-Genomics/BALSAMIC/pull/1019

Fixed:
^^^^^^
Expand Down

0 comments on commit 95b49f3

Please sign in to comment.