Skip to content
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

Fix issue where --load inPlace and --force can sometimes remove file unexpectedly #4086

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/BaseFeatureWidget/BaseFeatureDetail/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ export function accessNested(arr: string[], obj: Record<string, unknown> = {}) {
return typeof obj2 === 'string'
? obj2
: isObject(obj2) && typeof obj2?.Description === 'string'
? obj2.Description
: undefined
? obj2.Description
: undefined
}
4 changes: 2 additions & 2 deletions packages/core/PluginLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export default class PluginLoader {
'url' in def
? new URL(def.url, baseUri)
: 'umdUrl' in def
? new URL(def.umdUrl, baseUri)
: new URL(def.umdLoc.uri, def.umdLoc.baseUri)
? new URL(def.umdUrl, baseUri)
: new URL(def.umdLoc.uri, def.umdLoc.baseUri)

if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
throw new Error(
Expand Down
28 changes: 14 additions & 14 deletions packages/core/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ export type GetOptions<SCHEMA> = SCHEMA extends ConfigurationSchemaType<
export type GetBase<SCHEMA> = SCHEMA extends undefined
? never
: GetOptions<SCHEMA> extends ConfigurationSchemaOptions<undefined, any>
? undefined
: GetOptions<SCHEMA> extends ConfigurationSchemaOptions<
infer BASE extends AnyConfigurationSchemaType,
any
>
? BASE
: never
? undefined
: GetOptions<SCHEMA> extends ConfigurationSchemaOptions<
infer BASE extends AnyConfigurationSchemaType,
any
>
? BASE
: never

export type GetExplicitIdentifier<SCHEMA> =
GetOptions<SCHEMA> extends ConfigurationSchemaOptions<
Expand All @@ -48,13 +48,13 @@ export type ConfigurationSchemaForModel<MODEL> = MODEL extends IStateTreeNode<
export type ConfigurationSlotName<SCHEMA> = SCHEMA extends undefined
? never
: SCHEMA extends ConfigurationSchemaType<infer D, any>
?
| (keyof D & string)
| GetExplicitIdentifier<SCHEMA>
| (GetBase<SCHEMA> extends ConfigurationSchemaType<any, any>
? ConfigurationSlotName<GetBase<SCHEMA>>
: never)
: never
?
| (keyof D & string)
| GetExplicitIdentifier<SCHEMA>
| (GetBase<SCHEMA> extends ConfigurationSchemaType<any, any>
? ConfigurationSlotName<GetBase<SCHEMA>>
: never)
: never

export type AnyConfigurationSchemaType = ConfigurationSchemaType<any, any>
export type AnyConfigurationModel = Instance<AnyConfigurationSchemaType>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ui/react-colorful.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ const i = (e, r = 0, t = 1) => (e > t ? t : e < r ? r : e),
? a === e
? (r - t) / l
: a === r
? 2 + (t - e) / l
: 4 + (e - r) / l
? 2 + (t - e) / l
: 4 + (e - r) / l
: 0
return {
h: b(60 * (n < 0 ? n + 6 : n)),
Expand Down
4 changes: 2 additions & 2 deletions packages/core/util/simpleFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export default class SimpleFeature implements Feature {
return name === 'subfeatures'
? this.subfeatures
: name === 'parent'
? this.parent()
: this.data[name]
? this.parent()
: this.data[name]
}

/**
Expand Down
4 changes: 2 additions & 2 deletions plugins/dotplot-view/src/DotplotRenderer/DotplotRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ export default class DotplotRenderer extends ComparativeRenderer {
r = isCallback
? readConfObject(config, 'color', { feature })
: color === '#f0f'
? t.palette.text.primary
: color
? t.palette.text.primary
: color
}
ctx.fillStyle = r
ctx.strokeStyle = r
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ const OverviewBox = observer(function ({
canDisplayCytobands
? undefined
: reversed
? classes.scalebarContigReverse
: classes.scalebarContigForward,
? classes.scalebarContigReverse
: classes.scalebarContigForward,
!canDisplayCytobands ? classes.scalebarBorder : undefined,
)}
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ function Translation(props: {
defaultStarts.includes(codon)
? theme?.palette.startCodon
: defaultStops.includes(codon)
? theme?.palette.stopCodon
: map[Math.abs(frame)]
? theme?.palette.stopCodon
: map[Math.abs(frame)]
}
/>
{render ? (
Expand Down
4 changes: 2 additions & 2 deletions plugins/svg/src/SvgFeatureRenderer/components/Arrow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const Arrow = observer(function ({
strand * reverseFlip === -1
? left
: strand * reverseFlip === 1
? left + width
: null
? left + width
: null
const y = top + height / 2

return p ? (
Expand Down
8 changes: 4 additions & 4 deletions plugins/wiggle/src/drawXY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export function drawXY(
const effectiveC = crossingOrigin
? c
: c === lastCol
? lastMix
: (lastMix = lighten(colord(c), 0.4).toHex())
? lastMix
: (lastMix = lighten(colord(c), 0.4).toHex())
fillRectCtx(leftPx, toY(max), w, getHeight(max), ctx, effectiveC)
lastCol = c
}
Expand Down Expand Up @@ -141,8 +141,8 @@ export function drawXY(
const effectiveC = crossingOrigin
? c
: c === lastCol
? lastMix
: (lastMix = darken(colord(c), 0.4).toHex())
? lastMix
: (lastMix = darken(colord(c), 0.4).toHex())

fillRectCtx(leftPx, toY(min), w, getHeight(min), ctx, effectiveC)
lastCol = c
Expand Down
123 changes: 62 additions & 61 deletions products/jbrowse-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ FLAGS
-h, --help Show CLI help.
-n, --name=<value> Name of the connection. Defaults to connectionId if not provided
-t, --type=<value> type of connection, ex. JBrowse1Connection, UCSCTrackHubConnection, custom
--connectionId=<value> Id for the connection that must be unique to JBrowse. Defaults to
--connectionId=<value> Id for the connection that must be unique to JBrowse. Defaults to
'connectionType-assemblyName-currentTime'
--out=<value> synonym for target
--overwrite Overwrites any existing connections if same connection id
--skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
--out=<value> synonym for target
--overwrite Overwrites any existing connections if same connection id
--skipCheck Don't check whether or not the data directory URL exists or if you are in a JBrowse
directory
--target=<value> path to config file in JB2 installation directory to write out to.
--target=<value> path to config file in JB2 installation directory to write out to.

DESCRIPTION
Add a connection to a JBrowse 2 configuration
Expand Down Expand Up @@ -282,18 +282,18 @@ FLAGS
<options: copy|symlink|move|inPlace>
-n, --name=<value> Name of the track. Will be defaulted to the trackId if none specified
-t, --trackType=<value> Type of track, by default inferred from track file
--bed1=<value> Used only for mcscan anchors/simpleAnchors types
--bed2=<value> Used only for mcscan anchors/simpleAnchors types
--category=<value> Optional Comma separated string of categories to group tracks
--config=<value> Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'
--indexFile=<value> Optional index file for the track
--out=<value> synonym for target
--overwrite Overwrites existing track if it shares the same trackId
--protocol=<value> [default: uri] Force protocol to a specific value
--skipCheck Skip check for whether or not the file or URL exists or if you are in a JBrowse directory
--subDir=<value> when using --load a file, output to a subdirectory of the target dir
--target=<value> path to config file in JB2 installation to write out to.
--trackId=<value> trackId for the track, by default inferred from filename, must be unique throughout
--bed1=<value> Used only for mcscan anchors/simpleAnchors types
--bed2=<value> Used only for mcscan anchors/simpleAnchors types
--category=<value> Optional Comma separated string of categories to group tracks
--config=<value> Any extra config settings to add to a track. i.e '{"defaultRendering": "density"}'
--indexFile=<value> Optional index file for the track
--out=<value> synonym for target
--overwrite Overwrites existing track if it shares the same trackId
--protocol=<value> [default: uri] Force protocol to a specific value
--skipCheck Skip check for whether or not the file or URL exists or if you are in a JBrowse directory
--subDir=<value> when using --load a file, output to a subdirectory of the target dir
--target=<value> path to config file in JB2 installation to write out to.
--trackId=<value> trackId for the track, by default inferred from filename, must be unique throughout
config

DESCRIPTION
Expand Down Expand Up @@ -351,10 +351,10 @@ ARGUMENTS
TRACK track JSON file or command line arg blob

FLAGS
-u, --update update the contents of an existing track, matched based on trackId
--out=<value> synonym for target
--target=<value> path to config file in JB2 installation directory to write out to.
Creates ./config.json if nonexistent
-u, --update update the contents of an existing track, matched based on trackId
--out=<value> synonym for target
--target=<value> path to config file in JB2 installation directory to write out to.
Creates ./config.json if nonexistent

DESCRIPTION
Add a track configuration directly from a JSON hunk to the JBrowse 2 configuration
Expand All @@ -377,15 +377,16 @@ USAGE
$ jbrowse admin-server [-p <value>] [--root <value>] [--bodySizeLimit <value>] [-h]

FLAGS
-h, --help Show CLI help.
-p, --port=<value> Specifified port to start the server on;
Default is 9090.
--bodySizeLimit=<value> [default: 25mb] Size limit of the update message; may need to increase if config is large.
Argument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.
--root=<value> path to the root of the JB2 installation.
Creates ./config.json if nonexistent. note that you can navigate to
?config=path/to/subconfig.json in the web browser and it will write to
rootDir/path/to/subconfig.json
-h, --help Show CLI help.
-p, --port=<value> Specifified port to start the server on;
Default is 9090.
--bodySizeLimit=<value> [default: 25mb] Size limit of the update message; may need to increase if config is
large.
Argument is passed to bytes library for parsing: https://www.npmjs.com/package/bytes.
--root=<value> path to the root of the JB2 installation.
Creates ./config.json if nonexistent. note that you can navigate to
?config=path/to/subconfig.json in the web browser and it will write to
rootDir/path/to/subconfig.json

DESCRIPTION
Start up a small admin server for JBrowse configuration
Expand All @@ -411,14 +412,14 @@ ARGUMENTS
LOCALPATH Location where JBrowse 2 will be installed

FLAGS
-f, --force Overwrites existing JBrowse 2 installation if present in path
-h, --help Show CLI help.
-l, --listVersions Lists out all versions of JBrowse 2
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
Defaults to latest
-u, --url=<value> A direct URL to a JBrowse 2 release
--branch=<value> Download a development build from a named git branch
--nightly Download the latest development build from the main branch
-f, --force Overwrites existing JBrowse 2 installation if present in path
-h, --help Show CLI help.
-l, --listVersions Lists out all versions of JBrowse 2
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
Defaults to latest
-u, --url=<value> A direct URL to a JBrowse 2 release
--branch=<value> Download a development build from a named git branch
--nightly Download the latest development build from the main branch

DESCRIPTION
Downloads and installs the latest JBrowse 2 release
Expand Down Expand Up @@ -523,10 +524,10 @@ FLAGS
-v, --view=<value> View type in config to be added as default session, i.e LinearGenomeView, CircularView,
DotplotView.
Must be provided if no default session file provided
--delete Delete any existing default session.
--out=<value> synonym for target
--target=<value> path to config file in JB2 installation directory to write out to
--viewId=<value> Identifier for the view. Will be generated on default
--delete Delete any existing default session.
--out=<value> synonym for target
--target=<value> path to config file in JB2 installation directory to write out to
--viewId=<value> Identifier for the view. Will be generated on default

DESCRIPTION
Set a default session with views and tracks
Expand Down Expand Up @@ -587,20 +588,20 @@ FLAGS
assembly in the config
-h, --help Show CLI help.
-q, --quiet Hide the progress bars
--attributes=<value> [default: Name,ID] Comma separated list of attributes to index
--dryrun Just print out tracks that will be indexed by the process, without doing any indexing
--exclude=<value> [default: CDS,exon] Adds gene type to list of excluded types
--file=<value>... File or files to index (can be used to create trix indexes for embedded component use cases
--attributes=<value> [default: Name,ID] Comma separated list of attributes to index
--dryrun Just print out tracks that will be indexed by the process, without doing any indexing
--exclude=<value> [default: CDS,exon] Adds gene type to list of excluded types
--file=<value>... File or files to index (can be used to create trix indexes for embedded component use cases
not using a config.json for example)
--fileId=<value>... Set the trackId used for the indexes generated with the --file argument
--force Overwrite previously existing indexes
--out=<value> Synonym for target
--perTrack If set, creates an index per track
--prefixSize=<value> Specify the prefix size for the ixx index. We attempt to automatically calculate this, but
--fileId=<value>... Set the trackId used for the indexes generated with the --file argument
--force Overwrite previously existing indexes
--out=<value> Synonym for target
--perTrack If set, creates an index per track
--prefixSize=<value> Specify the prefix size for the ixx index. We attempt to automatically calculate this, but
you can manually specify this too. If many genes have similar gene IDs e.g. Z000000001,
Z000000002 the prefix size should be larger so that they get split into different bins
--target=<value> Path to config file in JB2 installation directory to read from.
--tracks=<value> Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all
--target=<value> Path to config file in JB2 installation directory to read from.
--tracks=<value> Specific tracks to index, formatted as comma separated trackIds. If unspecified, indexes all
available tracks

DESCRIPTION
Expand Down Expand Up @@ -651,14 +652,14 @@ ARGUMENTS
LOCALPATH [default: .] Location where JBrowse 2 is installed

FLAGS
-h, --help Show CLI help.
-l, --listVersions Lists out all versions of JBrowse 2
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
Defaults to latest
-u, --url=<value> A direct URL to a JBrowse 2 release
--branch=<value> Download a development build from a named git branch
--clean Removes old js,map,and LICENSE files in the installation
--nightly Download the latest development build from the main branch
-h, --help Show CLI help.
-l, --listVersions Lists out all versions of JBrowse 2
-t, --tag=<value> Version of JBrowse 2 to install. Format is v1.0.0.
Defaults to latest
-u, --url=<value> A direct URL to a JBrowse 2 release
--branch=<value> Download a development build from a named git branch
--clean Removes old js,map,and LICENSE files in the installation
--nightly Download the latest development build from the main branch

DESCRIPTION
Upgrades JBrowse 2 to latest version
Expand Down
Loading
Loading