@apollo-annotation/cli 0.3.4 → 0.3.6

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.
package/README.md CHANGED
@@ -16,7 +16,7 @@ $ npm install -g @apollo-annotation/cli
16
16
  $ apollo COMMAND
17
17
  running command...
18
18
  $ apollo (--version)
19
- @apollo-annotation/cli/0.3.4 linux-x64 node-v18.20.7
19
+ @apollo-annotation/cli/0.3.6 linux-x64 node-v18.20.8
20
20
  $ apollo --help [COMMAND]
21
21
  USAGE
22
22
  $ apollo COMMAND
@@ -114,7 +114,7 @@ EXAMPLES
114
114
  ```
115
115
 
116
116
  _See code:
117
- [src/commands/assembly/add-from-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/add-from-fasta.ts)_
117
+ [src/commands/assembly/add-from-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/add-from-fasta.ts)_
118
118
 
119
119
  ## `apollo assembly add-from-gff INPUT-FILE`
120
120
 
@@ -150,7 +150,7 @@ EXAMPLES
150
150
  ```
151
151
 
152
152
  _See code:
153
- [src/commands/assembly/add-from-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/add-from-gff.ts)_
153
+ [src/commands/assembly/add-from-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/add-from-gff.ts)_
154
154
 
155
155
  ## `apollo assembly check`
156
156
 
@@ -192,7 +192,7 @@ EXAMPLES
192
192
  ```
193
193
 
194
194
  _See code:
195
- [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/check.ts)_
195
+ [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/check.ts)_
196
196
 
197
197
  ## `apollo assembly delete`
198
198
 
@@ -220,7 +220,7 @@ EXAMPLES
220
220
  ```
221
221
 
222
222
  _See code:
223
- [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/delete.ts)_
223
+ [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/delete.ts)_
224
224
 
225
225
  ## `apollo assembly get`
226
226
 
@@ -242,7 +242,7 @@ DESCRIPTION
242
242
  ```
243
243
 
244
244
  _See code:
245
- [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/get.ts)_
245
+ [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/get.ts)_
246
246
 
247
247
  ## `apollo assembly sequence`
248
248
 
@@ -277,7 +277,7 @@ EXAMPLES
277
277
  ```
278
278
 
279
279
  _See code:
280
- [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/assembly/sequence.ts)_
280
+ [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/assembly/sequence.ts)_
281
281
 
282
282
  ## `apollo change get`
283
283
 
@@ -301,7 +301,7 @@ DESCRIPTION
301
301
  ```
302
302
 
303
303
  _See code:
304
- [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/change/get.ts)_
304
+ [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/change/get.ts)_
305
305
 
306
306
  ## `apollo config [KEY] [VALUE]`
307
307
 
@@ -353,7 +353,7 @@ EXAMPLES
353
353
  ```
354
354
 
355
355
  _See code:
356
- [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/config.ts)_
356
+ [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/config.ts)_
357
357
 
358
358
  ## `apollo export gff3 ASSEMBLY`
359
359
 
@@ -381,7 +381,7 @@ EXAMPLES
381
381
  ```
382
382
 
383
383
  _See code:
384
- [src/commands/export/gff3.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/export/gff3.ts)_
384
+ [src/commands/export/gff3.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/export/gff3.ts)_
385
385
 
386
386
  ## `apollo feature add-child`
387
387
 
@@ -412,7 +412,7 @@ EXAMPLES
412
412
  ```
413
413
 
414
414
  _See code:
415
- [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/add-child.ts)_
415
+ [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/add-child.ts)_
416
416
 
417
417
  ## `apollo feature check`
418
418
 
@@ -445,7 +445,7 @@ EXAMPLES
445
445
  ```
446
446
 
447
447
  _See code:
448
- [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/check.ts)_
448
+ [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/check.ts)_
449
449
 
450
450
  ## `apollo feature copy`
451
451
 
@@ -476,7 +476,7 @@ EXAMPLES
476
476
  ```
477
477
 
478
478
  _See code:
479
- [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/copy.ts)_
479
+ [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/copy.ts)_
480
480
 
481
481
  ## `apollo feature delete`
482
482
 
@@ -500,7 +500,7 @@ DESCRIPTION
500
500
  ```
501
501
 
502
502
  _See code:
503
- [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/delete.ts)_
503
+ [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/delete.ts)_
504
504
 
505
505
  ## `apollo feature edit`
506
506
 
@@ -542,7 +542,7 @@ EXAMPLES
542
542
  ```
543
543
 
544
544
  _See code:
545
- [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/edit.ts)_
545
+ [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/edit.ts)_
546
546
 
547
547
  ## `apollo feature edit-attribute`
548
548
 
@@ -582,7 +582,7 @@ EXAMPLES
582
582
  ```
583
583
 
584
584
  _See code:
585
- [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
585
+ [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
586
586
 
587
587
  ## `apollo feature edit-coords`
588
588
 
@@ -616,7 +616,7 @@ EXAMPLES
616
616
  ```
617
617
 
618
618
  _See code:
619
- [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
619
+ [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
620
620
 
621
621
  ## `apollo feature edit-type`
622
622
 
@@ -640,7 +640,7 @@ DESCRIPTION
640
640
  ```
641
641
 
642
642
  _See code:
643
- [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/edit-type.ts)_
643
+ [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/edit-type.ts)_
644
644
 
645
645
  ## `apollo feature get`
646
646
 
@@ -674,7 +674,7 @@ EXAMPLES
674
674
  ```
675
675
 
676
676
  _See code:
677
- [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/get.ts)_
677
+ [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/get.ts)_
678
678
 
679
679
  ## `apollo feature get-id`
680
680
 
@@ -702,7 +702,7 @@ EXAMPLES
702
702
  ```
703
703
 
704
704
  _See code:
705
- [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/get-id.ts)_
705
+ [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/get-id.ts)_
706
706
 
707
707
  ## `apollo feature import INPUT-FILE`
708
708
 
@@ -733,7 +733,7 @@ EXAMPLES
733
733
  ```
734
734
 
735
735
  _See code:
736
- [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/import.ts)_
736
+ [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/import.ts)_
737
737
 
738
738
  ## `apollo feature search`
739
739
 
@@ -784,7 +784,7 @@ EXAMPLES
784
784
  ```
785
785
 
786
786
  _See code:
787
- [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/feature/search.ts)_
787
+ [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/feature/search.ts)_
788
788
 
789
789
  ## `apollo file delete`
790
790
 
@@ -811,7 +811,7 @@ EXAMPLES
811
811
  ```
812
812
 
813
813
  _See code:
814
- [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/file/delete.ts)_
814
+ [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/file/delete.ts)_
815
815
 
816
816
  ## `apollo file download`
817
817
 
@@ -839,7 +839,7 @@ EXAMPLES
839
839
  ```
840
840
 
841
841
  _See code:
842
- [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/file/download.ts)_
842
+ [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/file/download.ts)_
843
843
 
844
844
  ## `apollo file get`
845
845
 
@@ -866,7 +866,7 @@ EXAMPLES
866
866
  ```
867
867
 
868
868
  _See code:
869
- [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/file/get.ts)_
869
+ [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/file/get.ts)_
870
870
 
871
871
  ## `apollo file upload INPUT-FILE`
872
872
 
@@ -903,7 +903,7 @@ EXAMPLES
903
903
  ```
904
904
 
905
905
  _See code:
906
- [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/file/upload.ts)_
906
+ [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/file/upload.ts)_
907
907
 
908
908
  ## `apollo help [COMMANDS]`
909
909
 
@@ -950,7 +950,7 @@ EXAMPLES
950
950
  ```
951
951
 
952
952
  _See code:
953
- [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
953
+ [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
954
954
 
955
955
  ## `apollo jbrowse set-config INPUTFILE`
956
956
 
@@ -979,7 +979,7 @@ EXAMPLES
979
979
  ```
980
980
 
981
981
  _See code:
982
- [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
982
+ [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
983
983
 
984
984
  ## `apollo login`
985
985
 
@@ -1018,7 +1018,7 @@ EXAMPLES
1018
1018
  ```
1019
1019
 
1020
1020
  _See code:
1021
- [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/login.ts)_
1021
+ [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/login.ts)_
1022
1022
 
1023
1023
  ## `apollo logout`
1024
1024
 
@@ -1048,7 +1048,7 @@ EXAMPLES
1048
1048
  ```
1049
1049
 
1050
1050
  _See code:
1051
- [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/logout.ts)_
1051
+ [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/logout.ts)_
1052
1052
 
1053
1053
  ## `apollo refseq add-alias INPUT-FILE`
1054
1054
 
@@ -1079,7 +1079,7 @@ EXAMPLES
1079
1079
  ```
1080
1080
 
1081
1081
  _See code:
1082
- [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1082
+ [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1083
1083
 
1084
1084
  ## `apollo refseq get`
1085
1085
 
@@ -1111,7 +1111,7 @@ EXAMPLES
1111
1111
  ```
1112
1112
 
1113
1113
  _See code:
1114
- [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/refseq/get.ts)_
1114
+ [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/refseq/get.ts)_
1115
1115
 
1116
1116
  ## `apollo status`
1117
1117
 
@@ -1133,7 +1133,7 @@ DESCRIPTION
1133
1133
  ```
1134
1134
 
1135
1135
  _See code:
1136
- [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/status.ts)_
1136
+ [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/status.ts)_
1137
1137
 
1138
1138
  ## `apollo user get`
1139
1139
 
@@ -1169,6 +1169,6 @@ EXAMPLES
1169
1169
  ```
1170
1170
 
1171
1171
  _See code:
1172
- [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.4/packages/apollo-cli/src/commands/user/get.ts)_
1172
+ [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.6/packages/apollo-cli/src/commands/user/get.ts)_
1173
1173
 
1174
1174
  <!-- commandsstop -->
@@ -1,4 +1,4 @@
1
- import { Command, Interfaces } from '@oclif/core';
1
+ import { Command, type Interfaces } from '@oclif/core';
2
2
  export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)['baseFlags'] & T['flags']>;
3
3
  export type Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>;
4
4
  export declare abstract class BaseCommand<T extends typeof Command> extends Command {
@@ -1,8 +1,8 @@
1
+ import { Readable } from 'node:stream';
1
2
  import { Args, Flags } from '@oclif/core';
2
3
  import { fetch } from 'undici';
3
4
  import { BaseCommand } from '../../baseCommand.js';
4
5
  import { convertAssemblyNameToId, createFetchErrorMessage, idReader, localhostToAddress, } from '../../utils.js';
5
- import { Readable } from 'node:stream';
6
6
  export default class Get extends BaseCommand {
7
7
  static description = 'Export the annotations for an assembly to stdout as gff3';
8
8
  static examples = [
@@ -1,5 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
3
1
  import { Flags } from '@oclif/core';
4
2
  import { ObjectId } from 'bson';
5
3
  import { fetch } from 'undici';
@@ -62,6 +62,7 @@ Use `apollo assembly check` for managing which checks should be applied to an as
62
62
  results.push(chk);
63
63
  }
64
64
  }
65
+ results.sort((a, b) => (a.start < b.start ? -1 : 1));
65
66
  this.log(JSON.stringify(results, null, 2));
66
67
  }
67
68
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-unsafe-assignment */
2
1
  import { Flags } from '@oclif/core';
3
2
  import { fetch } from 'undici';
4
3
  import { BaseCommand } from '../../baseCommand.js';
@@ -3,7 +3,7 @@ import { Args } from '@oclif/core';
3
3
  import { Agent, fetch } from 'undici';
4
4
  import { ConfigError } from '../../ApolloConf.js';
5
5
  import { BaseCommand } from '../../baseCommand.js';
6
- import { localhostToAddress, createFetchErrorMessage } from '../../utils.js';
6
+ import { createFetchErrorMessage, localhostToAddress } from '../../utils.js';
7
7
  export default class SetConfig extends BaseCommand {
8
8
  static summary = 'Set JBrowse configuration';
9
9
  static description = 'Set JBrowse configuration in Apollo collaboration server';
@@ -1,9 +1,9 @@
1
1
  import * as fs from 'node:fs';
2
- import { Agent, fetch } from 'undici';
3
2
  import { Args, Flags } from '@oclif/core';
3
+ import { Agent, fetch } from 'undici';
4
+ import { ConfigError } from '../../ApolloConf.js';
4
5
  import { BaseCommand } from '../../baseCommand.js';
5
6
  import { createFetchErrorMessage, localhostToAddress, queryApollo, } from '../../utils.js';
6
- import { ConfigError } from '../../ApolloConf.js';
7
7
  export default class AddRefNameAlias extends BaseCommand {
8
8
  static summary = 'Add reference name aliases from a file';
9
9
  static description = 'Reference name aliasing is a process to make chromosomes that are named slightly differently but which refer to the same thing render properly. This command reads a file with reference name aliases and adds them to the database.';
package/dist/test/test.js CHANGED
@@ -16,11 +16,10 @@
16
16
  * yarn test:cli --test-name-pattern='Print help|Feature get'
17
17
  */
18
18
  import assert from 'node:assert';
19
- import { before, beforeEach, afterEach, describe } from 'node:test';
20
- import { Shell } from './utils.js';
21
- import fs from 'node:fs';
22
19
  import * as crypto from 'node:crypto';
23
- import path from 'node:path';
20
+ import fs from 'node:fs';
21
+ import { afterEach, before, beforeEach, describe } from 'node:test';
22
+ import { Shell } from './utils.js';
24
23
  const apollo = 'yarn dev';
25
24
  const P = '--profile testAdmin';
26
25
  let configFile = '';
@@ -28,7 +27,7 @@ let configFileBak = '';
28
27
  void describe('Test CLI', () => {
29
28
  before(() => {
30
29
  configFile = new Shell(`${apollo} config --get-config-file`).stdout.trim();
31
- configFileBak = `${path.basename(configFile)}.bak`;
30
+ configFileBak = `${configFile}.bak`;
32
31
  if (fs.existsSync(configFileBak)) {
33
32
  throw new Error(`Backup config file ${configFileBak} already exists. If safe to do so, delete it before testing`);
34
33
  }
@@ -114,7 +113,7 @@ void describe('Test CLI', () => {
114
113
  assert.ok(p.stdout.includes('vv2'));
115
114
  assert.ok(p.stdout.includes('vv3') == false);
116
115
  const out = JSON.parse(p.stdout);
117
- const aid = out.filter((x) => x.name === 'vv1').at(0)._id;
116
+ const aid = out.find((x) => x.name === 'vv1')._id;
118
117
  p = new Shell(`${apollo} assembly get ${P} -a ${aid} vv2`);
119
118
  assert.ok(p.stdout.includes('vv1'));
120
119
  assert.ok(p.stdout.includes('vv2'));
@@ -202,7 +201,7 @@ void describe('Test CLI', () => {
202
201
  p = new Shell(`${apollo} refseq get ${P}`);
203
202
  const refseq = JSON.parse(p.stdout.trim());
204
203
  const vv1ref = refseq.filter((x) => x.assembly === asm_id);
205
- const refseq_id = vv1ref.filter((x) => x.name === 'ctgA').at(0)._id;
204
+ const refseq_id = vv1ref.find((x) => x.name === 'ctgA')._id;
206
205
  p = new Shell(`${apollo} feature get ${P} -r ${refseq_id}`);
207
206
  const ff = JSON.parse(p.stdout);
208
207
  assert.deepStrictEqual(ff, []);
@@ -226,7 +225,7 @@ void describe('Test CLI', () => {
226
225
  new Shell(`${apollo} assembly add-from-fasta ${P} test_data/tmp.fa -a test -e -f`, true, 60_000);
227
226
  fs.unlinkSync('test_data/tmp.fa');
228
227
  });
229
- void globalThis.itName('FIXME Checks are triggered and resolved', () => {
228
+ void globalThis.itName('Checks are triggered and resolved', () => {
230
229
  new Shell(`${apollo} assembly add-from-gff ${P} test_data/checks.gff -f`);
231
230
  let p = new Shell(`${apollo} feature get ${P} -a checks.gff`);
232
231
  const out = JSON.parse(p.stdout);
@@ -241,15 +240,42 @@ void describe('Test CLI', () => {
241
240
  new Shell(`${apollo} feature edit-coords ${P} -i ${cds_id} --start 4 --end 24`);
242
241
  p = new Shell(`${apollo} feature check ${P} -a checks.gff`);
243
242
  const checks = JSON.parse(p.stdout);
244
- // FIXME: There should be 2 failing checks, not 3
245
- assert.strictEqual(checks.length, 3);
246
- assert.ok(p.stdout.includes('InternalStopCodonCheck'));
247
- assert.ok(p.stdout.includes('MissingStopCodonCheck'));
243
+ assert.strictEqual(checks.length, 2);
244
+ assert.ok(p.stdout.includes('InternalStopCodon'));
245
+ assert.ok(p.stdout.includes('MissingStopCodon'));
248
246
  // Problems fixed
249
247
  new Shell(`${apollo} feature edit-coords ${P} -i ${cds_id} --start 16 --end 27`);
250
248
  p = new Shell(`${apollo} feature check ${P} -a checks.gff`);
251
- // FIXME: After fixing, how many warnings do we expect?
252
- assert.deepStrictEqual(JSON.parse(p.stdout).length, 4);
249
+ assert.deepStrictEqual(JSON.parse(p.stdout).length, 0);
250
+ });
251
+ void globalThis.itName('FIXME: Checks stay after invalid operation', () => {
252
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/checks.gff -f`);
253
+ let p = new Shell(`${apollo} feature get ${P} -a checks.gff`);
254
+ const out = JSON.parse(p.stdout);
255
+ p = new Shell(`${apollo} feature check ${P} -a checks.gff`);
256
+ assert.deepStrictEqual(p.stdout.trim(), '[]'); // No failing check
257
+ // Get the ID of the CDS. We need need it to modify the CDS coordinates
258
+ const gene = out.filter((x) => JSON.stringify(x.attributes.gff_id) === JSON.stringify(['gene01']));
259
+ const mrna = Object.values(gene.at(0).children).at(0);
260
+ const cds = Object.values(mrna.children).find((x) => x.attributes.gff_id.at(0) === 'cds01');
261
+ const cds_id = cds._id;
262
+ // Introduce problems
263
+ new Shell(`${apollo} feature edit-coords ${P} -i ${cds_id} --start 4 --end 24`);
264
+ p = new Shell(`${apollo} feature check ${P} -a checks.gff`);
265
+ let checks = JSON.parse(p.stdout);
266
+ assert.strictEqual(checks.length, 2);
267
+ assert.ok(p.stdout.includes('InternalStopCodon'));
268
+ assert.ok(p.stdout.includes('MissingStopCodon'));
269
+ // Do something invalid: extend CDS beyond parent
270
+ p = new Shell(`${apollo} feature edit-coords ${P} -i ${cds_id} --end 30`, false);
271
+ assert.ok(p.returncode != 0);
272
+ assert.ok(p.stderr.includes('exceeds the bounds of its parent'));
273
+ // FIXME: Checks should be the same as before the invalid edit
274
+ p = new Shell(`${apollo} feature check ${P} -a checks.gff`);
275
+ checks = JSON.parse(p.stdout);
276
+ //assert.strictEqual(checks.length, 2)
277
+ //assert.ok(p.stdout.includes('InternalStopCodon'))
278
+ //assert.ok(p.stdout.includes('MissingStopCodon'))
253
279
  });
254
280
  void globalThis.itName('Add assembly from local fasta', () => {
255
281
  let p = new Shell(`${apollo} assembly add-from-fasta ${P} test_data/tiny.fasta -a vv1 -e -f`);
@@ -281,12 +307,12 @@ void describe('Test CLI', () => {
281
307
  assert.ok(p.returncode != 0);
282
308
  });
283
309
  void globalThis.itName('Detect missing external index', () => {
284
- const p = new Shell(`${apollo} assembly add-from-fasta ${P} -a vv1 -f https://raw.githubusercontent.com/GMOD/Apollo3/refs/heads/main/packages/apollo-cli/test_data/tiny.fasta`, false);
310
+ const p = new Shell(`${apollo} assembly add-from-fasta ${P} -a vv1 -f http://localhost:3131/tiny.fasta`, false);
285
311
  assert.ok(p.returncode != 0);
286
312
  assert.ok(p.stderr.includes('Index file') && p.stderr.includes('does not exist'));
287
313
  });
288
314
  void globalThis.itName('Editable sequence not allowed with external source', () => {
289
- const cmd = `${apollo} assembly add-from-fasta ${P} -a vv1 -f https://raw.githubusercontent.com/GMOD/Apollo3/refs/heads/main/packages/apollo-cli/test_data/tiny.fasta.gz`;
315
+ const cmd = `${apollo} assembly add-from-fasta ${P} -a vv1 -f http://localhost:3131/tiny.fasta.gz`;
290
316
  new Shell(cmd);
291
317
  const p = new Shell(`${cmd} -e`, false);
292
318
  assert.ok(p.returncode != 0);
@@ -377,9 +403,7 @@ void describe('Test CLI', () => {
377
403
  // Edit a feature by extending beyond the boundary of its parent and
378
404
  // check it throws a meaningful error message
379
405
  // let eden_gene = undefined
380
- const eden_gene = features
381
- .filter((x) => x.type === 'gene' && x.attributes.gff_name.at(0) === 'EDEN')
382
- .at(0);
406
+ const eden_gene = features.find((x) => x.type === 'gene' && x.attributes.gff_name.at(0) === 'EDEN');
383
407
  assert.ok(eden_gene);
384
408
  const mrna_id = Object.keys(eden_gene.children).at(0);
385
409
  p = new Shell(`${apollo} feature edit-coords ${P} -i ${mrna_id} -s 1`, false);
@@ -545,9 +569,7 @@ void describe('Test CLI', () => {
545
569
  assert.strictEqual(out.max, 50);
546
570
  // RefSeq id does not need assembly
547
571
  p = new Shell(`${apollo} refseq get ${P} -a dest2`);
548
- const destRefSeq = JSON.parse(p.stdout)
549
- .filter((x) => x.name === 'ctgA')
550
- .at(0)._id;
572
+ const destRefSeq = JSON.parse(p.stdout).find((x) => x.name === 'ctgA')._id;
551
573
  p = new Shell(`${apollo} feature copy ${P} -i ${fid} -r ${destRefSeq} -s 2`);
552
574
  p = new Shell(`${apollo} feature search ${P} -a dest2 -t contig`);
553
575
  out = JSON.parse(p.stdout).at(0);
@@ -643,7 +665,7 @@ void describe('Test CLI', () => {
643
665
  let p = new Shell(`${apollo} assembly check ${P}`);
644
666
  let out = JSON.parse(p.stdout);
645
667
  assert.ok(p.stdout.includes('CDSCheck'));
646
- const cdsCheckId = out.filter((x) => x.name === 'CDSCheck').at(0)._id;
668
+ const cdsCheckId = out.find((x) => x.name === 'CDSCheck')._id;
647
669
  // Test view checks set for assembly
648
670
  p = new Shell(`${apollo} assembly check ${P} -a v1`);
649
671
  out = JSON.parse(p.stdout);
@@ -682,14 +704,14 @@ void describe('Test CLI', () => {
682
704
  let p = new Shell(`${apollo} feature check ${P} -a v1`);
683
705
  const out = JSON.parse(p.stdout);
684
706
  assert.ok(out.length > 1);
685
- assert.ok(p.stdout.includes('InternalStopCodonCheck'));
707
+ assert.ok(p.stdout.includes('InternalStopCodon'));
686
708
  // Ids with checks
687
709
  const ids = out.map((x) => x.ids);
688
710
  assert.ok(new Set(ids).size > 1);
689
711
  // Retrieve by feature id
690
712
  const xid = [...ids].join(' ');
691
713
  p = new Shell(`${apollo} feature check ${P} -i ${xid}`);
692
- assert.ok(p.stdout.includes('InternalStopCodonCheck'));
714
+ assert.ok(p.stdout.includes('InternalStopCodon'));
693
715
  });
694
716
  void globalThis.itName('Feature checks indexed', () => {
695
717
  new Shell(`${apollo} assembly add-from-fasta ${P} -a v1 test_data/tiny.fasta.gz -f`);
@@ -698,14 +720,14 @@ void describe('Test CLI', () => {
698
720
  let p = new Shell(`${apollo} feature check ${P} -a v1`);
699
721
  const out = JSON.parse(p.stdout);
700
722
  assert.ok(out.length > 1);
701
- assert.ok(p.stdout.includes('InternalStopCodonCheck'));
723
+ assert.ok(p.stdout.includes('InternalStopCodon'));
702
724
  // Ids with checks
703
725
  const ids = out.map((x) => x.ids);
704
726
  assert.ok(new Set(ids).size > 1);
705
727
  // Retrieve by feature id
706
728
  const xid = [...ids].join(' ');
707
729
  p = new Shell(`${apollo} feature check ${P} -i ${xid}`);
708
- assert.ok(p.stdout.includes('InternalStopCodonCheck'));
730
+ assert.ok(p.stdout.includes('InternalStopCodon'));
709
731
  });
710
732
  void globalThis.itName('User', () => {
711
733
  let p = new Shell(`${apollo} user get ${P}`);
@@ -932,7 +954,7 @@ void describe('Test CLI', () => {
932
954
  assert.ok(gff.startsWith('##gff-version 3'));
933
955
  assert.ok(gff.includes('multivalue=val1,val2,val3'));
934
956
  assert.ok(gff.includes('##FASTA\n'));
935
- assert.deepStrictEqual(gff.slice(-6, gff.length), 'taccc\n');
957
+ assert.deepStrictEqual(gff.slice(-6), 'taccc\n');
936
958
  p = new Shell(`${apollo} export gff3 ${P} vv1`);
937
959
  gff = p.stdout;
938
960
  assert.ok(gff.startsWith('##gff-version 3'));
@@ -952,7 +974,7 @@ void describe('Test CLI', () => {
952
974
  assert.ok(gff.includes('multivalue=val1,val2,val3'));
953
975
  assert.ok(gff.includes('##FASTA\n'));
954
976
  // We end with two newlines because the test data does have an extra newline at the end.
955
- assert.deepStrictEqual(gff.slice(-7, gff.length), 'taccc\n\n');
977
+ assert.deepStrictEqual(gff.slice(-7), 'taccc\n\n');
956
978
  p = new Shell(`${apollo} export gff3 ${P} vv1`);
957
979
  gff = p.stdout;
958
980
  assert.ok(gff.startsWith('##gff-version 3'));
@@ -960,7 +982,7 @@ void describe('Test CLI', () => {
960
982
  assert.ok(!gff.includes('##FASTA\n'));
961
983
  });
962
984
  void globalThis.itName('Export gff3 from external assembly', () => {
963
- new Shell(`${apollo} assembly add-from-fasta ${P} https://raw.githubusercontent.com/GMOD/Apollo3/refs/heads/main/packages/apollo-cli/test_data/tiny.fasta.gz -a vv1 -f`);
985
+ new Shell(`${apollo} assembly add-from-fasta ${P} http://localhost:3131/tiny.fasta.gz -a vv1 -f`);
964
986
  new Shell(`${apollo} feature import ${P} test_data/tiny.fasta.gff3 -a vv1`);
965
987
  let p = new Shell(`${apollo} export gff3 ${P} vv1 --include-fasta`);
966
988
  let gff = p.stdout;
@@ -968,11 +990,75 @@ void describe('Test CLI', () => {
968
990
  assert.ok(gff.includes('multivalue=val1,val2,val3'));
969
991
  assert.ok(gff.includes('##FASTA\n'));
970
992
  // We end with two newlines because the test data does have an extra newline at the end.
971
- assert.deepStrictEqual(gff.slice(-7, gff.length), 'taccc\n\n');
993
+ assert.deepStrictEqual(gff.slice(-7), 'taccc\n\n');
972
994
  p = new Shell(`${apollo} export gff3 ${P} vv1`);
973
995
  gff = p.stdout;
974
996
  assert.ok(gff.startsWith('##gff-version 3'));
975
997
  assert.ok(gff.includes('multivalue=val1,val2,val3'));
976
998
  assert.ok(!gff.includes('##FASTA\n'));
977
999
  });
1000
+ void globalThis.itName('Position of internal stop codon warning in forward', () => {
1001
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/warningPositionForward.gff -a vv1 -f`);
1002
+ const p = new Shell(`${apollo} feature check ${P} -a vv1`);
1003
+ const out = JSON.parse(p.stdout);
1004
+ assert.deepStrictEqual(out.length, 2);
1005
+ assert.deepStrictEqual(out.at(0).cause, 'InternalStopCodon');
1006
+ assert.deepStrictEqual(out.at(0).start, 9);
1007
+ assert.deepStrictEqual(out.at(0).end, 15);
1008
+ assert.deepStrictEqual(out.at(1).cause, 'InternalStopCodon');
1009
+ assert.deepStrictEqual(out.at(1).start, 21);
1010
+ assert.deepStrictEqual(out.at(1).end, 24);
1011
+ });
1012
+ void globalThis.itName('Position of internal stop codon warning in reverse', () => {
1013
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/warningPositionReverse.gff -a vv1 -f`);
1014
+ const p = new Shell(`${apollo} feature check ${P} -a vv1`);
1015
+ const out = JSON.parse(p.stdout);
1016
+ assert.deepStrictEqual(out.length, 2);
1017
+ assert.deepStrictEqual(out.at(0).cause, 'InternalStopCodon');
1018
+ assert.deepStrictEqual(out.at(0).start, 3);
1019
+ assert.deepStrictEqual(out.at(0).end, 18);
1020
+ assert.deepStrictEqual(out.at(1).cause, 'InternalStopCodon');
1021
+ assert.deepStrictEqual(out.at(1).start, 18);
1022
+ assert.deepStrictEqual(out.at(1).end, 21);
1023
+ });
1024
+ void globalThis.itName('Detect missing start codon forward', () => {
1025
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/missingStartCodonForward.gff3 -a m1 -f`);
1026
+ const p = new Shell(`${apollo} feature check ${P} -a m1`);
1027
+ const out = JSON.parse(p.stdout);
1028
+ assert.strictEqual(out.length, 1);
1029
+ assert.deepStrictEqual(out.at(0).cause, 'MissingStartCodon');
1030
+ assert.deepStrictEqual(out.at(0).start, 3);
1031
+ assert.deepStrictEqual(out.at(0).end, 3);
1032
+ assert.ok(out.at(0).message.includes('TTG'));
1033
+ });
1034
+ void globalThis.itName('Detect missing start codon reverse', () => {
1035
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/missingStartCodonReverse.gff3 -a m1 -f`);
1036
+ const p = new Shell(`${apollo} feature check ${P} -a m1`);
1037
+ const out = JSON.parse(p.stdout);
1038
+ assert.strictEqual(out.length, 1);
1039
+ assert.deepStrictEqual(out.at(0).cause, 'MissingStartCodon');
1040
+ assert.deepStrictEqual(out.at(0).start, 23);
1041
+ assert.deepStrictEqual(out.at(0).end, 23);
1042
+ assert.ok(out.at(0).message.includes('agC'));
1043
+ });
1044
+ void globalThis.itName('Edit exon inferred from CDS', () => {
1045
+ new Shell(`${apollo} assembly add-from-gff ${P} test_data/cdsWithoutExon.gff3 -f`);
1046
+ let p = new Shell(`${apollo} feature search ${P} -t mrna01 -a cdsWithoutExon.gff3`);
1047
+ let out = JSON.parse(p.stdout);
1048
+ const gene = out.at(0);
1049
+ const mrna = Object.values(gene.children).at(0);
1050
+ const cdsExon = Object.values(mrna.children);
1051
+ const exon = cdsExon.filter((x) => x.type === 'exon');
1052
+ assert.deepStrictEqual(exon.length, 1);
1053
+ const exon_id = exon[0]._id;
1054
+ // Before edit
1055
+ p = new Shell(`${apollo} feature get-id ${P} -i ${exon_id}`);
1056
+ out = JSON.parse(p.stdout);
1057
+ assert.deepStrictEqual(out.at(0)?.max, 20);
1058
+ // After edit
1059
+ new Shell(`${apollo} feature edit-coords ${P} -i ${exon_id} -e 30`);
1060
+ p = new Shell(`${apollo} feature get-id ${P} -i ${exon_id}`);
1061
+ out = JSON.parse(p.stdout);
1062
+ assert.deepStrictEqual(out.at(0)?.max, 30);
1063
+ });
978
1064
  });
@@ -1,8 +1,8 @@
1
1
  import assert from 'node:assert';
2
- import { after, before, describe } from 'node:test';
3
- import { Shell } from './utils.js';
4
2
  import fs from 'node:fs';
5
3
  import path from 'node:path';
4
+ import { after, before, describe } from 'node:test';
5
+ import { Shell } from './utils.js';
6
6
  const hostTmpDir = path.resolve('tmpTestDocker');
7
7
  const hostDataDir = path.resolve('test_data');
8
8
  const apollo = `docker run --network host -v ${hostTmpDir}:/root/.config/apollo-cli -v ${hostDataDir}:/data apollo`;
package/dist/utils.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import EventEmitter from 'node:events';
2
- import type { SerializedAddAssemblyAndFeaturesFromFileChange, SerializedAddAssemblyFromExternalChange, SerializedAddAssemblyFromFileChange } from '@apollo-annotation/shared';
3
- import { Response } from 'undici';
1
+ import type EventEmitter from 'node:events';
2
+ import { type ApolloAssemblySnapshot } from '@apollo-annotation/mst';
3
+ import { type SerializedAddAssemblyAndFeaturesFromFileChange, type SerializedAddAssemblyFromExternalChange, type SerializedAddAssemblyFromFileChange } from '@apollo-annotation/shared';
4
+ import { type Response } from 'undici';
4
5
  import { ApolloConf } from './ApolloConf.js';
5
- import { ApolloAssemblySnapshot } from '@apollo-annotation/mst';
6
6
  export declare const CLI_SERVER_ADDRESS = "http://127.0.0.1:5657";
7
7
  export declare const CLI_SERVER_ADDRESS_CALLBACK = "http://127.0.0.1:5657/auth/callback";
8
8
  export declare class CheckError extends Error {
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as crypto from 'node:crypto';
2
2
  import * as fs from 'node:fs';
3
- import { stdin, stderr } from 'node:process';
3
+ import { stderr, stdin } from 'node:process';
4
4
  import { Agent, fetch } from 'undici';
5
5
  import { ApolloConf, ConfigError } from './ApolloConf.js';
6
6
  export const CLI_SERVER_ADDRESS = 'http://127.0.0.1:5657';
@@ -72,6 +72,7 @@ export async function getAssembly(address, accessToken, assemblyNameOrId) {
72
72
  const assemblies = (await res.json());
73
73
  for (const x of assemblies) {
74
74
  if (x._id === assemblyId[0]) {
75
+ // eslint-disable-next-line unicorn/prefer-structured-clone
75
76
  return JSON.parse(JSON.stringify(x));
76
77
  }
77
78
  }
@@ -2106,5 +2106,5 @@
2106
2106
  ]
2107
2107
  }
2108
2108
  },
2109
- "version": "0.3.4"
2109
+ "version": "0.3.6"
2110
2110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo-annotation/cli",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Command line interface for the Apollo annotation server",
5
5
  "repository": {
6
6
  "type": "git",
@@ -88,8 +88,8 @@
88
88
  "yaml": "^2.3.4"
89
89
  },
90
90
  "devDependencies": {
91
- "@apollo-annotation/mst": "^0.3.4",
92
- "@apollo-annotation/shared": "^0.3.4",
91
+ "@apollo-annotation/mst": "^0.3.6",
92
+ "@apollo-annotation/shared": "^0.3.6",
93
93
  "@istanbuljs/esm-loader-hook": "^0.2.0",
94
94
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
95
95
  "@oclif/test": "^3.1.3",
@@ -107,6 +107,7 @@
107
107
  "prettier": "^3.3.2",
108
108
  "react-dom": "^18.2.0",
109
109
  "rxjs": "^7.4.0",
110
+ "serve": "^14.0.1",
110
111
  "shx": "^0.3.3",
111
112
  "ts-node": "^10.3.0",
112
113
  "tsx": "^4.6.2",