Skip to content

Commit

Permalink
Rm
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Sep 5, 2024
1 parent 8ca799b commit 880efb8
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 390 deletions.
65 changes: 0 additions & 65 deletions packages/core/assemblyManager/loadRefNameMap.ts

This file was deleted.

70 changes: 0 additions & 70 deletions packages/core/assemblyManager/util.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const SaveTrackDataDialog = observer(function ({
visibleRegions?: Region[]
}
const session = getSession(model)
if (!features || !visibleRegions) {
if (!features || !visibleRegions?.length || !type) {
return
}
const generator = options[type] || {
Expand All @@ -110,7 +110,7 @@ const SaveTrackDataDialog = observer(function ({
await generator.callback({
features,
session,
assemblyName: visibleRegions[0].assemblyName,
assemblyName: visibleRegions[0]!.assemblyName,
}),
)
} catch (e) {
Expand All @@ -130,7 +130,12 @@ const SaveTrackDataDialog = observer(function ({

<FormControl>
<FormLabel>File type</FormLabel>
<RadioGroup value={type} onChange={e => setType(e.target.value)}>
<RadioGroup
value={type}
onChange={e => {
setType(e.target.value)
}}
>
{Object.entries(options).map(([key, val]) => (
<FormControlLabel
key={key}
Expand Down Expand Up @@ -165,7 +170,10 @@ const SaveTrackDataDialog = observer(function ({
<DialogActions>
<Button
onClick={() => {
const ext = options[type].extension
if (!type) {
return
}
const ext = options[type]?.extension || 'unknown'
const blob = new Blob([str], { type: 'text/plain;charset=utf-8' })
saveAs(blob, `jbrowse_track_data.${ext}`)
}}
Expand All @@ -174,7 +182,13 @@ const SaveTrackDataDialog = observer(function ({
Download
</Button>

<Button variant="contained" type="submit" onClick={() => handleClose()}>
<Button
variant="contained"
type="submit"
onClick={() => {
handleClose()
}}
>
Close
</Button>
</DialogActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ function formatTags(f: Feature, parentId?: string, parentType?: string) {
...f
.tags()
.filter(tag => !coreFields.has(tag))
.map(tag => [tag, fmt(f.get(tag))])
.map(tag => [tag, fmt(f.get(tag))] as const)
.filter(tag => !!tag[1] && tag[0] !== parentType)
.map(tag => `${blank}/${retitle[tag[0]] || tag[0]}="${tag[1]}"`),
].filter(f => !!f)
}

function rs(f: Feature, min: number) {
function relativeStart(f: Feature, min: number) {
return f.get('start') - min + 1
}
function re(f: Feature, min: number) {
function relativeEnd(f: Feature, min: number) {
return f.get('end') - min
}
function loc(f: Feature, min: number) {
return `${rs(f, min)}..${re(f, min)}`
return `${relativeStart(f, min)}..${relativeEnd(f, min)}`
}
function formatFeat(
f: Feature,
Expand Down Expand Up @@ -123,6 +123,9 @@ export async function stringifyGBK({
session: AbstractSessionModel
features: Feature[]
}) {
if (!features.length) {
return ''
}
const today = new Date()
const month = today.toLocaleString('en-US', { month: 'short' }).toUpperCase()
const day = today.toLocaleString('en-US', { day: 'numeric' })
Expand All @@ -132,15 +135,15 @@ export async function stringifyGBK({
const start = min(features.map(f => f.get('start')))
const end = max(features.map(f => f.get('end')))
const length = end - start
const refName = features[0].get('refName')
const refName = features[0]!.get('refName') || ''

const l1 = [
`${'LOCUS'.padEnd(12)}`,
'LOCUS'.padEnd(12),
`${refName}:${start + 1}..${end}`.padEnd(20),
` ${`${length} bp`}`.padEnd(15),
` ${length} bp`.padEnd(15),
` ${'DNA'.padEnd(10)}`,
`${'linear'.padEnd(10)}`,
`${'UNK ' + date}`,
'linear'.padEnd(10),
`UNK ${date}`,
].join('')
const l2 = 'FEATURES Location/Qualifiers'
const seq = await fetchSequence({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function formatFeat(f: Feature, parentId?: string, parentRef?: string) {
f
.tags()
.filter(tag => !coreFields.has(tag))
.map(tag => [tag, fmt(f.get(tag))])
.map(tag => [tag, fmt(f.get(tag))] as const)
.filter(tag => !!tag[1])
.map(tag => `${retitle[tag[0]] || tag[0]}=${tag[1]}`)
.join(';'),
Expand Down
2 changes: 1 addition & 1 deletion packages/core/rpc/methods/CoreGetRegions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class CoreGetRegions extends RpcMethodType {
args: {
sessionId: string
signal: RemoteAbortSignal
adapterConfig: {}
adapterConfig: Record<string, unknown>
},
rpcDriver: string,
) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/rpc/methods/CoreSaveFeatureData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ export default class CoreGetFeatures extends RpcMethodType {
args: {
sessionId: string
regions: Region[]
adapterConfig: {}
adapterConfig: Record<string, unknown>
signal?: RemoteAbortSignal
// eslint-disable-next-line @typescript-eslint/no-explicit-any

opts?: any
},
rpcDriver: string,
Expand Down
Loading

0 comments on commit 880efb8

Please sign in to comment.