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

No more non-unique column names, or non-queryable columns in list_columns #70

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

ivirshup
Copy link
Member

@ivirshup ivirshup commented Apr 8, 2024

@ivirshup ivirshup added this to the 0.1.0 milestone Apr 8, 2024
elif isinstance(tables, str):
tables = [tables] # list of tables names (only one)
columns = [c for t in tables for c in self.db.table(t).columns]

Copy link
Contributor

@gamazeps gamazeps Apr 8, 2024

Choose a reason for hiding this comment

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

columns = [c for t in tables for c in self.db.table(t).columns]
return list(sorted(set(columns)))

is shorter and more readable no ?

It even works with the current tests

Copy link
Member Author

@ivirshup ivirshup Apr 9, 2024

Choose a reason for hiding this comment

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

I think things are grouped a little more logically when it's ordered by table:

Example
In [2]: ensdb = gf.ensembl.annotation("Hsapiens", 108)

In [3]: ensdb.list_columns()
Out[3]: 
['gene_id',
 'gene_name',
 'gene_biotype',
 'gene_seq_start',
 'gene_seq_end',
 'seq_name',
 'seq_strand',
 'seq_coord_system',
 'description',
 'gene_id_version',
 'canonical_transcript',
 'tx_id',
 'tx_biotype',
 'tx_seq_start',
 'tx_seq_end',
 'tx_cds_seq_start',
 'tx_cds_seq_end',
 'tx_support_level',
 'tx_id_version',
 'gc_content',
 'tx_external_name',
 'tx_is_canonical',
 'exon_id',
 'exon_idx',
 'exon_seq_start',
 'exon_seq_end',
 'seq_length',
 'is_circular',
 'protein_id',
 'protein_sequence',
 'uniprot_id',
 'uniprot_db',
 'uniprot_mapping_type',
 'protein_domain_id',
 'protein_domain_source',
 'interpro_accession',
 'prot_dom_start',
 'prot_dom_end',
 'entrezid']

In [4]: sorted(ensdb.list_columns())
Out[4]: 
['canonical_transcript',
 'description',
 'entrezid',
 'exon_id',
 'exon_idx',
 'exon_seq_end',
 'exon_seq_start',
 'gc_content',
 'gene_biotype',
 'gene_id',
 'gene_id_version',
 'gene_name',
 'gene_seq_end',
 'gene_seq_start',
 'interpro_accession',
 'is_circular',
 'prot_dom_end',
 'prot_dom_start',
 'protein_domain_id',
 'protein_domain_source',
 'protein_id',
 'protein_sequence',
 'seq_coord_system',
 'seq_length',
 'seq_name',
 'seq_strand',
 'tx_biotype',
 'tx_cds_seq_end',
 'tx_cds_seq_start',
 'tx_external_name',
 'tx_id',
 'tx_id_version',
 'tx_is_canonical',
 'tx_seq_end',
 'tx_seq_start',
 'tx_support_level',
 'uniprot_db',
 'uniprot_id',
 'uniprot_mapping_type']

@ivirshup ivirshup enabled auto-merge (squash) April 10, 2024 08:54
@codecov-commenter
Copy link

codecov-commenter commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.06%. Comparing base (bae82d2) to head (66c32d8).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   92.94%   93.06%   +0.12%     
==========================================
  Files           6        6              
  Lines         340      346       +6     
==========================================
+ Hits          316      322       +6     
  Misses         24       24              
Files with missing lines Coverage Δ
src/genomic_features/ensembl/ensembldb.py 93.10% <100.00%> (+0.21%) ⬆️

@ivirshup ivirshup merged commit 66148be into scverse:main Apr 10, 2024
5 checks passed
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.

list_columns includes columns from "metadata" and "chromosome" table
3 participants