genomic-features icon indicating copy to clipboard operation
genomic-features copied to clipboard

Sort output

Open thomas-reimonn opened this issue 1 year ago • 4 comments

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.

thomas-reimonn avatar Apr 03 '24 19:04 thomas-reimonn

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?

ivirshup avatar Apr 04 '24 12:04 ivirshup

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

thomas-reimonn avatar Apr 04 '24 14:04 thomas-reimonn

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%) :arrow_down:

codecov-commenter avatar Apr 04 '24 14:04 codecov-commenter

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.

  • https://github.com/ibis-project/ibis/discussions/8896

ivirshup avatar Apr 11 '24 12:04 ivirshup