Last active
October 19, 2021 04:50
-
-
Save safay/08e5e2c626b6ca8569494b9249fba743 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# given a pandas df object, 'qc_df', including a '384Well' column and two other metrics columns | |
metric1 = 'median_depth' | |
metric2 = 'n_mapped_reads' | |
get_row = lambda x: x[0] | |
qc_df['plate_y'] = qc_df['384Well'].apply(get_row) | |
def get_col(x): | |
num = x[1:] | |
if len(num) == 1: | |
num = "0" + num | |
return num | |
qc_df['plate_x'] = qc_df['384Well'].apply(get_col) | |
alt.Chart(qc_df).mark_square().encode( | |
x = alt.X('plate_x', axis=alt.Axis(title='')), | |
y = alt.Y('plate_y', axis=alt.Axis(title='')), | |
color = alt.Color(metric1, scale=alt.Scale(scheme="viridis")), | |
size = metric2 | |
).properties( | |
width=600, | |
height=450 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment