Closed ebolyen closed 6 years ago
These should be displayed in the tabulate
viz, and it would also be helpful if they were exportable (i.e., they were written to file as the #q2:types
directive line, as they are when you call Metadata.save
).
The complex headers datatables example is a good example of what we're going for here, and we may or may not want to group by type (i.e., use the colspan
functionality) - whoever implements this should experiment with that.
To get this information into the table
json in tabulate
, you can create a pd.MultiIndex
as follows:
df = input.to_dataframe()
df_columns = pd.MultiIndex.from_tuples(
[(n, t.type) for n, t in input.columns.items()],
names=['column header', 'type'])
df.columns = df_columns
df.reset_index(inplace=True)
@gregcaporaso, @jairideout, @antgonza: would you guys prefer to see the column types as a second header row (ignore the sorting glyphs, this is just a proof of concept):
or inlined:
I like the first example (column types as a second header row) because it matches the Metadata file format more closely than the inlined version. Could you also add the #q2:types
directive in the cell directly below the ID header?
What about a combination of two? Two rows but just separated by a new line so the controls are in the same cell? This comes cause the values can be pretty large (thus making them in 2 rows makes sense) but also the number of rows can be large so trying to keep it in 1 might make sense. If not easy, just go with 2. Now, is the header static? In other words, does it stay visible when you scrolldown?
I like the first example with two rows.
Here it is as two separate rows, no formatting:
Here it is as one "row," but with linebreaks inside the cell:
Here is the linebreaks inside the cell again, but with some element styling:
Thoughts @jairideout @gregcaporaso @antgonza ?
@antgonza - I also made sure that the header is "fixed" as per your request.
@thermokarst, that looks pretty cool, thanks! I vote 3 😃.
Option 3 looks really nice :shipit:
I also like option 3.
QIIME 2 will begin to centralize the inferences it makes on the types for metadata categories,
tabulate
should show that information as well.