@apollo-annotation/jbrowse-plugin-apollo 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { checkRegistry, changeRegistry, Change, isAssemblySpecificChange } from '@apollo-annotation/common';
2
- import { gff3ToAnnotationFeature, AddAssemblyFromExternalChange, AddAssemblyAndFeaturesFromFileChange, AddAssemblyFromFileChange, AddFeatureChange, DeleteAssemblyChange, DeleteFeatureChange, makeGFF3Feature, AddFeaturesFromFileChange, UserChange, DeleteUserChange, FeatureAttributeChange, AddRefSeqAliasesChange, getDecodedToken, makeUserSessionId, LocationEndChange, LocationStartChange, TypeChange, StrandChange, splitStringIntoChunks, validationRegistry, ValidationResultSet, filterJBrowseConfig, ImportJBrowseConfigChange, changes, CDSCheck, CoreValidation, ParentChildValidation } from '@apollo-annotation/shared';
2
+ import { gff3ToAnnotationFeature, AddAssemblyFromExternalChange, AddAssemblyAndFeaturesFromFileChange, AddAssemblyFromFileChange, AddFeatureChange, DeleteAssemblyChange, DeleteFeatureChange, annotationFeatureToGFF3, AddFeaturesFromFileChange, UserChange, DeleteUserChange, FeatureAttributeChange, AddRefSeqAliasesChange, getDecodedToken, makeUserSessionId, LocationEndChange, LocationStartChange, TypeChange, StrandChange, splitStringIntoChunks, validationRegistry, ValidationResultSet, filterJBrowseConfig, ImportJBrowseConfigChange, changes, CDSCheck, CoreValidation, ParentChildValidation } from '@apollo-annotation/shared';
3
3
  import { ConfigurationSchema, readConfObject, getConf, ConfigurationReference } from '@jbrowse/core/configuration';
4
4
  import { BaseInternetAccountConfig, InternetAccount, RendererType, TextSearchAdapterType, BaseDisplay, WidgetType, createBaseTrackConfig, TrackType, createBaseTrackModel, InternetAccountType, DisplayType } from '@jbrowse/core/pluggableElementTypes';
5
5
  import Plugin from '@jbrowse/core/Plugin';
@@ -50,7 +50,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
50
50
  import ErrorIcon from '@mui/icons-material/Error';
51
51
  import SaveIcon from '@mui/icons-material/Save';
52
52
 
53
- var version = "0.2.0";
53
+ var version = "0.2.2";
54
54
 
55
55
  const ApolloConfigSchema = ConfigurationSchema('ApolloInternetAccount', {
56
56
  baseURL: {
@@ -576,7 +576,7 @@ const stopwords = genericEnglishStopwords;
576
576
  function applyPrefixes(uri, prefixes) {
577
577
  for (const [prefix, uriBase] of prefixes.entries()) {
578
578
  if (uri.startsWith(uriBase)) {
579
- return uri.replace(uriBase, prefix);
579
+ return uri.replace(uriBase, String(prefix));
580
580
  }
581
581
  }
582
582
  return uri;
@@ -586,8 +586,8 @@ function applyPrefixes(uri, prefixes) {
586
586
  */
587
587
  function expandPrefixes(uri, prefixes) {
588
588
  for (const [prefix, uriBase] of prefixes.entries()) {
589
- if (uri.startsWith(prefix)) {
590
- return uri.replace(prefix, uriBase);
589
+ if (uri.startsWith(String(prefix))) {
590
+ return uri.replace(String(prefix), uriBase);
591
591
  }
592
592
  }
593
593
  return uri;
@@ -2006,7 +2006,7 @@ function DownloadGFF3({ handleClose, session }) {
2006
2006
  continue;
2007
2007
  }
2008
2008
  for (const [, feature] of features) {
2009
- gff3Items.push(makeGFF3Feature(getSnapshot(feature)));
2009
+ gff3Items.push(annotationFeatureToGFF3(getSnapshot(feature)));
2010
2010
  }
2011
2011
  }
2012
2012
  for (const sequenceFeature of sequenceFeatures) {
@@ -9022,6 +9022,15 @@ class InMemoryFileDriver extends BackendDriver {
9022
9022
  });
9023
9023
  }
9024
9024
  async submitChange(_change, _opts = {}) {
9025
+ const { clientStore } = this;
9026
+ const { assemblies } = clientStore;
9027
+ clientStore.clearCheckResults();
9028
+ for (const [, assembly] of assemblies) {
9029
+ if (assembly.backendDriverType === 'InMemoryFileDriver') {
9030
+ const checkResults = await checkFeatures(assembly);
9031
+ clientStore.addCheckResults(checkResults);
9032
+ }
9033
+ }
9025
9034
  return new ValidationResultSet();
9026
9035
  }
9027
9036
  async searchFeatures(_term, _assemblies) {
@@ -9135,7 +9144,7 @@ class DesktopFileDriver extends BackendDriver {
9135
9144
  for (const [, refSeq] of clientAssembly.refSeqs) {
9136
9145
  const { features } = refSeq;
9137
9146
  for (const [, feature] of features) {
9138
- gff3Items.push(makeGFF3Feature(getSnapshot(feature)));
9147
+ gff3Items.push(annotationFeatureToGFF3(getSnapshot(feature)));
9139
9148
  }
9140
9149
  }
9141
9150
  for (const [, refSeq] of clientAssembly.refSeqs) {
@@ -9231,6 +9240,9 @@ function clientDataStoreFactory(AnnotationFeatureExtended) {
9231
9240
  deleteCheckResult(checkResultId) {
9232
9241
  self.checkResults.delete(checkResultId);
9233
9242
  },
9243
+ clearCheckResults() {
9244
+ self.checkResults.clear();
9245
+ },
9234
9246
  }))
9235
9247
  .volatile((self) => ({
9236
9248
  changeManager: new ChangeManager(self),
@@ -9458,7 +9470,11 @@ function extendSession(pluginManager, sessionModel) {
9458
9470
  dynamicBlocks.forEach((block) => {
9459
9471
  if (block.regionNumber !== undefined) {
9460
9472
  const { assemblyName, end, refName, start } = block;
9461
- locations.push({ assemblyName, refName, start, end });
9473
+ const assembly = self.apolloDataStore.assemblies.get(assemblyName);
9474
+ if (assembly &&
9475
+ assembly.backendDriverType === 'CollaborationServerDriver') {
9476
+ locations.push({ assemblyName, refName, start, end });
9477
+ }
9462
9478
  }
9463
9479
  });
9464
9480
  }
@@ -9514,7 +9530,11 @@ function extendSession(pluginManager, sessionModel) {
9514
9530
  dynamicBlocks.forEach((block) => {
9515
9531
  if (block.regionNumber !== undefined) {
9516
9532
  const { assemblyName, end, refName, start } = block;
9517
- locations.push({ assemblyName, refName, start, end });
9533
+ const assembly = self.apolloDataStore.assemblies.get(assemblyName);
9534
+ if (assembly &&
9535
+ assembly.backendDriverType === 'CollaborationServerDriver') {
9536
+ locations.push({ assemblyName, refName, start, end });
9537
+ }
9518
9538
  }
9519
9539
  });
9520
9540
  }
@@ -9577,6 +9597,7 @@ function extendSession(pluginManager, sessionModel) {
9577
9597
  continue;
9578
9598
  }
9579
9599
  applySnapshot(jbrowse, jbrowseConfig);
9600
+ // @ts-expect-error snapshot seems to get wrong type?
9580
9601
  applySnapshot(self, sessionSnapshot);
9581
9602
  }
9582
9603
  }),
@@ -9688,7 +9709,7 @@ function extendSession(pluginManager, sessionModel) {
9688
9709
  };
9689
9710
  });
9690
9711
  return types.snapshotProcessor(sm, {
9691
- postProcessor(snap) {
9712
+ postProcessor(snap, node) {
9692
9713
  snap.apolloSelectedFeature = undefined;
9693
9714
  const assemblies = Object.fromEntries(Object.entries(snap.apolloDataStore.assemblies).filter(([, assembly]) => assembly.backendDriverType === 'InMemoryFileDriver'));
9694
9715
  // @ts-expect-error ontologyManager isn't actually required
@@ -9697,6 +9718,21 @@ function extendSession(pluginManager, sessionModel) {
9697
9718
  assemblies,
9698
9719
  checkResults: {},
9699
9720
  };
9721
+ if (!node) {
9722
+ return snap;
9723
+ }
9724
+ const { apolloDataStore } = node;
9725
+ const { checkResults } = apolloDataStore;
9726
+ for (const [, cr] of checkResults) {
9727
+ const [feature] = cr.ids;
9728
+ if (!feature) {
9729
+ continue;
9730
+ }
9731
+ const assembly = apolloDataStore.assemblies.get(feature.assemblyId);
9732
+ if (assembly && assembly.backendDriverType === 'InMemoryFileDriver') {
9733
+ snap.apolloDataStore.checkResults[cr._id] = getSnapshot(cr);
9734
+ }
9735
+ }
9700
9736
  return snap;
9701
9737
  },
9702
9738
  });