Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 20, 2023
1 parent 305e7d0 commit d927b87
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 112 deletions.
98 changes: 48 additions & 50 deletions plugins/alignments/src/BamAdapter/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,61 +5,59 @@ import { types } from 'mobx-state-tree'
* #config BamAdapter
* used to configure BAM adapter
*/
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars

const configSchema = ConfigurationSchema(
'BamAdapter',
{
/**
* #slot
*/
bamLocation: {
type: 'fileLocation',
defaultValue: { uri: '/path/to/my.bam', locationType: 'UriLocation' },
},
export default function configSchemaF() {
return ConfigurationSchema(
'BamAdapter',
{
/**
* #slot
*/
bamLocation: {
type: 'fileLocation',
defaultValue: { uri: '/path/to/my.bam', locationType: 'UriLocation' },
},

index: ConfigurationSchema('BamIndex', {
index: ConfigurationSchema('BamIndex', {
/**
* #slot index.indexType
*/
indexType: {
model: types.enumeration('IndexType', ['BAI', 'CSI']),
type: 'stringEnum',
defaultValue: 'BAI',
},
/**
* #slot index.location
*/
location: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.bam.bai',
locationType: 'UriLocation',
},
},
}),
/**
* #slot index.indexType
* #slot
*/
indexType: {
model: types.enumeration('IndexType', ['BAI', 'CSI']),
type: 'stringEnum',
defaultValue: 'BAI',
fetchSizeLimit: {
type: 'number',
description:
'size to fetch in bytes over which to display a warning to the user that too much data will be fetched',
defaultValue: 5_000_000,
},
/**
* #slot index.location
* #slot
* generally refers to the reference genome assembly's sequence adapter
* currently needs to be manually added
*/
location: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.bam.bai',
locationType: 'UriLocation',
},
sequenceAdapter: {
type: 'frozen',
description:
'sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags',
defaultValue: null,
},
}),
/**
* #slot
*/
fetchSizeLimit: {
type: 'number',
description:
'size to fetch in bytes over which to display a warning to the user that too much data will be fetched',
defaultValue: 5_000_000,
},
/**
* #slot
* generally refers to the reference genome assembly's sequence adapter
* currently needs to be manually added
*/
sequenceAdapter: {
type: 'frozen',
description:
'sequence data adapter, used to calculate SNPs when BAM reads lacking MD tags',
defaultValue: null,
},
},
{ explicitlyTyped: true },
)

export default configSchema
{ explicitlyTyped: true },
)
}
4 changes: 2 additions & 2 deletions plugins/alignments/src/BamAdapter/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import PluginManager from '@jbrowse/core/PluginManager'
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'
import configSchema from './configSchema'
import configSchemaF from './configSchema'

export default (pluginManager: PluginManager) => {
pluginManager.addAdapterType(() => {
return new AdapterType({
name: 'BamAdapter',
displayName: 'BAM adapter',
configSchema,
configSchema: configSchemaF(),
getAdapterClass: () => import('./BamAdapter').then(r => r.default),
})
})
Expand Down
104 changes: 53 additions & 51 deletions plugins/alignments/src/CramAdapter/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,62 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration'
*/
function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars

const configSchema = ConfigurationSchema(
'CramAdapter',
{
/**
* #slot fetchSizeLimit
*/
fetchSizeLimit: {
type: 'number',
description:
'size in bytes over which to display a warning to the user that too much data will be fetched',
defaultValue: 3_000_000,
},
export default function configSchemaF() {
return ConfigurationSchema(
'CramAdapter',
{
/**
* #slot fetchSizeLimit
*/
fetchSizeLimit: {
type: 'number',
description:
'size in bytes over which to display a warning to the user that too much data will be fetched',
defaultValue: 3_000_000,
},

/**
* #slot cramLocation
*/
cramLocation: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.cram',
locationType: 'UriLocation',
/**
* #slot cramLocation
*/
cramLocation: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.cram',
locationType: 'UriLocation',
},
},
},

/**
* #slot craiLocation
*/
craiLocation: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.cram.crai',
locationType: 'UriLocation',
/**
* #slot craiLocation
*/
craiLocation: {
type: 'fileLocation',
defaultValue: {
uri: '/path/to/my.cram.crai',
locationType: 'UriLocation',
},
},
},

/**
* #slot sequenceAdapter
* generally refers to the reference genome assembly's sequence adapter
* currently needs to be manually added
*/
sequenceAdapter: {
type: 'frozen',
description: 'sequence data adapter',
defaultValue: null,
},
},
{
explicitlyTyped: true,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actions: (self: any) => ({
setSequenceAdapter(s: Record<string, unknown>) {
self.sequenceAdapter = s
/**
* #slot sequenceAdapter
* generally refers to the reference genome assembly's sequence adapter
* this can be manually added via the baseTrackConfig autorun, or manually
* specified
*/
sequenceAdapter: {
type: 'frozen',
description: 'sequence data adapter',
defaultValue: null,
},
}),
},
)
export default configSchema
},
{
explicitlyTyped: true,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actions: (self: any) => ({
setSequenceAdapter(s: Record<string, unknown>) {
self.sequenceAdapter = s
},
}),
},
)
}
4 changes: 2 additions & 2 deletions plugins/alignments/src/CramAdapter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import PluginManager from '@jbrowse/core/PluginManager'
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType'

// locals
import configSchema from './configSchema'
import configSchemaF from './configSchema'

export default (pluginManager: PluginManager) => {
pluginManager.addAdapterType(() => {
return new AdapterType({
name: 'CramAdapter',
displayName: 'CRAM adapter',
configSchema,
configSchema: configSchemaF(),
getAdapterClass: () => import('./CramAdapter').then(r => r.default),
})
})
Expand Down
5 changes: 2 additions & 3 deletions plugins/alignments/src/LinearPileupDisplay/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
trackMaxHeight,
mismatchAlpha,
rendererTypeName,
rendererType,
} = self
const configBlob = getConf(self, ['renderers', rendererTypeName]) || {}
return self.rendererType.configSchema.create(
return rendererType.configSchema.create(
{
...configBlob,
...(featureHeight !== undefined ? { height: featureHeight } : {}),
Expand Down Expand Up @@ -207,9 +208,7 @@ function stateModelFactory(configSchema: AnyConfigurationSchemaType) {
*/
renderReady() {
const view = getContainingView(self) as LGV
console.log(self.adapterConfig.sequenceAdapter)
return (
self.adapterConfig.sequenceAdapter &&
self.modificationsReady &&
self.currSortBpPerPx === view.bpPerPx &&
superRenderReady()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ async function renderBlockEffect(
return undefined
}

console.log(renderArgs?.adapterConfig.sequenceAdapter)
if (!renderArgs?.adapterConfig.sequenceAdapter) {
return undefined
}
if (displayError) {
self.setError(displayError)
return undefined
Expand Down

0 comments on commit d927b87

Please sign in to comment.