Provide map to colour select bases #18
Adamtaranto
started this conversation in
Ideas
Replies: 2 comments
-
It is possible with set_custom_color_func method. Code Example from pymsaviz import MsaViz, get_msa_testdata
msa_file = get_msa_testdata("HIGD2A.fa")
mv = MsaViz(msa_file, wrap_length=60, show_count=True)
coord_color_maps = ((0, 2, "salmon"), (5, 10, "skyblue"), (3, 20, "lime"))
def custom_color_func(row_pos, col_pos, seq_char, msa) -> str:
for coord_color_map in coord_color_maps:
if coord_color_map[0] == row_pos and coord_color_map[1] == col_pos:
return coord_color_map[2]
return "lightgrey"
mv.set_custom_color_func(custom_color_func)
mv.savefig("result.png") result.png |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks, I give that a go! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to highlight specific positions in an MSA by providing a map of x,y coords with all other positions being grey.
Alternatively, providing the map as a list of tuples (x,y,colour) to specify custom colours for the targeted bases.
Is this currently possible?
I am open to working on a PR if you can provide some guidance.
Beta Was this translation helpful? Give feedback.
All reactions