Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort output #64

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Sort output #64

wants to merge 8 commits into from

Conversation

thomas-reimonn
Copy link
Contributor

@thomas-reimonn thomas-reimonn commented Apr 3, 2024

This PR orders the results. By default, it's ordered by chrom, start, and id. Custom ordering can be provided using order_by.

If subsets of columns are selected, then the columns are sorted with available columns and finally by id.

@ivirshup
Copy link
Member

ivirshup commented Apr 4, 2024

I think we could do something like:

        order_cols = []
        if "gene" in tables:
            order_cols += ["seq_name", "gene_seq_start"]
        if "tx" in tables:
            order_cols += ["tx_seq_start"]
        if "exon" in tables:
            order_cols += ["exon_seq_start"]

to have a consistent total order. But idk for sure.

Can this get some tests for expected behavior?

@thomas-reimonn
Copy link
Contributor Author

I updated it like that. It now sorts in a consistent order. I also added assertions to the tests to validate this functionality.

Copy link
Member

@ivirshup ivirshup left a comment

Choose a reason for hiding this comment

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

Could you add tests where we are selecting columns from a different table, e.g. .genes(["seq_name", "gene_...", "exon_id"]) and checking that the results are sorted?

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 95.23810% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 93.01%. Comparing base (ef33d87) to head (a5cdb15).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
- Coverage   93.09%   93.01%   -0.08%     
==========================================
  Files           6        6              
  Lines         333      358      +25     
==========================================
+ Hits          310      333      +23     
- Misses         23       25       +2     
Files Coverage Δ
src/genomic_features/ensembl/ensembldb.py 93.02% <95.23%> (-0.14%) ⬇️

@ivirshup
Copy link
Member

Sorry for the delay on review/ approval but I wanted to dig into the duckdb behaviour we saw a bit more. An ibis maintainer believes this might be a duckdb bug.

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.

3 participants