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

OrthoMCL - Custom tree-table for OrthoGroup page #904

Open
wants to merge 58 commits into
base: main
Choose a base branch
from

Conversation

bobular
Copy link
Member

@bobular bobular commented Mar 1, 2024

Testing:

There are only a few tree files available on the back end, so only a few orthogroups work. Here's are the valid OGs at the moment:

  • OG6_102443
  • OG6_103280
  • OG6_105395
  • OG6_105810
  • OG6_126264
  • OG6_126317
  • OG6_126334
  • OG6_126431

Run ortho-site locally and access the path /app/record/group/OG6_102443
Back end config for .env is

BASE_PROXY_URL=https://qa.orthomcl.org/
LEGACY_WEB_APP_URL=${BASE_PROXY_URL}/orthomcl
PROJECT_ID=OrthoMCL
yarn && yarn nx start @veupathdb/ortho-site

To do:

  • restore clustal functionality
  • pfam domain architecture in main table
  • pfam legend
  • pfam legend checkboxes apply to main table
  • search box
  • take care of width issues/horizontal scroll/remove some columns/sticky checkbox column? (partially solved by using the horizontal scroll of the whole page)
  • sortable columns? (hide tree if sorted)
  • maybe do core/peripheral filters?
  • also add EC "legend filter"? - some questions around partial ECs
  • do general WDK page/record reorganisation
  • fix inline click with tooltips? (currently clicking changes the row height - perhaps just hide the tree if any rows are expanded?)
  • reset button?
  • full_id needs display name and go on left
  • un-collapse the main section

UX suggestions

  • organism/taxon legend(s)?
  • zoom out to see whole tree? or maybe a modal?
  • tree bolder (thicker lines)
  • add explanation of tree
  • tree branch metrics? (future)

@bobular bobular marked this pull request as draft March 1, 2024 21:50
@bobular bobular changed the title made a start - WIP OrthoMCL - Custom tree-table for OrthoGroup page Mar 1, 2024
Copy link
Member

@dmfalke dmfalke left a comment

Choose a reason for hiding this comment

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

This is looking really good. I made some comments below. Let me know what you think!

Comment on lines 96 to 111
<div
style={{
flexGrow: 1,
width: 1 /* arbitrary non-zero width seems necessary for flex */,
}}
>
<Global
styles={globalStyle`
.DataTable {
margin-bottom: 0px !important;
width: 80%;
}
`}
/>
<Mesa state={tableState} />
</>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I'm just noticing this. I'm not sure we should use Global here, as the style will be reflected on all subsequent pages.

Instead, could you use a css prop on the parent div component (line 96), and target .DataTable in there?

      <div
        css={{
          flexGrow: 1,
          width: 1 /* arbitrary non-zero width seems necessary for flex */,
          '.DataTable': {
            marginBottom: '0px !important',
            width: '80%'
          }
        }}
      >
        <Mesa state={tableState} />
    </div>

Copy link
Member Author

@bobular bobular Mar 20, 2024

Choose a reason for hiding this comment

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

Oh yeah, that's much simpler (and no side effects) - done in 5c896a0 - thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Could we change these identifiers such that they include the "group" prefix? E.g., GroupTreeResponse, groupTreeResponseDecoder, etc?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure! fd446f8

@dmfalke
Copy link
Member

dmfalke commented Apr 29, 2024

It's imported here:

https://github.com/VEuPathDB/web-monorepo/blob/26807b89d8f8a131984a63f67da68a70e83309f2/packages/sites/ortho-site/webapp/wdkCustomization/js/client/wrapStoreModules.tsx

I'm pretty sure you can just delete the reduce and don't need to make any other changes.

@bobular
Copy link
Member Author

bobular commented Apr 30, 2024

Ah, thanks, I was missing something fundamental that I get now.

@bobular bobular marked this pull request as ready for review May 29, 2024 13:33
@bobular
Copy link
Member Author

bobular commented May 29, 2024

It looks like we can't avoid the "We're sorry, something went wrong." modal being rendered if the wdkService back end call returns a 404. That hook (useWdkService/useOrthoService) doesn't handle errors the same way as the EDA's usePromise.

However, we can avoid asking for a tree when there are too few sequences, thus avoiding some user-facing errors. Will push a commit soon to address this and make sure the regular table still renders.

  const numSequences = mesaRows.length;
  const treeResponse = useOrthoService(
    numSequences > 2
      ? (orthoService) => orthoService.getGroupTree(groupName)
      : () => Promise.resolve(undefined),
    [groupName, numSequences]
  );

@dmfalke
Copy link
Member

dmfalke commented Jun 3, 2024

@bobular what is the state of the backend for this? Do I need to use the diamond branch and the rm database John mentioned?

Copy link
Member

@dmfalke dmfalke left a comment

Choose a reason for hiding this comment

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

Overall, this looks great. I added some comments. Let me know what you think!

@@ -18,7 +18,7 @@ class TableSearch extends React.PureComponent {
clearSearchQuery() {
const query = null;
Copy link
Member

Choose a reason for hiding this comment

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

This can be deleted

@@ -26,6 +31,12 @@ const orthoServiceWrappers = {
method: 'get',
path: `/group/${groupName}/layout`,
}),
getGroupTree: (wdkService: WdkService) => (groupName: string) =>
wdkService.sendRequest(groupTreeResponseDecoder, {
useCache: true,
Copy link
Member

Choose a reason for hiding this comment

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

It's worth noting that this property causes the response to be stored in indexeddb, which is governed by the browsers quota policy for domains. If the database exceeds the quota, attempts to cache responses will begin to fail (don't worry, this is handled for a seamless user experience). In all likelihood, important/critical responses will already be cached, so it should not impact website load times.

In the future, we might consider using LRU (least recently used) caches for things like this, where the cache container has an identifier, and we retain up to a certain number of entries, ejecting those used least recently.

For now, this is probably fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting. Are the cache entries keyed by the full request payload (like react-query)?

If so, this would seem to be a general WDK problem, not specific to fetching the tree (is it massively bigger than the responses from the other endpoints?)

Copy link
Member

Choose a reason for hiding this comment

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

Entries are keyed by path and, if provided, cacheId. See here. I don't know how big these newick strings can get, so it's hard to say how much of an issue it would be.

Again, I think this is probably fine, but I wanted to mention the current limitations.

]
],
"dependencies": {
"patristic": "^0.6.0"
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be declared in packages/libs/components/package.json.

Copy link
Member Author

Choose a reason for hiding this comment

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

There's

import { parseNewick } from 'patristic';

in Sequences.tsx though.

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't use patristic directly in components. If tidytree needs it then that's its business!

Copy link
Member

Choose a reason for hiding this comment

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

Aha, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I think this should be moved to packages/libs/components

@dmfalke
Copy link
Member

dmfalke commented Jun 4, 2024

Another thing... it would be nice for the row counts to indicate when the table is filtered, as in this screenshot:

image

@bobular
Copy link
Member Author

bobular commented Jun 19, 2024

Hi all. I've made some expensive synchronous operations into asynchronous effects and added a switch to show only core proteins when #seqs > 2000

OG7_0000009 with 10k sequences is a good test case.

The remaining performance issues seem to be
a) filtering the tree based on search (which is currently synchronous) - takes a couple of seconds for a 10k group.
b) rendering

My FF still complains sometimes for the full (core+peripheral) and this seems to be a mix of Pfam architecture rendering and tree rendering. Only disabling both seems to prevent any slow-down warnings. We probably need to think a bit more about large groups and what sensible cutoffs are.

@@ -448,3 +456,21 @@ function createSafeSearchRegExp(input: string): RegExp {
return new RegExp(escapedInput, 'i');
}
}

function summarizeIDMismatch(A: string[], B: string[]) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe name this something like logIdMismatchSummary

@bobular
Copy link
Member Author

bobular commented Jul 2, 2024

Latest commit adds this. No dashed outline when there are PFam domains.
image

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

2 participants