-
Notifications
You must be signed in to change notification settings - Fork 4
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
Make ontology for feature types configurable #458
Comments
It turns out --- a/packages/jbrowse-plugin-apollo/src/OntologyManager/index.ts
+++ b/packages/jbrowse-plugin-apollo/src/OntologyManager/index.ts
@@ -1,4 +1,4 @@
-import { ConfigurationSchema } from '@jbrowse/core/configuration'
+import { ConfigurationSchema, readConfObject } from '@jbrowse/core/configuration'
import {
BlobLocation,
LocalPathLocation,
@@ -7,6 +7,8 @@ import {
import { autorun } from 'mobx'
import { Instance, addDisposer, getSnapshot, types } from 'mobx-state-tree'
+import ApolloPluginConfigurationSchema from '../config'
+
import OntologyStore, { OntologyStoreOptions } from './OntologyStore'
import { OntologyDBNode } from './OntologyStore/indexeddb-schema'
import { applyPrefixes, expandPrefixes } from './OntologyStore/prefixes'
@@ -54,16 +56,23 @@ export const OntologyManagerType = types
'GO:': 'http://purl.obolibrary.org/obo/GO_',
'SO:': 'http://purl.obolibrary.org/obo/SO_',
}),
+ pluginConfiguration: ApolloPluginConfigurationSchema,
})
+ .views((self) => ({
+ get featureTypeOntologyName(): string {
+ return readConfObject(
+ self.pluginConfiguration,
+ 'featureTypeOntologyName',
+ ) as string
+ },
+ }))
.views((self) => ({
/**
* gets the OntologyRecord for the ontology we should be
* using for feature types (e.g. SO or maybe biotypes)
**/
get featureTypeOntology() {
- // TODO: change this to read some configuration for which feature type ontology
- // we should be using. currently hardcoded to use SO.
- return this.findOntology('Sequence Ontology')
+ return this.findOntology(self.featureTypeOntologyName)
},
findOntology(name: string, version?: string) {
--- a/packages/jbrowse-plugin-apollo/src/config.ts
+++ b/packages/jbrowse-plugin-apollo/src/config.ts
@@ -5,6 +5,11 @@ import { OntologyRecordConfiguration } from './OntologyManager'
const ApolloPluginConfigurationSchema = ConfigurationSchema('ApolloPlugin', {
ontologies: types.array(OntologyRecordConfiguration),
+ featureTypeOntologyName: {
+ description: 'Name of the feature type ontology',
+ type: 'string',
+ defaultValue: 'Sequence Ontology',
+ },
})
export default ApolloPluginConfigurationSchema
--- a/packages/jbrowse-plugin-apollo/src/session/ClientDataStore.ts
+++ b/packages/jbrowse-plugin-apollo/src/session/ClientDataStore.ts
@@ -136,7 +136,9 @@ export function clientDataStoreFactory(
desktopFileDriver: isElectron
? new DesktopFileDriver(self as unknown as ClientDataStoreType)
: undefined,
- ontologyManager: OntologyManagerType.create(),
+ ontologyManager: OntologyManagerType.create({
+ pluginConfiguration: self.pluginConfiguration,
+ }),
}))
.actions((self) => ({
afterCreate() { |
@dariober, after the issues we saw earlier today with the most recent approach, I tried a different approach. See my branch here: configurable-ontology-issue458-gs. Could you try this branch out and see if it works on your end? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be configurable in the JBrowse config.json in the ApolloPlugin section:
You can add a slot to the ApolloPlugin schema like this:
And then read it with something like this:
The text was updated successfully, but these errors were encountered: