@jbrowse/plugin-config 3.0.3 → 3.0.5

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.
@@ -10,14 +10,24 @@ class NcbiSequenceReportAliasAdapter extends BaseAdapter_1.BaseAdapter {
10
10
  }
11
11
  const override = this.getConf('useUcscNameOverride');
12
12
  const results = await (0, io_1.openLocation)(loc, this.pluginManager).readFile('utf8');
13
- return results
13
+ const lines = results
14
14
  .split(/\n|\r\n|\r/)
15
- .slice(1)
16
15
  .filter(f => !!f.trim())
17
- .map(row => row.split('\t'))
16
+ .map(row => row.split('\t'));
17
+ const r = lines[0] || [];
18
+ const idx0 = r.indexOf('GenBank seq accession');
19
+ const idx1 = r.indexOf('RefSeq seq accession');
20
+ const idx2 = r.indexOf('UCSC style name');
21
+ const idx3 = r.indexOf('Sequence name');
22
+ if (idx0 === -1 || idx1 === -1 || idx2 === -1) {
23
+ throw new Error('Header line must include "GenBank seq accession", "RefSeq seq accession", "UCSC style name", and "Sequence name"');
24
+ }
25
+ return lines
26
+ .slice(1)
27
+ .filter(cols => !!cols[idx2] || !!cols[idx3])
18
28
  .map(cols => ({
19
- refName: cols[12],
20
- aliases: [cols[9], cols[6]].filter((f) => !!f),
29
+ refName: (cols[idx2] || cols[idx3]),
30
+ aliases: [cols[idx0], cols[idx1], cols[idx2], cols[idx3]].filter((f) => !!f),
21
31
  override,
22
32
  }))
23
33
  .filter(f => !!f.refName);
@@ -6,7 +6,7 @@ declare const NcbiSequenceReportAliasAdapterConfigSchema: import("@jbrowse/core/
6
6
  locationType: string;
7
7
  };
8
8
  };
9
- useUcscNameOverride: {
9
+ useNameOverride: {
10
10
  type: string;
11
11
  defaultValue: boolean;
12
12
  description: string;
@@ -10,7 +10,7 @@ const NcbiSequenceReportAliasAdapterConfigSchema = (0, configuration_1.Configura
10
10
  locationType: 'UriLocation',
11
11
  },
12
12
  },
13
- useUcscNameOverride: {
13
+ useNameOverride: {
14
14
  type: 'boolean',
15
15
  defaultValue: true,
16
16
  description: 'forces usage of the UCSC names over the NCBI style names from a FASTA',
@@ -8,14 +8,24 @@ export default class NcbiSequenceReportAliasAdapter extends BaseAdapter {
8
8
  }
9
9
  const override = this.getConf('useUcscNameOverride');
10
10
  const results = await openLocation(loc, this.pluginManager).readFile('utf8');
11
- return results
11
+ const lines = results
12
12
  .split(/\n|\r\n|\r/)
13
- .slice(1)
14
13
  .filter(f => !!f.trim())
15
- .map(row => row.split('\t'))
14
+ .map(row => row.split('\t'));
15
+ const r = lines[0] || [];
16
+ const idx0 = r.indexOf('GenBank seq accession');
17
+ const idx1 = r.indexOf('RefSeq seq accession');
18
+ const idx2 = r.indexOf('UCSC style name');
19
+ const idx3 = r.indexOf('Sequence name');
20
+ if (idx0 === -1 || idx1 === -1 || idx2 === -1) {
21
+ throw new Error('Header line must include "GenBank seq accession", "RefSeq seq accession", "UCSC style name", and "Sequence name"');
22
+ }
23
+ return lines
24
+ .slice(1)
25
+ .filter(cols => !!cols[idx2] || !!cols[idx3])
16
26
  .map(cols => ({
17
- refName: cols[12],
18
- aliases: [cols[9], cols[6]].filter((f) => !!f),
27
+ refName: (cols[idx2] || cols[idx3]),
28
+ aliases: [cols[idx0], cols[idx1], cols[idx2], cols[idx3]].filter((f) => !!f),
19
29
  override,
20
30
  }))
21
31
  .filter(f => !!f.refName);
@@ -6,7 +6,7 @@ declare const NcbiSequenceReportAliasAdapterConfigSchema: import("@jbrowse/core/
6
6
  locationType: string;
7
7
  };
8
8
  };
9
- useUcscNameOverride: {
9
+ useNameOverride: {
10
10
  type: string;
11
11
  defaultValue: boolean;
12
12
  description: string;
@@ -8,7 +8,7 @@ const NcbiSequenceReportAliasAdapterConfigSchema = ConfigurationSchema('NcbiSequ
8
8
  locationType: 'UriLocation',
9
9
  },
10
10
  },
11
- useUcscNameOverride: {
11
+ useNameOverride: {
12
12
  type: 'boolean',
13
13
  defaultValue: true,
14
14
  description: 'forces usage of the UCSC names over the NCBI style names from a FASTA',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-config",
3
- "version": "3.0.3",
3
+ "version": "3.0.5",
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.3",
39
+ "@jbrowse/core": "^3.0.5",
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": "f516540428282351d26e46743e69a724651bfb2c"
59
+ "gitHead": "a03749efe19e51609922272b845a331897346789"
60
60
  }