Code Monkey home page Code Monkey logo

monarch-ui's Introduction

monarch-ui README

This repository contains the source code for the Monarch Initiative web application (aka, the Monarch UI).

This README describes the application and its interaction with Monarch Initiative services such as BioLink. It also provide a Quickstart on how to build and run the application.

For detailed information on the structure of the code and how to contribute, see CONTRIBUTING.md.

Overall Architecture

The UI is a VueJS single-page application that is loaded into the browser as a static set of Javascript, HTML, CSS, and media resources. Subsequent dynamic data is delivered to the browser via XMLHttpRequest calls to various backend services, primarily BioLink. The data returned from these calls is then displayed appropriately in the web application.

The VueJS application is built from source code via a modern chain of tools that deal with resource bundling, minification, and transpilation:

The output of the build process is a set of static files including bundled Javascript, CSS, HTML and other media assets. These are then deployed to Netlify where they can be served to users on the internet.

BioLink Service

There are multiple versions of the BioLink service. See the top of the BioLink file in /api for what versions are available.

To easily switch between these versions in the live web-app, add a parameter to your current url like ?api=beta.

Directory Structure

monarch-ui/

  • package.json lists build-time and run-time dependencies and a list of npm run-able scripts such as npm run dev.
  • vue.config.js is the configuration that is used by vue-cli to dynamically generate the configuration needed by webpack, which is invoked behind the scenes by vue-cli.
  • publish.sh is a convenience script invoked by npm run ghpublish to copy the developer's current directory into their gh-pages branch and then pushing that to origin.
  • babel.config.js configures the Babel compiler that translates modern Javascript into browser-compatible Javascript.
  • .eslintrc.js specifies the linting rules used by eslint to ensure that code is authored in a more uniform and safe way.
monarch-ui/dist/

This directory contains the output of the build process (e.g., from npm run build or npm run ghpublish). The files here should never be placed in source control or edited; they are generated files. Upon first downloading the repo, or after npm run clean, this directory may not exist.

monarch-ui/public/

The vue-cli workflow specifies that the contents of public/ are copied verbatim to the build output directory dist/, and therefore made available to running web application.

  • team.yaml describes the persons and institutions that make up the Monarch project. This is used by AboutTeam.md to render a Team page.
  • news.yaml is used to drive the HomeNews.md component.
  • robots.txt is used to guide or exclude web-crawling robots. See Robots.txt.
  • index.html is transformed by the build workflow to generate a corresponding dist/index.html. It is NOT copied verbatim.
  • mondo_ids.txt is a tab-demimited list of "Diseases of the Month" for all 12 months of the year. It is used to populate the Featured Diseases carousel on the home page. The first field is the Mondo ID; the second indicates which month to display the disease, formatted as YYYY-MM-DD.
monarch-ui/src/

This directory and the monarch-ui/public/ (see above) directory contains the primary HTML, Javascript, and CSS source code that will be used to build the web application assets in monarch-ui/dist/.

monarch-ui/src/main.js

By convention, vue-cli will use src/main.js as its main entry point. This file performs any global initialization, including the Vue router and the main App.vue.

monarch-ui/src/App.vue

By convention, App.vue is the root VueJS component that is usually bound to a div in the public/index.html file. This is a good place to configure VueJS and register global components.

monarch-ui/src/router.js

This file router.js is where the vue-router is loaded and configured.

monarch-ui/src/style/

This file contains SCSS or CSS files that might need to be included in several components.

The most important file here is variables.scss, which can be included in every component via:

<style lang="scss">
@import "~@/style/variables";
...
</style>
monarch-ui/src/api/

We've tried to isolate external network API access into this directory, so that the rest of the UI can be unaware of the protocol and network issues inherent in making XMLHttpRequest or axios calls. For example, api/bio-link.js is the module that makes REST calls to the BioLink server, and the rest of the UI simply imports from api/bio-link.js. For example:

import * as BL from '@/api/bio-link';
// ...
const promise = BL.getNeighborhood(this.nodeId, this.nodeType);
monarch-ui/src/lib/

This directory is for non-UI utility code that does not access external network APIs (which would be located in src/api/).

monarch-ui/src/assets/img/

Assets that will be bundled by webpack by require or import. E.g., require('../assets/img/icon-models.png')

monarch-ui/src/component/
monarch-ui/src/views/

Both components/ and views/ are properly VueJS components. However, by convention, we isolate top-level routable components into the views/ directory. Both component types are typically just VueJS Single-file Components with extension .vue. In some cases, they will have a .md extension, which means they will be scanned for Markdown prior to becoming VueJS components. See Markdown-based Components below for more information about Markdown in components.

Markdown-based Components

In an attempt to make it easier for non-developers to contribute enhancements to the prose within the application, we've enabled the capability to define VueJS components that contain Markdown text in their <template>. These files with extension .md (e.g., views/AboutMonarch.md) are processed at build-time by loaders/vue-markdown-loader-improved.js, which will find Markdown fragments within the template and will translate them (at build-time) into HTML.

QuickStart

In order to build the application locally, you will need to obtain the source code and follow the QuickStart instructions below.

Obtaining the source code

If your intent is to eventually contribute source code to the project via pull requests, then we recommend that you first fork the monarch-ui repo and then git clone this fork to your local development machine. Details on using the GitHub Flow workflow for contributing to open source projects are provided in CONTRIBUTING

For example, if your GitHub username is abc, and you've forked the monarch-ui repo to your user, then you can get a local copy of your forked repo with (assuming that monarch_stuff exists on your machine)

cd monarch_stuff/
git clone [email protected]:abc/monarch-ui.git
cd monarch_ui/

For simple evaluation or testing of the monarch-ui, then cloning the primary repo at monarchinitiative/monarch-ui should be sufficient. You will not be able to submit pull requests if you take this route, however.

cd monarch_stuff/
git clone https://github.com/monarch-initiative/monarch-ui.git
cd monarch_ui/

Environment setup

There may be some one-time installation of tools, depending upon whether you have the supported version of NodeJS running. NodeJS v8.12.0 is currently supported, although the project will likely build fine with later versions of NodeJS. If the following command fails, then you probably do not have NodeJS installed:

node -v

If the above command fails or if it reports a version number significantly different from v8.12.0, then you should install nvm - Node Version Manager and then install a compatible version of NodeJS.

In the event that you do not already have a compatible version of NodeJS installed, we have provided detailed instructions at the end of the CONTRIBUTING document here Installing NodeJS.

Project setup

Whenever you update your local development machine's source code, and upon initially cloning the repository, you will need to run the following npm install command, which will read the latest downloaded package.json and ensure that your local dependencies are up to date.

npm install

Local Development: Fast Compile and hot-reload

The following command will run webpack in development mode, which runs a webpack-dev-server that detects source code changes and rebuilds the application dynamically and delivers these changes to the browser via hot reload, which often allows the UI to be updated without a full page reload. This speeds up a developer's iterations immensely.

npm run serve

The command npm run dev is an alias for npm run serve, mostly for the convenience of folks who are used to npm run dev.

Production Build: Bundling and Minification

In contrast to npm run serve above, which is designed to quickly build and demonstrate changes to the source code, the npm run build command will be more exhaustive in optimizing the build, and will produce a set of assets (Javascript, HTML, CSS, media) that are suitable for deployment to a web server.

npm run build

Production Test: Build and Serve

Although there shouldn't be any difference in behavior between development and production mode builds, there sometimes are. So it has proven convenient to be able to test the production build locally, which is why the npm run buildandserve command was added:

npm run buildandserve

Linting

Usually, we are editing code with a text editor (e.g., SublimeText) that works with ESLint and highlights any linting errors discovered as we edit. It is also possible to manually run ESLint over the entire source. This is a good idea to do before finalizing your code submission.

npm run lint

Testing

Run your unit tests

npm run test:unit

Run your end-to-end tests

npm run test:e2e

Run both types of test

npm run test

monarch-ui's People

Contributors

amc-corey-cox avatar bryanlaraway avatar caufieldjh avatar cmungall avatar dependabot[bot] avatar doctorbud avatar dougli1sqrd avatar falquaddoomi avatar iimpulse avatar jen-martin avatar jmcmurry avatar justaddcoffee avatar kevinschaper avatar kshefchek avatar monicacecilia avatar nathandunn avatar nicolevasilevsky avatar nlharris avatar pnrobinson avatar putmantime avatar sabrinatoro avatar victoriasoesanto avatar vincerubinetti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

monarch-ui's Issues

Updates to Phenogrid

The 'analyze phenotypes' function requires data fidelity, and it needs to leverage Phenogrid.
It is critical that users find a better way to navigate the results, which requires the results display to be more self-explanatory.

What we need to complete:

  • ability to filter by taxon, by gene/diseases, by phenotype - all completed in JSON.
  • Remove sim calls to legacy monarch app and replace with BioLink calls and new schema (blocked by biolink/ontobio#227)
  • Remove calls to fetch phenotype labels and replace with output from above call

Nice-to-haves that can be overlooked in first release of the new UI :

  • update to d3 v5
  • remove jquery ui code, replace with vanilla es6 or vue
  • 2 panel-display
  • auto-update

Literature node pages needed

Even if they're sparse, I'd like the literature node pages to exist. This is important for integration with Hippo too.

Accommodate search by curie / accession

Breaking out search-by-curie (had been part of https://github.com/monarch-initiative/monarch-app/issues/1383) as a separate ticket as it is a long-running and circumscribable issue.

search issue query Top result must be results must include status
curie HP:0000452 HP:0000452 Improve ranking
fuzzy curie HPO:0000452 HP:0000452 Improve ranking
curie ncbigene:6622 ncbigene:6622 Improve ranking
fuzzy curie gene:6622 ncbigene:6622 Improve ranking

The pseudocode would be:

if search string contains ':' or '_' 
     check the prefixes in curie_map.yml (note that this check will require case insensitivity)
           if prefix exists, check if there's a corresponding web page for it.
                   if the curie has a corresponding web page in our site, redirect there (skip search results page)
                        else if no corresponding web page exists in our site, go to a generic warning page with the text "The accession number you have searched for does not have a corresponding page in our website, or you may have used a prefix syntax we do not recognize. The prefixes we use are browsable at ...curie_map.yml"
else if search string does not contain ':' or '_' proceed with search as usual.

This logic could be baked into solr itself or could be handled client side. It is pretty easy, so defer to your preference as devs.

Fix label for identifiers from GARD

When exploring the results for the term 'polysyndactily,' found that the identifier for an equivalent ID from GARD is incorrectly labeled as OBO:GARD_0001616, where it should be GARD:0001616

Screen Shot 2019-05-13 at 9 22 29 AM

@deepakunni3 - could you please add more detail here?

Minor improvements for term pages

Some can be slow to load. Would be good to diagnose so we can come up with a plan, e.g.

http://beta.monarchinitiative.org/phenotype/HP:0010831

(this may have been a temporary issue, but it would be good to get an idea of load time of different pages under different loads)

We calculate both |association| and |gene|, but we show in different places (former once you click on the tab, latter on the tab itself) which can look a bit odd? I'm not sure, get a second opinion on this.
http://beta.monarchinitiative.org/phenotype/HP:0010831#gene

image

fix all the searches

I may break this into multiple issues, but this is everything I have for now.

adapted from: #1 (comment)

  • Filter button itself shouldn't be multiselect moved to #2
  • home page should use the same filter as the one at the top
  • Have the filters menu at the left of navbar (equivalent to what is on the node pages already). There is a single vue widget driving both of these so the trick would be to adapt the homepage autocomplete to look more like navbar autocomplete. Doing so will remove the
  • That "filters" button (in both places, home and navbar) should instead say "All"
  • add 'e.g.:' before the search examples (ND . . I didn't see this)
  • remove 'marfan syndrome disease' as one of the examples. 'syndrome disease' is an odd pairing.

  • ~~Wire up the "search in all results" to give you what you get here https://alpha.monarchinitiative.org/search/marfan ~~ moved to #5

  • autopopulate the first item of autocomplete results as "search < foo > in all results"; it is appropriate that this item be preselected so that if the user presses 'enter' they get to the search results page with facets. (ND: I think this is a bad idea UI-wise and is more complex to implement than what I put in there (by default if nothing is selected, do the full search). This follows the UI convections of both AMZN and GOOGLE )

===

  • add a search button to the right of the search bar (home page version only) (this is configurable with the show-search-button)

URI problem in search box at new monarch-ui

In some cases, when typing a term into the 'Search' box of the beta version of the new monarch-ui, a problem with URIs is evident. For example, try doing a search with the beginning of a gene name, in the example, I used the word 'hox.' See the errors in suggested lines 3 and 7 in the screenshot below:

Screen Shot 2019-05-09 at 12 45 03 PM

Update Phenogrid

Nice-to-haves for new UI (leftover from #26):

  • update to d3 v5
  • remove jquery UI code, replace with vanilla es6 or vue
  • 2 panel-display
  • auto-update

Update the Home page

On the home, About Us and About Monarch pages, text needs to be updated.

  • On the home page, we need to update information about The Monarch Initiative and What we do

Screen Shot 2019-05-13 at 12 50 26 PM

Change the name of the "Analyze Phenotypes" tool.

To better represent the functionality of the tool, this is a suggestion to change the name of the tool from “Analyze Phenotypes” to something such as “Phenotype Profile Search” or “Phenome Search.”

Screen Shot 2019-05-09 at 12 48 25 PM

Provenance of pathway annotations are not very clear

E.g. http://beta.monarchinitiative.org/phenotype/HP:0003474#pathway

image

I don't think there is any one single source here. This is a join between reactome pathway gene -> disease -> phenotype in monarch-solr-queries?

Not sure why Coriell comes into the picture at all?

I suggest as a first pass having an info box for each tab, e.g. "monarch phenotype pathway associations are derived from combining phenotype to gene info with info from Reactome about which gene is involved with each pathway". Ideally this would be more data/metadata driven

genome features should get pulled from ensembl

  • genome features data should get pulled from ensembl

  • We are already getting the Ensembl data via mygene.info calls . . . . for human, but we can do that everywhere:

https://mygene.info/v3/query?q=HGNC:3603&fields=summary,genomic_pos,name,symbol,taxid&species=all

returns:

{
  "max_score": 12.227615,
  "took": 4,
  "total": 1,
  "hits": [
    {
      "_id": "2200",
      "_score": 12.227615,
      "genomic_pos": {
        "chr": "15",
        "end": 48645849,
        "ensemblgene": "ENSG00000166147",
        "start": 48408306,
        "strand": -1
      },
      "name": "fibrillin 1",
      "summary": "This gene encodes a member of the fibrillin family of proteins. The encoded preproprotein is proteolytically processed to generate two proteins including the extracellular matrix component fibrillin-1 and the protein hormone asprosin. Fibrillin-1 is an extracellular matrix glycoprotein that serves as a structural component of calcium-binding microfibrils. These microfibrils provide force-bearing structural support in elastic and nonelastic connective tissue throughout the body. Asprosin, secreted by white adipose tissue, has been shown to regulate glucose homeostasis. Mutations in this gene are associated with Marfan syndrome and the related MASS phenotype, as well as ectopia lentis syndrome, Weill-Marchesani syndrome, Shprintzen-Goldberg syndrome and neonatal progeroid syndrome. [provided by RefSeq, Apr 2016].",
      "symbol": "FBN1",
      "taxid": 9606
    }
  ]
}

The follow-up call is: https://rest.ensembl.org/documentation/info/lookup

and we use this: https://rest.ensembl.org/lookup/id/ENSG00000157764?content-type=application/json;expand=1

otherwise we have to provide a sequence and range, but this is better

Update Data Sources page, display metadata about load & version.

The Monarch website should display information about the current load. That is, we should display metadata about what version of the Monarch data load is currently being used, (also what version of the ontologies) and where the file(s) can be found.

For an example, see what is done in AmiGO.

Screen Shot 2019-05-09 at 12 46 59 PM

Enhance Histopheno with onset and frequency info

Histopheno

This widget will offer a high level view of the results.

What is needed:

@kshefchek: This is a barchart view of phenotypes broken down by high level category. A simple view is supported by biolink. Pivoting on frequency is not yet supported by biolink.

Codepen mockup of the pivot view here: https://codepen.io/anon/pen/aVMPGX

Strategy for shipping new monarch-ui

@nathandunn @tomc @kshefchek and @DoctorBud had an opportunity to meet in Eugene yesterday and we came up with a plan that would allow us to move the monarch-ui to production at https://monarchinitiative.org, while satisfying constraints like

  • Continue to support https://monarchinitiative.org/<id>.json for legacy API users
  • Continue to support https://monarchinitiative.org/<type>/<id>.json for legacy API users
  • Continue to support https://monarchinitiative.org/score for legacy API users
  • Continue to support https://monarchinitiative.org/??owlsim?? for legacy API users (@kshefchek what is the other legacy API endpoint folks might be using?)
  • Allow for legacy functionality to be visible (for comparison and testing) via https://legacy.monarchinitiative.org

I've refined the plan we discussed so that it is more symmetrical and beta vs production distinctions are clearer. In addition, this strategy doesn't require any complex DNS-swap like I was proposing yesterday.

Phase 1a - Create legacy.monarchinitiative.org

  • Will require @Kennric to tweak HAProxy to direct traffic for legacy.m.org to the current production VM containing m.org.
  • Might require GoDaddy to declare the subdomain legacy.m.org (is this true @kshefchek @Kennric?)

Phase 1b - Create legacybeta.monarchinitiative.org

  • Will require @Kennric to tweak HAProxy to direct traffic for legacybeta.m.org to the current beta VM containing beta.m.org.
  • Might require GoDaddy to declare the subdomain legacybeta.m.org (is this true @kshefchek @Kennric?)

Phase 1c - Create preview.monarchinitiative.org

  • Will require @Kennric to tweak HAProxy to direct traffic for preview.m.org to the current production VM containing m.org.
  • Might require GoDaddy to declare the subdomain preview.m.org (is this true @kshefchek @Kennric?)
  • This preview.m.org domain will only be used until the final 'nginx swap' on production. It will allow us to verify that monarch-ui can be deployed on the production VM and that legacy API routing on the production VM is working.
  • Once we do the final swap on production, we can delete this subdomain.

Phase 2 - Update monarch-app-beta VM with latest legacy monarch-app

  • This VM has previously served up monarch-app, and everything is installed.
  • However, the monarch-app service has been disabled since we began serving monarch-ui from here.
  • So this step is really about making sure that the monarch-app code on beta is the same as that on production. Might be doable with Jenkins

Phase 3 - Verify that legacy.m.org and legacybeta.m.org work

  • URLs like https://legacy.monarchinitiative.org should lead to the legacy monarch-app on production
  • URLs like https://legacybeta.monarchinitiative.org should lead to the legacy monarch-app on beta
  • Assuming HAProxy is configured right, then the nginx conf on beta/prod will need to be adjusted so that those VMs can serve both monarch-app and monarch-ui.
  • Remember that legacy.m.org is the same monarch-app-prod VM as m.org.
  • Remember that legacybeta.m.org is the same monarch-app-beta VM as beta.m.org.

Phase 4 - On beta, use nginx to route legacy paths to legacybeta.m.org

Phase 5 - Install monarch-ui on production as preview.m.org

  • Duplicate the monarch-ui-beta Jenkins task and call it monarch-ui
  • Create any necessary directories on production to hold monarch-ui
  • Deploy monarch-ui to production
  • Adjust production nginx to route preview.m.org to monarch-ui

Take a breath

Phase 5 - Ribbon-cutting Ceremony ... 'Make it So!'

  • Adjust production nginx config so that m.org points to monarch-ui
  • Profit!
  • If something goes horribly wrong, then just undo the edit(s) to nginx so that m.org points to monarch-app.

need to fix google structured data

#78 is not yet fixed.

Let's fix #81 first to make it easier to test.

See: https://search.google.com/structured-data/testing-tool/u/0/#url=http%3A%2F%2Fbeta.monarchinitiative.org%2Fgene%2FZFIN%3AZDB-GENE-001103-2

The JSONLD script is there, but its not getting picked up. Possible because its a JSON Array.

The snippet provided is actually fine:

[
  {
    "@context": "http://schema.org",
    "@type": "Organization",
    "url": "https://monarchinitiative.org",
    "email": "[email protected]"
  },
  {
    "@context": "http://schema.org",
    "@type": "WebSite",
    "url": "https://monarchinitiative.org",
    "potentialAction": {
      "@type": "SearchAction",
      "target": "https://monarchiniative.org/search/{term}",
      "query-input": "required name=term"
    }
  }
]

Note @cmungall / @kltm . . I think just adding it with a simple tag doesn't quite work.

Not sure what secret sauce that google structured data needs from vuejs, or maybe google is just grumpy today.

Not high priority, so can recheck later.

Update icons on side bar and cards

Right now we use the anatomy icon as a place holder, but we need icons for publications, functions, pathways, homologs, variants, genotypes, etc. In some cases perhaps we could reuse icons with different colors? For things such as genes, variants, and genotypes. Individual icons are likely best if we have them.

Using a gene of interest to generate likely phenotypes

This is more of a dumb novice question. I wanted to find out about the phenotype associated with defects in TRIP12. I expect to find phenotypes related to NDD in animals that lack TRIP12, or wtTRIP12 analysis to learn things about TRIP12. Not sure Monarch has this information. As a user, this would be a useful feature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.