Skip to content

Commit

Permalink
dependency update
Browse files Browse the repository at this point in the history
  • Loading branch information
LX38LL committed Dec 1, 2023
1 parent 202ec6a commit 31bf5a0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
2 changes: 1 addition & 1 deletion nanomotif/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.1"
__version__ = "0.1.4"
11 changes: 0 additions & 11 deletions nanomotif/bin_consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,22 @@ def within_bin_motifs_consensus(pileup, assembly, motifs, motifs_scored, bins):
pl.col("motif").apply(lambda x: nm.seq.regex_to_iupac(x)).alias("motif_iupac")
)
# Merge motifs
print(bin_consensus)
print("Merging motifs")
merged_motifs = merge_motifs_in_df(bin_consensus.select(["contig","mod_type", "alpha", "beta","motif","mod_position",]), pileup, assembly)
# Remove submotifs
merged_motifs = nm.postprocess.remove_sub_motifs(merged_motifs)

print(merged_motifs)
print("Merging motifs2")
# Join merged motifs with unmerged motifs
merged_motifs = merged_motifs \
.join(bin_consensus, on=["contig", "motif", "mod_position", "mod_type"], how="left") \
.with_columns(
pl.col("motif").apply(lambda x: nm.seq.regex_to_iupac(x)).alias("motif")
)

print(merged_motifs)
print("Calculating mean")

bin_consensus = merged_motifs.unique(["bin", "motif", "mod_position", "mod_type", "contig"]) \
.with_columns(
(pl.when(pl.col("mean") > 0.5).then(True).otherwise(False)).alias("count_mean_threshold")
)
print(bin_consensus)
print("Calculating consensus")
bin_consensus = bin_consensus \
.groupby("bin", "motif", "mod_position", "mod_type") \
.agg(
Expand All @@ -75,8 +67,6 @@ def within_bin_motifs_consensus(pileup, assembly, motifs, motifs_scored, bins):
.with_columns(
pl.col("motif").apply(lambda x: nm.utils.motif_type(x)).alias("motif_type")
)
print(bin_consensus)
print("Filtering")


output = bin_consensus.select(["bin", "motif", "mod_position", "mod_type", "contig_count", "count_mean_threshold", "motif_type", "alpha_sum", "beta_sum", "mean_sum"]) \
Expand All @@ -86,7 +76,6 @@ def within_bin_motifs_consensus(pileup, assembly, motifs, motifs_scored, bins):
.with_columns(
pl.when(pl.col("bin").is_null()).then("unbinned").otherwise(pl.col("bin")).alias("bin")
)
print(output)
return output


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"requests",
"numpy==1.24.4",
"pandas==2.0.2",
"polars==0.18.3",
"polars==0.19.18",
"seaborn==0.12.2",
"scipy==1.10.1",
"networkx==3.1",
Expand Down

0 comments on commit 31bf5a0

Please sign in to comment.