Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 24, 2025
1 parent 6abb9a5 commit 45588a2
Show file tree
Hide file tree
Showing 30 changed files with 1,415 additions and 701 deletions.
3 changes: 1 addition & 2 deletions plugins/alignments/src/GuessAlignmentsTypes/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { testAdapter } from '@jbrowse/core/util'
import {
getFileName,
makeIndex,
Expand All @@ -9,8 +10,6 @@ import type {
AdapterGuesser,
TrackTypeGuesser,
} from '@jbrowse/core/util/tracks'
import { testAdapter } from '@jbrowse/core/util'

import type { FileLocation } from '@jbrowse/core/util/types'

export default function GuessAlignmentsTypesF(pluginManager: PluginManager) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/bed/src/GuessAdapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { testAdapter } from '@jbrowse/core/util'
import {
getFileName,
makeIndex,
makeIndexType,
} from '@jbrowse/core/util/tracks'
import { testAdapter } from '@jbrowse/core/util'

import type PluginManager from '@jbrowse/core/PluginManager'
import type {
Expand All @@ -28,7 +28,7 @@ export default function GuessAdapterF(pluginManager: PluginManager) {
) {
return {
type: 'BedpeAdapter',
bedpeAdapter: file,
bedpeLocation: file,
}
} else if (
testAdapter(fileName, /\.bb$/i, adapterHint, 'BigBedAdapter') ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function BlastTabularAdapterF(pluginManager: PluginManager) {
displayName: 'Tabular BLAST output adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () =>
import('./BlastTabularAdapter').then(r => r.default),
Expand Down
2 changes: 1 addition & 1 deletion plugins/comparative-adapters/src/ChainAdapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function ChainAdapterF(pluginManager: PluginManager) {
displayName: 'Liftover chain adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () => import('./ChainAdapter').then(r => r.default),
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useEffect, useState } from 'react'

import { AssemblySelector } from '@jbrowse/core/ui'
import { getSession } from '@jbrowse/core/util'
import { observer } from 'mobx-react'

const ComparativeAddTrackComponent = observer(function ({ model }: any) {
const session = getSession(model)
const [r0, setR0] = useState(session.assemblies[0]?.name)
const [r1, setR1] = useState(session.assemblies[0]?.name)
useEffect(() => {
model.setMixinData({
adapter: {
queryAssembly: r0,
targetAssembly: r1,
},
})
}, [model, r0, r1])
return (
<>
<AssemblySelector
session={session}
label="Query assembly"
helperText=""
selected={r0}
onChange={asm => {
setR0(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
<AssemblySelector
session={session}
label="Target assembly"
helperText=""
selected={r1}
onChange={asm => {
setR1(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
</>
)
})

export default ComparativeAddTrackComponent
Original file line number Diff line number Diff line change
@@ -1,52 +1,13 @@
import { useEffect, useState } from 'react'
import { lazy } from 'react'

import { AssemblySelector } from '@jbrowse/core/ui'
import { getSession } from '@jbrowse/core/util'
import { observer } from 'mobx-react'
import { pairwiseTypes } from '../syntenyTypes'

import type PluginManager from '@jbrowse/core/PluginManager'

const ComparativeAddTrackComponent = observer(function ({ model }: any) {
const session = getSession(model)
const [r0, setR0] = useState(session.assemblies[0]?.name)
const [r1, setR1] = useState(session.assemblies[0]?.name)
useEffect(() => {
model.setMixinData({
adapter: {
queryAssembly: r0,
targetAssembly: r1,
},
})
}, [model, r0, r1])
return (
<>
<AssemblySelector
session={session}
label="Query assembly"
helperText=""
selected={r0}
onChange={asm => {
setR0(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
<AssemblySelector
session={session}
label="Target assembly"
helperText=""
selected={r1}
onChange={asm => {
setR1(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
</>
)
})
// lazies
const ComparativeAddTrackComponent = lazy(
() => import('./ComparativeAddTrackComponent'),
)

export default function ComparativeAddTrackComponentF(
pluginManager: PluginManager,
Expand All @@ -55,7 +16,7 @@ export default function ComparativeAddTrackComponentF(
'Core-addTrackComponent',
// @ts-expect-error
(comp, { model }: { trackAdapterType: string }) => {
return model.trackAdapterType === 'PAFAdapter'
return pairwiseTypes.includes(model.trackAdapterType)
? ComparativeAddTrackComponent
: comp
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/comparative-adapters/src/DeltaAdapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function DeltaAdapterF(pluginManager: PluginManager) {
displayName: 'MUMmer delta adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () => import('./DeltaAdapter').then(r => r.default),
}),
Expand Down
47 changes: 35 additions & 12 deletions plugins/comparative-adapters/src/GuessAdapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { testAdapter } from '@jbrowse/core/util'
import {
getFileName,
makeIndex,
makeIndexType,
} from '@jbrowse/core/util/tracks'
import { testAdapter } from '@jbrowse/core/util'

import { syntenyTypes } from '../syntenyTypes'

import type PluginManager from '@jbrowse/core/PluginManager'
import type {
Expand All @@ -28,19 +30,48 @@ export default function GuessAdapterF(pluginManager: PluginManager) {
type: 'PAFAdapter',
pafLocation: file,
}
} else if (adapterHint === 'BlastTabularAdapter') {
return {
type: 'BlastTabularAdapter',
blastTableLocation: file,
}
} else if (
testAdapter(
fileName,
/\.anchors.simple(.gz)?/i,
adapterHint,
'MCScanSimpleAnchorsAdapter',
)
) {
return {
type: 'MCScanSimpleAnchorsAdapter',
mcscanSimpleAnchorsLocation: file,
}
} else if (
testAdapter(
fileName,
/\.anchors(.gz)?/i,
adapterHint,
'MCScanAnchorsAdapter',
)
) {
return {
type: 'MCScanAnchorsAdapter',
mcscanAnchorsLocation: file,
}
} else if (
testAdapter(fileName, /\.delta(.gz)?/i, adapterHint, 'DeltaAdapter')
) {
return {
type: 'DeltaAdapter',
deltaAdapter: file,
deltaLocation: file,
}
} else if (
testAdapter(fileName, /\.chain(.gz)?/i, adapterHint, 'ChainAdapter')
) {
return {
type: 'ChainAdapter',
chainAdapter: file,
chainLocation: file,
}
} else if (
testAdapter(fileName, /\.out(.gz)?/i, adapterHint, 'MashMapAdapter')
Expand Down Expand Up @@ -75,15 +106,7 @@ export default function GuessAdapterF(pluginManager: PluginManager) {
'Core-guessTrackTypeForLocation',
(trackTypeGuesser: TrackTypeGuesser) => {
return (adapterName: string) =>
[
'PAFAdapter',
'ChainAdapter',
'DeltaAdapter',
'MashMapAdapter',
'MCScanAnchorsAdapter',
'MCScanSimpleAnchorsAdapter',
'PairwiseIndexedPAFAdapter',
].includes(adapterName)
syntenyTypes.includes(adapterName)
? 'SyntenyTrack'
: trackTypeGuesser(adapterName)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { useEffect, useState } from 'react'

import { AssemblySelector, FileSelector } from '@jbrowse/core/ui'
import { getSession } from '@jbrowse/core/util'
import { Typography } from '@mui/material'
import { observer } from 'mobx-react'

import type { FileLocation } from '@jbrowse/core/util'

const MCScanAddTrackComponent = observer(function ({ model }: any) {
const session = getSession(model)
const [r0, setR0] = useState(session.assemblies[0]?.name)
const [r1, setR1] = useState(session.assemblies[0]?.name)
const [bed1Location, setBed1Location] = useState<FileLocation>()
const [bed2Location, setBed2Location] = useState<FileLocation>()
useEffect(() => {
model.setMixinData({
adapter: {
assemblyNamees: [r0, r1],
bed1Location,
bed2Location,
},
})
}, [model, bed1Location, bed2Location, r0, r1])
return (
<div style={{ marginTop: 20 }}>
<Typography>
JBrowse requires the two BED files that specify the genomic locations of
the genes in the .anchors files
</Typography>
<AssemblySelector
session={session}
label="BED1 assembly"
helperText=""
selected={r0}
onChange={asm => {
setR0(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
<AssemblySelector
session={session}
label="BED2 assembly"
helperText=""
selected={r1}
onChange={asm => {
setR1(asm)
}}
TextFieldProps={{
fullWidth: true,
}}
/>
<FileSelector
name="BED1"
inline
description=""
location={bed1Location}
setLocation={loc => {
setBed1Location(loc)
}}
/>
<FileSelector
name="BED2"
inline
description=""
location={bed2Location}
setLocation={loc => {
setBed2Location(loc)
}}
/>
</div>
)
})

export default MCScanAddTrackComponent
20 changes: 20 additions & 0 deletions plugins/comparative-adapters/src/MCScanAddTrackComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { lazy } from 'react'

import { mcscanTypes } from '../syntenyTypes'

import type PluginManager from '@jbrowse/core/PluginManager'

// lazies
const MCScanAddTrackComponent = lazy(() => import('./MCScanAddTrackComponent'))

export default function MCScanAddTrackComponentF(pluginManager: PluginManager) {
pluginManager.addToExtensionPoint(
'Core-addTrackComponent',
// @ts-expect-error
(comp, { model }: { trackAdapterType: string }) => {
return mcscanTypes.includes(model.trackAdapterType)
? MCScanAddTrackComponent
: comp
},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function MCScanAnchorsAdapterF(pluginManager: PluginManager) {
displayName: 'MCScan anchors adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},

getAdapterClass: () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function MCScanSimpleAnchorsAdapterF(
displayName: 'MCScan anchors.simple adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () =>
import('./MCScanSimpleAnchorsAdapter').then(r => r.default),
Expand Down
2 changes: 1 addition & 1 deletion plugins/comparative-adapters/src/MashMapAdapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function MashMapAdapterF(pluginManager: PluginManager) {
displayName: 'MashMap adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () => import('./MashMapAdapter').then(r => r.default),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function PairwiseIndexedPAFAdapterF(
displayName: 'Pairwise indexed PAF adapter',
configSchema,
adapterMetadata: {
hiddenFromGUI: true,
category: 'Synteny adapters',
},
getAdapterClass: () =>
import('./PairwiseIndexedPAFAdapter').then(r => r.default),
Expand Down
Loading

0 comments on commit 45588a2

Please sign in to comment.