Skip to content

Commit

Permalink
fixed coverage values in tax_abundance
Browse files Browse the repository at this point in the history
  • Loading branch information
farchaab committed Oct 9, 2024
1 parent 5ae2d62 commit 975e0f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mess/workflow/scripts/calculate_cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_even_dist(table):
df["tax_abundance"] = df["proportion"] / df["count"]
df["genome_bases"] = df["total_sequence_length"] * df["tax_abundance"]
df["sum_genome_bases"] = df.groupby("samplename")["genome_bases"].transform("sum")
df["cov_obtained"] = bases / (df["sum_genome_bases"] * p)
df["cov_obtained"] = bases / df["sum_genome_bases"]
df["cov_sim"] = df["tax_abundance"] * df["cov_obtained"]
df["sum_cov"] = df.groupby("samplename")["cov_sim"].transform("sum")
df["bases"] = df["cov_sim"] * df["total_sequence_length"]
Expand All @@ -117,7 +117,7 @@ def get_even_dist(table):
df["sum_genome_bases"] = df.groupby("samplename")["genome_bases"].transform(
"sum"
)
df["cov_obtained"] = bases / (df["sum_genome_bases"] * p)
df["cov_obtained"] = bases / df["sum_genome_bases"]
df["cov_sim"] = df["tax_abundance"] * df["cov_obtained"]
df["sum_cov"] = df.groupby("samplename")["cov_sim"].transform("sum")
df["bases"] = df["cov_sim"] * df["total_sequence_length"]
Expand All @@ -133,7 +133,7 @@ def get_even_dist(table):
df["tax_abundance"] = df["cov_sim"] / df["sum_cov"]

if "reads" in entry_df.columns:
df["bases"] = df["reads"] * (snakemake.params.read_len * p)
df["bases"] = df["reads"] * snakemake.params.read_len * p
df["sum_bases"] = df.groupby("samplename")["bases"].transform("sum")
df["seq_abundance"] = df["bases"] / df["sum_bases"]
df["cov_sim"] = df["bases"] / df["total_sequence_length"]
Expand Down

0 comments on commit 975e0f7

Please sign in to comment.