Skip to content

Commit

Permalink
Add PAR option to 'diagram' and 'heatmap' commands (closes #872)
Browse files Browse the repository at this point in the history
  • Loading branch information
etal committed Apr 12, 2024
1 parent 537491d commit 7366ecb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cnvlib/cnary.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,11 @@ def shift_xx(self, is_haploid_x_reference=False, is_xx=None, diploid_parx_genome
is_xx = self.guess_xx(is_haploid_x_reference=is_haploid_x_reference, diploid_parx_genome=diploid_parx_genome)
if is_xx and is_haploid_x_reference:
# Female: divide X coverages by 2 (in log2: subtract 1)
outprobes[outprobes.chromosome == self._chr_x_label, "log2"] -= 1.0
outprobes[outprobes.chromosome == self.chr_x_label, "log2"] -= 1.0
# Male: no change
elif not is_xx and not is_haploid_x_reference:
# Male: multiply X coverages by 2 (in log2: add 1)
outprobes[outprobes.chromosome == self._chr_x_label, "log2"] += 1.0
outprobes[outprobes.chromosome == self.chr_x_label, "log2"] += 1.0
# Female: no change
return outprobes

Expand Down
2 changes: 2 additions & 0 deletions cnvlib/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,7 @@ def _cmd_diagram(args):
action="store_false",
help="""Disable gene_name labels on plot (useful when a lot of CNV were called).""",
)
add_diploid_parx_genome(P_diagram)
P_diagram.set_defaults(func=_cmd_diagram)


Expand Down Expand Up @@ -1747,6 +1748,7 @@ def _cmd_heatmap(args):
P_heatmap_aes.add_argument(
"-t", "--title", help="Plot title. [Default: Range if provided, otherwise none]"
)
add_diploid_parx_genome(P_heatmap)
P_heatmap.set_defaults(func=_cmd_heatmap)


Expand Down

0 comments on commit 7366ecb

Please sign in to comment.