@jbrowse/plugin-config 3.0.5 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,5 +7,8 @@ const sequenceConfigSchema = (0, configuration_1.ConfigurationSchema)('FromConfi
7
7
  type: 'frozen',
8
8
  defaultValue: [],
9
9
  },
10
- }, { explicitlyTyped: true, implicitIdentifier: 'adapterId' });
10
+ }, {
11
+ explicitlyTyped: true,
12
+ implicitIdentifier: 'adapterId',
13
+ });
11
14
  exports.default = sequenceConfigSchema;
@@ -15,5 +15,18 @@ const NcbiSequenceReportAliasAdapterConfigSchema = (0, configuration_1.Configura
15
15
  defaultValue: true,
16
16
  description: 'forces usage of the UCSC names over the NCBI style names from a FASTA',
17
17
  },
18
- }, { explicitlyTyped: true });
18
+ }, {
19
+ explicitlyTyped: true,
20
+ preProcessSnapshot: snap => {
21
+ return snap.uri
22
+ ? {
23
+ ...snap,
24
+ location: {
25
+ uri: snap.uri,
26
+ baseUri: snap.baseUri,
27
+ },
28
+ }
29
+ : snap;
30
+ },
31
+ });
19
32
  exports.default = NcbiSequenceReportAliasAdapterConfigSchema;
@@ -10,13 +10,20 @@ class RefNameAliasAdapter extends BaseAdapter_1.BaseAdapter {
10
10
  }
11
11
  const results = await (0, io_1.openLocation)(loc, this.pluginManager).readFile('utf8');
12
12
  const refColumn = this.getConf('refNameColumn');
13
- return results
13
+ const refColumnHeaderName = this.getConf('refNameColumnHeaderName');
14
+ const lines = results
14
15
  .trim()
15
16
  .split(/\n|\r\n|\r/)
16
- .filter(f => !!f && !f.startsWith('#'))
17
+ .filter(f => !!f);
18
+ const header = lines.filter(f => f.startsWith('#'));
19
+ const headerCol = refColumnHeaderName && header.length
20
+ ? header.at(-1).split('\t').indexOf(refColumnHeaderName)
21
+ : refColumn;
22
+ return lines
23
+ .filter(f => !f.startsWith('#'))
17
24
  .map(row => {
18
25
  const aliases = row.split('\t');
19
- const [refName] = aliases.splice(refColumn, 1);
26
+ const refName = aliases[headerCol];
20
27
  return {
21
28
  refName: refName,
22
29
  aliases: aliases.filter(f => !!f.trim()),
@@ -10,5 +10,10 @@ declare const RefNameAliasAdapter: import("@jbrowse/core/configuration/configura
10
10
  type: string;
11
11
  defaultValue: number;
12
12
  };
13
+ refNameColumnHeaderName: {
14
+ type: string;
15
+ description: string;
16
+ defaultValue: string;
17
+ };
13
18
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
14
19
  export default RefNameAliasAdapter;
@@ -14,5 +14,23 @@ const RefNameAliasAdapter = (0, configuration_1.ConfigurationSchema)('RefNameAli
14
14
  type: 'number',
15
15
  defaultValue: 0,
16
16
  },
17
- }, { explicitlyTyped: true });
17
+ refNameColumnHeaderName: {
18
+ type: 'string',
19
+ description: 'alternative to refNameColumn, instead looks at header (starts with # and finds column name)',
20
+ defaultValue: '',
21
+ },
22
+ }, {
23
+ explicitlyTyped: true,
24
+ preProcessSnapshot: snap => {
25
+ return snap.uri
26
+ ? {
27
+ ...snap,
28
+ location: {
29
+ uri: snap.uri,
30
+ baseUri: snap.baseUri,
31
+ },
32
+ }
33
+ : snap;
34
+ },
35
+ });
18
36
  exports.default = RefNameAliasAdapter;
@@ -5,5 +5,8 @@ const sequenceConfigSchema = ConfigurationSchema('FromConfigSequenceAdapter', {
5
5
  type: 'frozen',
6
6
  defaultValue: [],
7
7
  },
8
- }, { explicitlyTyped: true, implicitIdentifier: 'adapterId' });
8
+ }, {
9
+ explicitlyTyped: true,
10
+ implicitIdentifier: 'adapterId',
11
+ });
9
12
  export default sequenceConfigSchema;
@@ -13,5 +13,18 @@ const NcbiSequenceReportAliasAdapterConfigSchema = ConfigurationSchema('NcbiSequ
13
13
  defaultValue: true,
14
14
  description: 'forces usage of the UCSC names over the NCBI style names from a FASTA',
15
15
  },
16
- }, { explicitlyTyped: true });
16
+ }, {
17
+ explicitlyTyped: true,
18
+ preProcessSnapshot: snap => {
19
+ return snap.uri
20
+ ? {
21
+ ...snap,
22
+ location: {
23
+ uri: snap.uri,
24
+ baseUri: snap.baseUri,
25
+ },
26
+ }
27
+ : snap;
28
+ },
29
+ });
17
30
  export default NcbiSequenceReportAliasAdapterConfigSchema;
@@ -8,13 +8,20 @@ export default class RefNameAliasAdapter extends BaseAdapter {
8
8
  }
9
9
  const results = await openLocation(loc, this.pluginManager).readFile('utf8');
10
10
  const refColumn = this.getConf('refNameColumn');
11
- return results
11
+ const refColumnHeaderName = this.getConf('refNameColumnHeaderName');
12
+ const lines = results
12
13
  .trim()
13
14
  .split(/\n|\r\n|\r/)
14
- .filter(f => !!f && !f.startsWith('#'))
15
+ .filter(f => !!f);
16
+ const header = lines.filter(f => f.startsWith('#'));
17
+ const headerCol = refColumnHeaderName && header.length
18
+ ? header.at(-1).split('\t').indexOf(refColumnHeaderName)
19
+ : refColumn;
20
+ return lines
21
+ .filter(f => !f.startsWith('#'))
15
22
  .map(row => {
16
23
  const aliases = row.split('\t');
17
- const [refName] = aliases.splice(refColumn, 1);
24
+ const refName = aliases[headerCol];
18
25
  return {
19
26
  refName: refName,
20
27
  aliases: aliases.filter(f => !!f.trim()),
@@ -10,5 +10,10 @@ declare const RefNameAliasAdapter: import("@jbrowse/core/configuration/configura
10
10
  type: string;
11
11
  defaultValue: number;
12
12
  };
13
+ refNameColumnHeaderName: {
14
+ type: string;
15
+ description: string;
16
+ defaultValue: string;
17
+ };
13
18
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
14
19
  export default RefNameAliasAdapter;
@@ -12,5 +12,23 @@ const RefNameAliasAdapter = ConfigurationSchema('RefNameAliasAdapter', {
12
12
  type: 'number',
13
13
  defaultValue: 0,
14
14
  },
15
- }, { explicitlyTyped: true });
15
+ refNameColumnHeaderName: {
16
+ type: 'string',
17
+ description: 'alternative to refNameColumn, instead looks at header (starts with # and finds column name)',
18
+ defaultValue: '',
19
+ },
20
+ }, {
21
+ explicitlyTyped: true,
22
+ preProcessSnapshot: snap => {
23
+ return snap.uri
24
+ ? {
25
+ ...snap,
26
+ location: {
27
+ uri: snap.uri,
28
+ baseUri: snap.baseUri,
29
+ },
30
+ }
31
+ : snap;
32
+ },
33
+ });
16
34
  export default RefNameAliasAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-config",
3
- "version": "3.0.5",
3
+ "version": "3.2.0",
4
4
  "description": "JBrowse 2 config utilities",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,7 +36,7 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "@jbrowse/core": "^3.0.5",
39
+ "@jbrowse/core": "^3.2.0",
40
40
  "@mui/icons-material": "^6.0.0",
41
41
  "@mui/material": "^6.0.0",
42
42
  "mobx": "^6.0.0",
@@ -56,5 +56,5 @@
56
56
  "distModule": "esm/index.js",
57
57
  "srcModule": "src/index.ts",
58
58
  "module": "esm/index.js",
59
- "gitHead": "a03749efe19e51609922272b845a331897346789"
59
+ "gitHead": "c750e3f56706a490c19ba75abd807fec5e38aebf"
60
60
  }