-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit c4e16eb.
- Loading branch information
Showing
14 changed files
with
214 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
plugins/variants/src/VariantRPC/MultiVariantGetSimplifiedFeatures.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache' | ||
import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType' | ||
import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain' | ||
import { renameRegionsIfNeeded } from '@jbrowse/core/util' | ||
|
||
import type { AnyConfigurationModel } from '@jbrowse/core/configuration' | ||
import type { RenderArgs } from '@jbrowse/core/rpc/coreRpcMethods' | ||
import type { Region } from '@jbrowse/core/util' | ||
import { toArray } from 'rxjs' | ||
|
||
export class MultiVariantGetSimplifiedFeatures extends RpcMethodType { | ||
name = 'MultiVariantGetSimplifiedFeatures' | ||
|
||
async deserializeArguments(args: any, rpcDriverClassName: string) { | ||
const l = await super.deserializeArguments(args, rpcDriverClassName) | ||
return { | ||
...l, | ||
filters: args.filters | ||
? new SerializableFilterChain({ | ||
filters: args.filters, | ||
}) | ||
: undefined, | ||
} | ||
} | ||
|
||
async serializeArguments( | ||
args: RenderArgs & { | ||
stopToken?: string | ||
statusCallback?: (arg: string) => void | ||
}, | ||
rpcDriverClassName: string, | ||
) { | ||
const pm = this.pluginManager | ||
const assemblyManager = pm.rootModel?.session?.assemblyManager | ||
if (!assemblyManager) { | ||
return args | ||
} | ||
|
||
const renamedArgs = await renameRegionsIfNeeded(assemblyManager, { | ||
...args, | ||
filters: args.filters?.toJSON().filters, | ||
}) | ||
|
||
return super.serializeArguments(renamedArgs, rpcDriverClassName) | ||
} | ||
|
||
async execute( | ||
args: { | ||
adapterConfig: AnyConfigurationModel | ||
stopToken?: string | ||
sessionId: string | ||
headers?: Record<string, string> | ||
regions: Region[] | ||
bpPerPx: number | ||
}, | ||
rpcDriverClassName: string, | ||
) { | ||
const pm = this.pluginManager | ||
const deserializedArgs = await this.deserializeArguments( | ||
args, | ||
rpcDriverClassName, | ||
) | ||
const { regions, adapterConfig, sessionId } = deserializedArgs | ||
const { dataAdapter } = await getAdapter(pm, sessionId, adapterConfig) | ||
|
||
// @ts-expect-error | ||
const feats = await firstValuFrom( | ||
dataAdapter.getFeatures(regions, deserializedArgs).pipe(toArray()), | ||
) | ||
return feats.map(f => ({ | ||
start: f.get('start'), | ||
end: f.get('end'), | ||
refName: f.get('refName'), | ||
})) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.