GMOD / Apollo3

JBrowse 2 plugin for editing annotations on an Apollo server
Apache License 2.0
7 stars 4 forks source link

Serve config.json from the collaboration server #359

Closed garrettjstevens closed 2 weeks ago

garrettjstevens commented 7 months ago

Investigate how to take a request for a /config.json files in nestjs and dynamically create a JBrowse config file and return it. Combined with #358, this would enable JBrowse to use the default config file location when being served by the collaboration server. This issue only includes assemblies and Apollo annotation tracks, not evidence tracks.

garrettjstevens commented 7 months ago

@kyostiebi I created a branch here to experiment with this: https://github.com/GMOD/Apollo3/tree/359_serve_config_json

I'd like you to continue using that branch and flesh it out more. The idea is that instead of generating the configs in packages/jbrowse-plugin-apollo/src/session/session.ts on the client side, they'll get generated on the server side in packages/apollo-collaboration-server/src/jbrowse/jbrowse.service.ts.

Currently in that branch the getConfig method in packages/apollo-collaboration-server/src/jbrowse/jbrowse.service.ts already has most of the logic from the afterCreate of packages/jbrowse-plugin-apollo/src/session/session.ts. It creates the assemblies and adds them to an "assemblies" entry in the config.

The next thing to do is to copy over the addApolloTrackConfig logic from packages/jbrowse-plugin-apollo/src/session/session.ts to the JBrowseService and use it to create the track configs. They will be added to a "tracks" entry in the config.

To test this out you'll need to open Apollo with the URL http://localhost:3000/?config=http://localhost:3999/config.json (instead of the usual http://localhost:3000/?config=http://localhost:9000/jbrowse_config.json).

garrettjstevens commented 6 months ago

@kyostiebi as discussed earlier today, I'd also like to experiment with having extra JBrowse track configurations stored in MongoDB and then adding them to the list of dynamically created tracks discussed above. For example, a single track entry might look like this:

{
  "type": "SyntenyTrack",
  "trackId": "Pchabaudichabaudi_vs_Pfalciparum3D7 (minimap2)",
  "name": "P. chabaudi vs P. falciparum (minimap2)",
  "assemblyNames": [
    "655d6b2dbbe3b64fded919fb",
    "655d45e0e7078c08e27047e5"
  ],
  "category": [
    "Synteny"
  ],
  "adapter": {
    "type": "PAFAdapter",
    "assemblyNames": [
      "655d6b2dbbe3b64fded919fb",
      "655d45e0e7078c08e27047e5"
    ],
    "pafLocation": {
      "locationType": "UriLocation",
      "uri": "data/Pchabaudichabaudi_Pfalciparum/Pchabaudichabaudi_vs_Pfalciparum3D7.minimap2.paf"
    }
  }
}

I think maybe each track would be a document in a new tracks collection, and they would get retrieved and added to the config.json generated by jbrowse.service.ts.

kyostiebi commented 5 months ago

Track menu now contains Add track to Apollo and Remove track from Apollo -items. Track configuration is saved to tracks -schema in Mongo.

garrettjstevens commented 2 weeks ago

Done in #371