Skip to content

[hail] if an MT is string-column-keyed, use said strings in show#6405

Merged
danking merged 1 commit intohail-is:masterfrom
danking:show-str-cols
Jun 20, 2019
Merged

[hail] if an MT is string-column-keyed, use said strings in show#6405
danking merged 1 commit intohail-is:masterfrom
danking:show-str-cols

Conversation

@danking
Copy link
Copy Markdown
Contributor

@danking danking commented Jun 19, 2019

Previously the below would display 0.GT | 1.GT (simply the index in the entries array).

In [2]: import hail as hl  
   ...: mt = hl.balding_nichols_model(3, 100, 100) 
   ...: mt = mt.key_cols_by(sample_id = 'sample-' + hl.str(mt.sample_idx)) 
   ...: mt.show(n_rows=10, n_cols=10)                                                                                                                                                                               
2019-06-19 16:20:33 Hail: INFO: balding_nichols_model: generating genotypes for 3 populations, 100 samples, and 100 variants...
+---------------+------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+
| locus         | alleles    | sample-0.GT | sample-1.GT | sample-2.GT | sample-3.GT | sample-4.GT | sample-5.GT | sample-6.GT | sample-7.GT | sample-8.GT | sample-9.GT |
+---------------+------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+
| locus<GRCh37> | array<str> | call        | call        | call        | call        | call        | call        | call        | call        | call        | call        |
+---------------+------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+
| 1:1           | ["A","C"]  | 0/0         | 0/0         | 0/1         | 1/1         | 0/1         | 0/0         | 0/1         | 0/1         | 0/1         | 0/1         |
| 1:2           | ["A","C"]  | 1/1         | 0/1         | 0/0         | 0/1         | 1/1         | 1/1         | 0/1         | 1/1         | 0/0         | 1/1         |
| 1:3           | ["A","C"]  | 1/1         | 0/1         | 0/0         | 1/1         | 0/0         | 1/1         | 1/1         | 0/1         | 0/0         | 1/1         |
| 1:4           | ["A","C"]  | 0/0         | 0/1         | 0/0         | 1/1         | 0/1         | 0/0         | 0/1         | 0/0         | 0/0         | 0/1         |
| 1:5           | ["A","C"]  | 0/1         | 0/0         | 0/0         | 0/0         | 0/1         | 0/0         | 0/1         | 0/1         | 0/0         | 1/1         |
| 1:6           | ["A","C"]  | 0/0         | 1/1         | 1/1         | 0/1         | 0/1         | 1/1         | 0/1         | 0/1         | 1/1         | 1/1         |
| 1:7           | ["A","C"]  | 0/0         | 0/1         | 1/1         | 0/1         | 0/1         | 0/1         | 0/0         | 0/1         | 0/0         | 0/1         |
| 1:8           | ["A","C"]  | 0/1         | 0/1         | 1/1         | 1/1         | 0/1         | 0/1         | 1/1         | 1/1         | 0/1         | 0/1         |
| 1:9           | ["A","C"]  | 0/0         | 0/1         | 1/1         | 1/1         | 1/1         | 0/1         | 1/1         | 1/1         | 1/1         | 1/1         |
| 1:10          | ["A","C"]  | 0/1         | 0/1         | 0/1         | 0/0         | 0/1         | 0/0         | 0/1         | 0/1         | 0/0         | 0/1         |
+---------------+------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+-------------+
showing top 10 rows
showing the first 10 of 100 columns

In [3]:  

Copy link
Copy Markdown
Member

@patrick-schultz patrick-schultz left a comment

Choose a reason for hiding this comment

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

awesome

@danking danking merged commit 58de923 into hail-is:master Jun 20, 2019
@danking danking deleted the show-str-cols branch December 18, 2019 01:53
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