Skip to content

Commit

Permalink
Use noAssemblyManager flag on config
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Feb 13, 2021
1 parent 520b3e3 commit 1883cc1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
9 changes: 7 additions & 2 deletions packages/core/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,14 +760,19 @@ export async function renameRegionsIfNeeded<
...args,
regions: [...(args.regions || [])],
}
if (assemblyName && adapterConfig.type !== 'FromConfigSequenceAdapter') {

// configs can choose to not be associated with the assemblyManager (as with
// the "read assembly" in the read vs ref comparisons) and in this case a
// special flag exists (currently set on the FromConfigSequenceAdapter)
// called noAssemblyManager
// @ts-ignore
if (assemblyName && !adapterConfig.noAssemblyManager) {
const refNameMap = await assemblyManager.getRefNameMapForAdapter(
adapterConfig,
assemblyName,
newArgs,
)

// console.log(`${JSON.stringify(regions)} ${JSON.stringify(refNameMap)}`)
if (refNameMap && regions && newArgs.regions) {
for (let i = 0; i < regions.length; i += 1) {
newArgs.regions[i] = renameRegionIfNeeded(refNameMap, regions[i])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class FromSequenceConfigAdapter extends FromConfigAdapter {
.toPromise()
// return ObservableCreate<Feature>(async observer => {
// const feats = await super.getFeatures(region).pipe(toArray()).toPromise()

feats.forEach(feat => {
const featStart = feat.get('start')
const seqStart = start - featStart
Expand All @@ -32,9 +33,10 @@ export default class FromSequenceConfigAdapter extends FromConfigAdapter {
observer.next(
new SimpleFeature({
...feat.toJSON(),
seq,
end: region.end,
start: region.start,
seq,
uniqueId: `${Math.random()}`,
}),
)
})
Expand Down
8 changes: 8 additions & 0 deletions plugins/config/src/FromConfigAdapter/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ export const sequenceConfigSchema = ConfigurationSchema(
type: 'string',
defaultValue: 'SimpleFeature',
},

// occasionally assemblies may not be associated with the assemblyManager
// e.g. in the case of the "read assembly" that is used in read vs ref
// visualizations
noAssemblyManager: {
type: 'boolean',
defaultValue: false,
},
},
{ explicitlyTyped: true },
)
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ export default function stateModelFactory(pluginManager: PluginManager) {
pluginManager.pluggableConfigSchemaType('track'),
),

// this represents assemblies in the specialized
// read vs ref dotplot view
// this represents assemblies in the specialized read vs ref dotplot
// view. note that this was a types.frozen but is turned into an actual
// assembly type because we need to be able to use resolveIdentifier to
// resolve the sequence track inside the assembly
viewAssemblyConfigs: types.array(assemblyConfigSchemasType),
}),
)
Expand Down
1 change: 1 addition & 0 deletions plugins/linear-comparative-view/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ function WindowSizeDlg(props: {
assemblyNames: [readAssembly],
adapter: {
type: 'FromConfigSequenceAdapter',
noAssemblyManager: true,
features: [
{
start: 0,
Expand Down

0 comments on commit 1883cc1

Please sign in to comment.