Skip to content

Commit

Permalink
Merge origin/main
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 19, 2024
2 parents 15883e9 + 9a83551 commit d613e37
Show file tree
Hide file tree
Showing 171 changed files with 3,215 additions and 2,992 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,52 @@
yarn run v1.22.22 $ lerna-changelog --silent --silent --next-version 2.17.0

## 2.17.0 (2024-11-18)

#### :rocket: Enhancement

- `core`
- [#4662](https://github.com/GMOD/jbrowse-components/pull/4662) Add better
handling for bedMethyl files ([@cmdcolin](https://github.com/cmdcolin))
- [#4652](https://github.com/GMOD/jbrowse-components/pull/4652) Reduce
re-rendering on quantitative and snpcoverage track height adjustments
([@cmdcolin](https://github.com/cmdcolin))
- [#4651](https://github.com/GMOD/jbrowse-components/pull/4651) Add mismatches
cache to improve performance on ultra-long reads
([@cmdcolin](https://github.com/cmdcolin))
- Other
- [#4649](https://github.com/GMOD/jbrowse-components/pull/4649) Add support
for displaying SNPs in "no_ref" CRAM files
([@cmdcolin](https://github.com/cmdcolin))
- [#4627](https://github.com/GMOD/jbrowse-components/pull/4627) Create BLAST
tabular adapter ([@garrettjstevens](https://github.com/garrettjstevens))

#### :bug: Bug Fix

- Other
- [#4647](https://github.com/GMOD/jbrowse-components/pull/4647) Improved
rendering of modifications ([@cmdcolin](https://github.com/cmdcolin))
- [#4646](https://github.com/GMOD/jbrowse-components/pull/4646) Fix mouseover
pixelation on linear synteny view ([@cmdcolin](https://github.com/cmdcolin))
- `core`
- [#4639](https://github.com/GMOD/jbrowse-components/pull/4639) Fix RNA-seq
stranded arc coloring, change the color of RNA-seq introns, and improve
compact rendering ([@cmdcolin](https://github.com/cmdcolin))
- [#4638](https://github.com/GMOD/jbrowse-components/pull/4638) Fix rendering
of UCSC repeatmasker BigBed and BED files
([@cmdcolin](https://github.com/cmdcolin))

#### :house: Internal

- `core`
- [#4648](https://github.com/GMOD/jbrowse-components/pull/4648) Run codemod
fix for some MUI deprecated props ([@cmdcolin](https://github.com/cmdcolin))

#### Committers: 2

- Colin Diesh ([@cmdcolin](https://github.com/cmdcolin))
- Garrett Stevens ([@garrettjstevens](https://github.com/garrettjstevens)) Done
in 1.81s.

yarn run v1.22.22 $ lerna-changelog --silent --silent --next-version 2.16.1

## 2.16.1 (2024-11-03)
Expand Down
2 changes: 2 additions & 0 deletions config/jest/url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
URL.createObjectURL = () => `${Math.random()}`
URL.revokeObjectURL = () => {}
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export default tseslint.config(
'unicorn/prefer-at': 'off',
'unicorn/prefer-string-replace-all': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/expiring-todo-comments': 'off',

'@typescript-eslint/no-deprecated': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.16.1",
"version": "2.17.0",
"npmClient": "yarn",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
4 changes: 2 additions & 2 deletions packages/app-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jbrowse/app-core",
"version": "2.16.1",
"version": "2.17.0",
"description": "JBrowse 2 code shared between the 'full featured' apps e.g. jbrowse-web and jbrowse-desktop",
"keywords": [
"jbrowse",
Expand Down Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@babel/runtime": "^7.16.3",
"@jbrowse/product-core": "^2.16.1",
"@jbrowse/product-core": "^2.17.0",
"@mui/icons-material": "^6.0.0",
"@mui/material": "^6.0.0",
"copy-to-clipboard": "^3.3.1"
Expand Down
53 changes: 34 additions & 19 deletions packages/core/assemblyManager/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ async function loadRefNameMap(
assembly: Assembly,
adapterConfig: unknown,
options: BaseOptions,
signal?: AbortSignal,
stopToken?: string,
) {
const { sessionId } = options
await when(() => !!(assembly.regions && assembly.refNameAliases), {
signal,
name: 'when assembly ready',
})

Expand All @@ -71,7 +70,7 @@ async function loadRefNameMap(
'CoreGetRefNames',
{
adapterConfig,
signal,
stopToken,
...options,
},
{ timeout: 1000000 },
Expand Down Expand Up @@ -139,18 +138,14 @@ export default function assemblyFactory(
cache: new QuickLRU({ maxSize: 1000 }),

// @ts-expect-error
// TODO:ABORT (possible? desirable??)
async fill(
args: CacheData,
signal?: AbortSignal,
_stopToken?: string,
statusCallback?: (arg: string) => void,
) {
const { adapterConf, self, options } = args
return loadRefNameMap(
self,
adapterConf,
{ ...options, statusCallback },
signal,
)
return loadRefNameMap(self, adapterConf, { ...options, statusCallback })
},
})
return types
Expand All @@ -161,11 +156,29 @@ export default function assemblyFactory(
configuration: types.safeReference(assemblyConfigType),
})
.volatile(() => ({
/**
* #volatile
*/
error: undefined as unknown,
/**
* #volatile
*/
loadingP: undefined as Promise<void> | undefined,
/**
* #volatile
*/
volatileRegions: undefined as BasicRegion[] | undefined,
/**
* #volatile
*/
refNameAliases: undefined as RefNameAliases | undefined,
/**
* #volatile
*/
lowerCaseRefNameAliases: undefined as RefNameAliases | undefined,
/**
* #volatile
*/
cytobands: undefined as Feature[] | undefined,
}))
.views(self => ({
Expand All @@ -179,6 +192,8 @@ export default function assemblyFactory(
.views(self => ({
/**
* #getter
* this is a getter with a side effect of loading the data. not the best
* practice, but it helps to lazy load the assembly
*/
get initialized() {
// @ts-expect-error
Expand Down Expand Up @@ -216,7 +231,7 @@ export default function assemblyFactory(
return self.getConf('displayName')
},
/**
* #getter
* #method
*/
hasName(name: string) {
return this.allAliases.includes(name)
Expand Down Expand Up @@ -453,7 +468,7 @@ export default function assemblyFactory(
* #method
*/
getAdapterMapEntry(adapterConf: AdapterConf, options: BaseOptions) {
const { signal, statusCallback, ...rest } = options
const { stopToken, statusCallback, ...rest } = options
if (!options.sessionId) {
throw new Error('sessionId is required')
}
Expand All @@ -465,7 +480,7 @@ export default function assemblyFactory(
options: rest,
} as CacheData,

// signal intentionally not passed here, fixes issues like #2221.
// stopToken intentionally not passed here, fixes issues like #2221.
// alternative fix #2540 was proposed but non-working currently
undefined,
statusCallback,
Expand Down Expand Up @@ -504,11 +519,11 @@ export default function assemblyFactory(
async function getRefNameAliases({
config,
pluginManager,
signal,
stopToken,
}: {
config: AnyConfigurationModel
pluginManager: PluginManager
signal?: AbortSignal
stopToken?: string
}) {
const type = pluginManager.getAdapterType(config.type)!
const CLASS = await type.getAdapterClass()
Expand All @@ -517,7 +532,7 @@ async function getRefNameAliases({
undefined,
pluginManager,
) as BaseRefNameAliasAdapter
return adapter.getRefNameAliases({ signal })
return adapter.getRefNameAliases({ stopToken })
}

async function getCytobands({
Expand All @@ -538,16 +553,16 @@ async function getCytobands({
async function getAssemblyRegions({
config,
pluginManager,
signal,
stopToken,
}: {
config: AnyConfigurationModel
pluginManager: PluginManager
signal?: AbortSignal
stopToken?: string
}) {
const type = pluginManager.getAdapterType(config.type)!
const CLASS = await type.getAdapterClass()
const adapter = new CLASS(config, undefined, pluginManager) as RegionsAdapter
return adapter.getRegions({ signal })
return adapter.getRegions({ stopToken })
}

export type AssemblyModel = ReturnType<typeof assemblyFactory>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/assemblyManager/assemblyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function assemblyManagerFactory(conf: IAnyType, pm: PluginManager) {
async getRefNameMapForAdapter(
adapterConf: AdapterConf,
assemblyName: string | undefined,
opts: { signal?: AbortSignal; sessionId: string },
opts: { stopToken?: string; sessionId: string },
) {
if (assemblyName) {
const asm = await this.waitForAssembly(assemblyName)
Expand All @@ -136,7 +136,7 @@ function assemblyManagerFactory(conf: IAnyType, pm: PluginManager) {
async getReverseRefNameMapForAdapter(
adapterConf: AdapterConf,
assemblyName: string | undefined,
opts: { signal?: AbortSignal; sessionId: string },
opts: { stopToken?: string; sessionId: string },
) {
if (assemblyName) {
const asm = await this.waitForAssembly(assemblyName)
Expand Down
20 changes: 18 additions & 2 deletions packages/core/data_adapters/BaseAdapter/BaseFeatureDataAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { BaseAdapter } from './BaseAdapter'
import { BaseOptions } from './BaseOptions'
import { FeatureDensityStats } from './types'
import { ObservableCreate } from '../../util/rxjs'
import { checkAbortSignal, sum, max, min } from '../../util'
import { sum, max, min } from '../../util'
import { Feature } from '../../util/simpleFeature'
import { AugmentedRegion as Region } from '../../util/types'
import { blankStats, rectifyStats, scoresToStats } from '../../util/stats'
import { checkStopToken } from '../../util/stopToken'

/**
* Base class for feature adapters to extend. Defines some methods that
Expand Down Expand Up @@ -82,7 +83,7 @@ export abstract class BaseFeatureDataAdapter extends BaseAdapter {
public getFeaturesInRegion(region: Region, opts: BaseOptions = {}) {
return ObservableCreate<Feature>(async observer => {
const hasData = await this.hasDataForRefName(region.refName, opts)
checkAbortSignal(opts.signal)
checkStopToken(opts.stopToken)
if (!hasData) {
observer.complete()
} else {
Expand Down Expand Up @@ -253,4 +254,19 @@ export abstract class BaseFeatureDataAdapter extends BaseAdapter {
}
return this.getRegionFeatureDensityStats(regions[0]!, opts)
}

async getSources(
regions: Region[],
): Promise<{ name: string; color?: string; [key: string]: unknown }[]> {
const features = await firstValueFrom(
this.getFeaturesInMultipleRegions(regions).pipe(toArray()),
)
const sources = new Set<string>()
for (const f of features) {
sources.add(f.get('source'))
}
return [...sources].map(source => ({
name: source,
}))
}
}
4 changes: 2 additions & 2 deletions packages/core/data_adapters/BaseAdapter/BaseOptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface BaseOptions {
signal?: AbortSignal
stopToken?: string
bpPerPx?: number
sessionId?: string
statusCallback?: (message: string) => void
Expand All @@ -12,7 +12,7 @@ export type SearchType = 'full' | 'prefix' | 'exact'
export interface BaseTextSearchArgs {
queryString: string
searchType?: SearchType
signal?: AbortSignal
stopToken?: string
limit?: number
pageNumber?: number
}
4 changes: 2 additions & 2 deletions packages/core/data_adapters/BaseAdapter/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface BaseOptions {
signal?: AbortSignal
stopToken?: string
bpPerPx?: number
sessionId?: string
statusCallback?: (message: string) => void
Expand All @@ -12,7 +12,7 @@ export type SearchType = 'full' | 'prefix' | 'exact'
export interface BaseTextSearchArgs {
queryString: string
searchType?: SearchType
signal?: AbortSignal
stopToken?: string
limit?: number
pageNumber?: number
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jbrowse/core",
"version": "2.16.1",
"version": "2.17.0",
"description": "JBrowse 2 core libraries used by plugins",
"keywords": [
"jbrowse",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/pluggableElementTypes/RpcMethodType.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('test serialize arguments with augmentLocationObject', async () => {
testLocation: locationInAdapter,
},
filters: [],
signal: 'teststring',
stopToken: 'teststring',
randomProperty: 'randomstring',
parentObject: {
nestedObject: {
Expand Down
28 changes: 6 additions & 22 deletions packages/core/pluggableElementTypes/RpcMethodType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ import {
UriLocation,
} from '../util/types'

import {
deserializeAbortSignal,
isRemoteAbortSignal,
RemoteAbortSignal,
} from '../rpc/remoteAbortSignals'

interface SerializedArgs {
signal?: RemoteAbortSignal
blobMap?: Record<string, File>
}
export type RpcMethodConstructor = new (pm: PluginManager) => RpcMethodType

export default abstract class RpcMethodType extends PluggableElementBase {
Expand Down Expand Up @@ -58,21 +48,15 @@ export default abstract class RpcMethodType extends PluggableElementBase {
return loc
}

async deserializeArguments<T extends SerializedArgs>(
serializedArgs: T,
async deserializeArguments<T>(
args: T & { blobMap?: Record<string, File> },
_rpcDriverClassName: string,
) {
if (serializedArgs.blobMap) {
setBlobMap(serializedArgs.blobMap)
): Promise<T> {
if (args.blobMap) {
setBlobMap(args.blobMap)
}
const { signal } = serializedArgs

return {
...serializedArgs,
signal: isRemoteAbortSignal(signal)
? deserializeAbortSignal(signal)
: undefined,
}
return args
}

abstract execute(
Expand Down
Loading

0 comments on commit d613e37

Please sign in to comment.