Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional Three Letter Abbreviation for amino acid right table #330

Closed
wants to merge 2 commits into from
Closed

Optional Three Letter Abbreviation for amino acid right table #330

wants to merge 2 commits into from

Conversation

carlos-montano-hub
Copy link

Added a button to change the right table from One Letter Abbreviation to Three Letter Abbreviation in order to solve #323

image

image

In case of this PR being accepted, please accept #325 first, as I copied the code from there and in that way @chatelao would not lose his contribution

Any feedback please let me know

@vercel
Copy link

vercel bot commented Jul 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
covariants ✅ Ready (Inspect) Visit Preview Jul 12, 2022 at 1:21AM (UTC)

Copy link
Member

@ivan-aksamentov ivan-aksamentov left a comment

Choose a reason for hiding this comment

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

If the goal is to modify how amino acids letters are rendered, is it not logical to change the actual rendering code, rather then patching the source data somewhere half-way?

Here is where the letters are rendered:

{left && <ColoredText $color={leftColor}>{left}</ColoredText>}
{pos && <PositionText>{pos}</PositionText>}
{right && <ColoredText $color={rightColor}>{right}</ColoredText>}

Comment on lines +97 to +116
'Ala': '#EAEABA',
'Val': '#EAEA9F',
'Leu': '#E1E177',
'Ile': '#C9C94D',
'Cys': '#E3F9B0',
'Asp': '#E98F6D',
'Glu': '#F7B080',
'Phe': '#C7C88D',
'Gly': '#C0C0C0',
'His': '#D6F6FA',
'Lys': '#CEC0F3',
'Met': '#C3ED3C',
'Asn': '#F29290',
'Pro': '#D2D1F8',
'Gln': '#F8C4E3',
'Arg': '#A6ACEF',
'Ser': '#D8B9D4',
'Thr': '#F0D6E3',
'Trp': '#86B0CC',
'Tyr': '#8FC7D1',
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for duplicating colors? Duplication is typically bad and increases maintenance and probability of mistakes.

Copy link
Author

Choose a reason for hiding this comment

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

I think we have two options for the definition of the left/right colors this is one and the other is to translate from TLA to OLA in the color function.

However, I am looking at your feedback and it may not be necessary to change the color component

Comment on lines +246 to +252
function parseToTLA(ola: string): string {
return get(AMINOACID_TLA, ola, ola)
}

function parseToOLA(tla: string): string {
return get(AMINOACID_ONE, tla, tla)
}
Copy link
Member

Choose a reason for hiding this comment

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

This does not parse anything. Why is it called "parse"?

@@ -55,18 +55,41 @@ export function hasDefiningMutations(cluster: ClusterDatum) {
}

export function DefiningMutations({ cluster }: DefiningMutationsProps) {
const [isTLA, setTLA] = useState(true) // State changer for TLA or OLA
Copy link
Member

Choose a reason for hiding this comment

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

Any reason you decided to go with local state?

It is being reset on component unmount (e.g. page navigation), and now you need to pass the flag everywhere. Which prevents you from implementing the toggle for other places, which are far away from the button.

Comment on lines +80 to +92
<Button style={{
padding: 0,
width: 125,
background: "#ffffff",
borderRadius: 10 ,
color: '#495057' ,
font: "Open Sans" ,
fontSize: 14 ,
textAlign: 'center'
}}
onClick = {() => setTLA(isTLA => !isTLA)}>
{label}
</Button>
Copy link
Member

Choose a reason for hiding this comment

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

Why you decided to go with a button? I thought a checkbox or a flip toggle is a more natural choice for a boolean.

@ivan-aksamentov
Copy link
Member

I was hoping that we could implement a global toggle for all badges. Was this not the intent?

Perhaps the side bar on these particular pages is not the best place for a toggle, because when switching to other pages user loses access to the toggle.

@ivan-aksamentov
Copy link
Member

In case of this PR being accepted, please accept #325 first, as I copied the code from there and in that way @chatelao would not lose his contribution

You could have based your branch on chatelao's branch. This would simplify things a lot. It's not too late to rebase.

@emmahodcroft
Copy link
Collaborator

Hi @carlos-montano-hub - thank you for this PR! I think it really shows that the transition between the 1-letter and 3-letter abbreviations can be smooth, and that the side-bar with the mutations on the Variants pages looks good in both formats. I tried the current preview at a variety of resolutions/mobile devices and I think it looks good.

However I do think it's worth addressing some of Ivan's concerns above. In particular, it would be great for this to be a switch that adjusts how the badges display so that all badges across all parts of the page (in the text, in the non-defining mutation counts) and even across pages (Shared Mutations page) can change when the user requests a change, so that it's a 'universal state' across the site. Do you think that's possible?

I also agree that a slider or radio button might work better as it more clearly indicates the current selection, and might also be able to be made a little more compact, to fit at the top(-ish) of the relevant pages (each Variant page & the Shared Mutations page, I think) where it would be used.

However I think this shows really well, as I said, that the 3-letter abbreviations look good and the transitioning can be smooth, which makes it an idea worth pursuing and a great start! I'm hopeful to see it become something we can get integrated!

@carlos-montano-hub
Copy link
Author

Hello, thanks for the feedback @ivan-aksamentov @emmahodcroft I will be working on it and let you know

@carlos-montano-hub carlos-montano-hub closed this by deleting the head repository Aug 30, 2022
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.

None yet

3 participants