-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
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] | ||
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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']
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
|
list_columns
includes columns from"metadata"
and"chromosome"
table #42