Closed wthrif closed 3 years ago
Hello,
Logomaker expects a pandas dataframe of shape L (length) by C (characters). E.g., DNA, RNA sequences would be L x 4, and protein sequences (without *) would be L x 20. Your data are shaped L (=9) x 19, so logomaker doesn't recognize which amino-acid characters the number 19 corresponds to.
However there are multiple ways to resolve this. You can either specify a complete amino-acid alphabet in your input dataframe as its columns, or if your characters are some other number, you can define your own color_scheme. I've attached a screenshot of a simple code snippet here which shows your default logo in grey, a second logo where I specified a color scheme, and a third logo where I have added a column of zeros for the missing amino-acid Y (for illustration, I've assumed an alphabetic amino acid order). You can read more about defining your own color schemes here: https://logomaker.readthedocs.io/en/latest/examples.html
Ah oops, I didn't notice that, I was generating the count matrix with alignment_to_matrix and never checked the shapes. Thanks for the help!
Hey all, I love this package, but logos plot out to greyscale sometimes and I'm not sure what causes it, it doesn't seem to be connected to the number of strings used to generate the logo or the amount of information in the logo. Is there a logic behind this or is it a bug? Here's an information matrix (amino acids, length 9) that plots to grescale, while producing a nice motif
[[0.11609975, 0.00580504, 0.00580504, 0.01741501, 0.04643994, 0.01161003, 0.03482997, 0.02902498, 0.02322 , 0.01161003, 0.01161003, 0.00580504, 0.01161003, 0.08126985, 0.05224492, 0.01741501, 0.02902498, 0.00580504, 0.02902498], [0.0825232 , 0.01650477, 0.0660186 , 0.01650477, 0.04951399, 0.0660186 , 0.01650477, 0.03300938, 0.09902781, 0.0825232 , 0.01650477, 0.01650477, 0.85823977, 0.01650477, 0.04951399, 0.01650477, 0.01650477, 0.01650477, 0.01650477], [0.01649737, 0.00707031, 0.01178384, 0.02592442, 0.00707031, 0.00707031, 0.0141406 , 0.0141406 , 0.01178384, 0.00471355, 0.01178384, 0.00471355, 0.00471355, 0.02121089, 0.00471355, 0.00235679, 0.01885413, 0.01649737, 0.01649737], [0.01788234, 0.02980386, 0.06556842, 0.01192158, 0.04172538, 0.00596082, 0.0238431 , 0.03576462, 0.03576462, 0.00596082, 0.00596082, 0.13709754, 0.04768614, 0.01192158, 0.0238431 , 0.01788234, 0.02980386, 0.00596082, 0.00596082], [0.01486855, 0.00371715, 0.00929285, 0.01486855, 0.01672712, 0.00743428, 0.00743428, 0.00929285, 0.00743428, 0.00185858, 0.00557572, 0.01115142, 0.00743428, 0.00743428, 0.01300998, 0.01858568, 0.00929285, 0.00371715, 0.00557572], [0.01346732, 0.00269349, 0.01077386, 0.02424116, 0.02693462, 0.00538695, 0.01346732, 0.0215477 , 0.0215477 , 0.00269349, 0.01346732, 0.01346732, 0.01077386, 0.01077386, 0.02693462, 0.01346732, 0.01346732, 0.00269349, 0.00538695], [0.01502486, 0.00375624, 0.02629347, 0.00751245, 0.00375624, 0.01502486, 0.02253727, 0.00751245, 0.03380588, 0.00375624, 0.01126865, 0.01502486, 0.03380588, 0.03004968, 0.02629347, 0.03380588, 0.0488307 , 0.00375624, 0.01126865], [0.03348058, 0.00744016, 0.02976052, 0.0037201 , 0.01488028, 0.01116022, 0.00744016, 0.0223204 , 0.02604046, 0.00744016, 0.0037201 , 0.01488028, 0.03348058, 0.01860034, 0.03348058, 0.0409207 , 0.03348058, 0.0037201 , 0.0037201 ], [0.03412895, 0.01706456, 0.01706456, 0.51193181, 0.01706456, 0.03412895, 0.03412895, 0.01706456, 0.11945089, 0.01706456, 0.01706456, 0.01706456, 0.03412895, 0.01706456, 0.01706456, 0.01706456, 0.01706456, 0.01706456, 0.63138253]]