Skip to content

Commit

Permalink
Fix to adress reporting problems in issue #51
Browse files Browse the repository at this point in the history
  • Loading branch information
mattloose committed Sep 24, 2024
1 parent 43796f4 commit ee6b38e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/robin/reporting/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ def create_CNV_plot(result, cnv_dict):
contig_centers = {}

for contig, values in result.cnv.items():
#if contig != "chrM":
if contig in ['chr' + str(i) for i in range(0, 23)] + ['chrX', 'chrY']:
# if contig != "chrM":
if contig in ["chr" + str(i) for i in range(0, 23)] + ["chrX", "chrY"]:
start_offset = offset
for i, value in enumerate(values):
plot_data.append((contig, i + offset, value))
Expand Down Expand Up @@ -167,8 +167,8 @@ def create_CNV_plot_per_chromosome(result, cnv_dict):
"""
plots = []
for contig, values in result.cnv.items():
#if contig != "chrM":,
if contig in ['chr' + str(i) for i in range(0, 23)] + ['chrX', 'chrY']:
# if contig != "chrM":,
if contig in ["chr" + str(i) for i in range(0, 23)] + ["chrX", "chrY"]:
plt.figure(figsize=(10, 2))
sns.scatterplot(x=range(len(values)), y=values, s=2)
plt.title(f"Copy Number Variation - {contig}")
Expand Down Expand Up @@ -251,8 +251,10 @@ def coverage_plot(df):
Returns:
io.BytesIO: Buffer containing the plot image.
"""
#df = df[df["#rname"] != "chrM"].copy()
df = df[df["#rname"].isin(['chr' + str(i) for i in range(0, 23)] + ['chrX', 'chrY'])].copy()
# df = df[df["#rname"] != "chrM"].copy()
df = df[
df["#rname"].isin(["chr" + str(i) for i in range(0, 23)] + ["chrX", "chrY"])
].copy()

# Sort chromosomes naturally
df["#rname"] = pd.Categorical(
Expand Down

0 comments on commit ee6b38e

Please sign in to comment.