Skip to content

Conversation

@Alex-Davydov
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Alex-Davydov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a valuable new data point, the abundance fraction per cluster, to the clustering results, enhancing the analytical output by providing a normalized measure of cluster size. Concurrently, a comprehensive update of various project dependencies was performed to maintain the codebase's health and integrate the latest library versions.

Highlights

  • New Feature: Abundance Fraction: A new column, "abundance_fraction_per_cluster", has been added to the "abundances-per-cluster.tsv" output file. This column represents the fraction of total abundance for each cluster, providing a normalized view of cluster size.
  • Dependency Updates: Several project dependencies, including various @milaboratories and @platforma-sdk packages, as well as Vue.js related packages, have been updated to their latest minor or patch versions to ensure stability and leverage recent improvements.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a new column abundance_fraction_per_cluster to the output, which represents the fraction of total abundance for each cluster. The changes involve updating the python scripts to calculate this new value and to include it in the output files. The logic for the calculation is sound. I've provided one suggestion to make the implementation more idiomatic and efficient using polars expressions, avoiding unnecessary data transfer between the polars engine and Python.

Comment on lines +200 to +206
total_abundance = abundances_per_cluster.select(pl.sum('abundance_per_cluster')).item()
abundances_per_cluster = abundances_per_cluster.with_columns(
pl.when(pl.lit(total_abundance) > 0)
.then(pl.col('abundance_per_cluster') / pl.lit(total_abundance))
.otherwise(pl.lit(0.0, dtype=pl.Float64))
.alias('abundance_fraction_per_cluster')
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The calculation of abundance_fraction_per_cluster can be made more efficient and idiomatic by performing the entire operation within the polars expression, avoiding the need to extract total_abundance into a Python variable using .item(). This keeps the computation entirely within the polars engine.

You can define the sum as a polars expression and reuse it.

Suggested change
total_abundance = abundances_per_cluster.select(pl.sum('abundance_per_cluster')).item()
abundances_per_cluster = abundances_per_cluster.with_columns(
pl.when(pl.lit(total_abundance) > 0)
.then(pl.col('abundance_per_cluster') / pl.lit(total_abundance))
.otherwise(pl.lit(0.0, dtype=pl.Float64))
.alias('abundance_fraction_per_cluster')
)
total_abundance_expr = pl.sum('abundance_per_cluster')
abundances_per_cluster = abundances_per_cluster.with_columns(
pl.when(total_abundance_expr > 0)
.then(pl.col('abundance_per_cluster') / total_abundance_expr)
.otherwise(pl.lit(0.0, dtype=pl.Float64))
.alias('abundance_fraction_per_cluster')
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants