@apollo-annotation/cli 0.3.1 → 0.3.2

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.1 linux-x64 node-v18.20.5
19
+ @apollo-annotation/cli/0.3.2 linux-x64 node-v18.20.6
20
20
  $ apollo --help [COMMAND]
21
21
  USAGE
22
22
  $ apollo COMMAND
@@ -37,6 +37,7 @@ USAGE
37
37
  - [`apollo assembly sequence`](#apollo-assembly-sequence)
38
38
  - [`apollo change get`](#apollo-change-get)
39
39
  - [`apollo config [KEY] [VALUE]`](#apollo-config-key-value)
40
+ - [`apollo export gff3 ASSEMBLY`](#apollo-export-gff3-assembly)
40
41
  - [`apollo feature add-child`](#apollo-feature-add-child)
41
42
  - [`apollo feature check`](#apollo-feature-check)
42
43
  - [`apollo feature copy`](#apollo-feature-copy)
@@ -75,7 +76,8 @@ USAGE
75
76
  ARGUMENTS
76
77
  INPUT Input fasta file, local or remote, or id of a previously uploaded file. For local or remote files, it is
77
78
  assumed the file is bgzip'd with `bgzip` and indexed with `samtools faidx`. The indexes are assumed to be at
78
- <my.fasta.gz>.fai and <my.fasta.gz>.gzi unless the options --fai and --gzi are provided.
79
+ <my.fasta.gz>.fai and <my.fasta.gz>.gzi unless the options --fai and --gzi are provided. A local file can be
80
+ uncompressed if the flag -e/--editable is set (but see below about using -e)
79
81
 
80
82
  FLAGS
81
83
  -a, --assembly=<value> Name for this assembly. Use the file name if omitted
@@ -93,22 +95,26 @@ DESCRIPTION
93
95
  Add a new assembly from fasta input
94
96
 
95
97
  Add new assembly. The input fasta may be:
96
- * A local file
97
- * An external fasta file
98
+ * A local file bgzip'd and indexed. It can be uncompressed if the -e/--editable is set (but see description of -e)
99
+ * An external fasta file bgzip'd and indexed
98
100
  * The id of a file previously uploaded to Apollo
99
101
 
100
102
  EXAMPLES
101
- From local file:
103
+ From local file assuming indexes genome.gz.fai and genome.gz.gzi are present:
104
+
105
+ $ apollo assembly add-from-fasta genome.fa.gz -a myAssembly
106
+
107
+ Local file with editable sequence does not require compression and indexing:
102
108
 
103
109
  $ apollo assembly add-from-fasta genome.fa -a myAssembly
104
110
 
105
- From external source we also need the URL of the index:
111
+ From external source assuming there are also indexes https://.../genome.fa.gz.fai and https://.../genome.fa.gz.gzi:
106
112
 
107
- $ apollo assembly add-from-fasta https://.../genome.fa -x https://.../genome.fa.fai -a myAssembly
113
+ $ apollo assembly add-from-fasta https://.../genome.fa.gz -a myAssembly
108
114
  ```
109
115
 
110
116
  _See code:
111
- [src/commands/assembly/add-from-fasta.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/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.2/packages/apollo-cli/src/commands/assembly/add-from-fasta.ts)_
112
118
 
113
119
  ## `apollo assembly add-from-gff INPUT-FILE`
114
120
 
@@ -144,7 +150,7 @@ EXAMPLES
144
150
  ```
145
151
 
146
152
  _See code:
147
- [src/commands/assembly/add-from-gff.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/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.2/packages/apollo-cli/src/commands/assembly/add-from-gff.ts)_
148
154
 
149
155
  ## `apollo assembly check`
150
156
 
@@ -186,7 +192,7 @@ EXAMPLES
186
192
  ```
187
193
 
188
194
  _See code:
189
- [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/assembly/check.ts)_
195
+ [src/commands/assembly/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/assembly/check.ts)_
190
196
 
191
197
  ## `apollo assembly delete`
192
198
 
@@ -214,7 +220,7 @@ EXAMPLES
214
220
  ```
215
221
 
216
222
  _See code:
217
- [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/assembly/delete.ts)_
223
+ [src/commands/assembly/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/assembly/delete.ts)_
218
224
 
219
225
  ## `apollo assembly get`
220
226
 
@@ -236,7 +242,7 @@ DESCRIPTION
236
242
  ```
237
243
 
238
244
  _See code:
239
- [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/assembly/get.ts)_
245
+ [src/commands/assembly/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/assembly/get.ts)_
240
246
 
241
247
  ## `apollo assembly sequence`
242
248
 
@@ -271,7 +277,7 @@ EXAMPLES
271
277
  ```
272
278
 
273
279
  _See code:
274
- [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/assembly/sequence.ts)_
280
+ [src/commands/assembly/sequence.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/assembly/sequence.ts)_
275
281
 
276
282
  ## `apollo change get`
277
283
 
@@ -295,7 +301,7 @@ DESCRIPTION
295
301
  ```
296
302
 
297
303
  _See code:
298
- [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/change/get.ts)_
304
+ [src/commands/change/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/change/get.ts)_
299
305
 
300
306
  ## `apollo config [KEY] [VALUE]`
301
307
 
@@ -347,7 +353,35 @@ EXAMPLES
347
353
  ```
348
354
 
349
355
  _See code:
350
- [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/config.ts)_
356
+ [src/commands/config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/config.ts)_
357
+
358
+ ## `apollo export gff3 ASSEMBLY`
359
+
360
+ Export the annotations for an assembly to stdout as gff3
361
+
362
+ ```
363
+ USAGE
364
+ $ apollo export gff3 ASSEMBLY [--profile <value>] [--config-file <value>] [--include-fasta]
365
+
366
+ ARGUMENTS
367
+ ASSEMBLY Export annotations for this assembly name or id
368
+
369
+ FLAGS
370
+ --config-file=<value> Use this config file (mostly for testing)
371
+ --include-fasta Include fasta sequence in output
372
+ --profile=<value> Use credentials from this profile
373
+
374
+ DESCRIPTION
375
+ Export the annotations for an assembly to stdout as gff3
376
+
377
+ EXAMPLES
378
+ Export annotations for myAssembly:
379
+
380
+ $ apollo export gff3 myAssembly > out.gff3
381
+ ```
382
+
383
+ _See code:
384
+ [src/commands/export/gff3.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/export/gff3.ts)_
351
385
 
352
386
  ## `apollo feature add-child`
353
387
 
@@ -378,7 +412,7 @@ EXAMPLES
378
412
  ```
379
413
 
380
414
  _See code:
381
- [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/add-child.ts)_
415
+ [src/commands/feature/add-child.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/add-child.ts)_
382
416
 
383
417
  ## `apollo feature check`
384
418
 
@@ -411,7 +445,7 @@ EXAMPLES
411
445
  ```
412
446
 
413
447
  _See code:
414
- [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/check.ts)_
448
+ [src/commands/feature/check.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/check.ts)_
415
449
 
416
450
  ## `apollo feature copy`
417
451
 
@@ -442,7 +476,7 @@ EXAMPLES
442
476
  ```
443
477
 
444
478
  _See code:
445
- [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/copy.ts)_
479
+ [src/commands/feature/copy.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/copy.ts)_
446
480
 
447
481
  ## `apollo feature delete`
448
482
 
@@ -466,7 +500,7 @@ DESCRIPTION
466
500
  ```
467
501
 
468
502
  _See code:
469
- [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/delete.ts)_
503
+ [src/commands/feature/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/delete.ts)_
470
504
 
471
505
  ## `apollo feature edit`
472
506
 
@@ -508,7 +542,7 @@ EXAMPLES
508
542
  ```
509
543
 
510
544
  _See code:
511
- [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/edit.ts)_
545
+ [src/commands/feature/edit.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/edit.ts)_
512
546
 
513
547
  ## `apollo feature edit-attribute`
514
548
 
@@ -548,7 +582,7 @@ EXAMPLES
548
582
  ```
549
583
 
550
584
  _See code:
551
- [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
585
+ [src/commands/feature/edit-attribute.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/edit-attribute.ts)_
552
586
 
553
587
  ## `apollo feature edit-coords`
554
588
 
@@ -582,7 +616,7 @@ EXAMPLES
582
616
  ```
583
617
 
584
618
  _See code:
585
- [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
619
+ [src/commands/feature/edit-coords.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/edit-coords.ts)_
586
620
 
587
621
  ## `apollo feature edit-type`
588
622
 
@@ -606,7 +640,7 @@ DESCRIPTION
606
640
  ```
607
641
 
608
642
  _See code:
609
- [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/edit-type.ts)_
643
+ [src/commands/feature/edit-type.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/edit-type.ts)_
610
644
 
611
645
  ## `apollo feature get`
612
646
 
@@ -640,7 +674,7 @@ EXAMPLES
640
674
  ```
641
675
 
642
676
  _See code:
643
- [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/get.ts)_
677
+ [src/commands/feature/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/get.ts)_
644
678
 
645
679
  ## `apollo feature get-id`
646
680
 
@@ -668,7 +702,7 @@ EXAMPLES
668
702
  ```
669
703
 
670
704
  _See code:
671
- [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/get-id.ts)_
705
+ [src/commands/feature/get-id.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/get-id.ts)_
672
706
 
673
707
  ## `apollo feature import INPUT-FILE`
674
708
 
@@ -699,7 +733,7 @@ EXAMPLES
699
733
  ```
700
734
 
701
735
  _See code:
702
- [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/import.ts)_
736
+ [src/commands/feature/import.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/import.ts)_
703
737
 
704
738
  ## `apollo feature search`
705
739
 
@@ -750,7 +784,7 @@ EXAMPLES
750
784
  ```
751
785
 
752
786
  _See code:
753
- [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/feature/search.ts)_
787
+ [src/commands/feature/search.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/feature/search.ts)_
754
788
 
755
789
  ## `apollo file delete`
756
790
 
@@ -777,7 +811,7 @@ EXAMPLES
777
811
  ```
778
812
 
779
813
  _See code:
780
- [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/file/delete.ts)_
814
+ [src/commands/file/delete.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/file/delete.ts)_
781
815
 
782
816
  ## `apollo file download`
783
817
 
@@ -805,7 +839,7 @@ EXAMPLES
805
839
  ```
806
840
 
807
841
  _See code:
808
- [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/file/download.ts)_
842
+ [src/commands/file/download.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/file/download.ts)_
809
843
 
810
844
  ## `apollo file get`
811
845
 
@@ -832,7 +866,7 @@ EXAMPLES
832
866
  ```
833
867
 
834
868
  _See code:
835
- [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/file/get.ts)_
869
+ [src/commands/file/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/file/get.ts)_
836
870
 
837
871
  ## `apollo file upload INPUT-FILE`
838
872
 
@@ -869,7 +903,7 @@ EXAMPLES
869
903
  ```
870
904
 
871
905
  _See code:
872
- [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/file/upload.ts)_
906
+ [src/commands/file/upload.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/file/upload.ts)_
873
907
 
874
908
  ## `apollo help [COMMANDS]`
875
909
 
@@ -916,7 +950,7 @@ EXAMPLES
916
950
  ```
917
951
 
918
952
  _See code:
919
- [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
953
+ [src/commands/jbrowse/get-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/jbrowse/get-config.ts)_
920
954
 
921
955
  ## `apollo jbrowse set-config INPUTFILE`
922
956
 
@@ -945,7 +979,7 @@ EXAMPLES
945
979
  ```
946
980
 
947
981
  _See code:
948
- [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
982
+ [src/commands/jbrowse/set-config.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/jbrowse/set-config.ts)_
949
983
 
950
984
  ## `apollo login`
951
985
 
@@ -984,7 +1018,7 @@ EXAMPLES
984
1018
  ```
985
1019
 
986
1020
  _See code:
987
- [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/login.ts)_
1021
+ [src/commands/login.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/login.ts)_
988
1022
 
989
1023
  ## `apollo logout`
990
1024
 
@@ -1014,7 +1048,7 @@ EXAMPLES
1014
1048
  ```
1015
1049
 
1016
1050
  _See code:
1017
- [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/logout.ts)_
1051
+ [src/commands/logout.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/logout.ts)_
1018
1052
 
1019
1053
  ## `apollo refseq add-alias INPUT-FILE`
1020
1054
 
@@ -1045,7 +1079,7 @@ EXAMPLES
1045
1079
  ```
1046
1080
 
1047
1081
  _See code:
1048
- [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1082
+ [src/commands/refseq/add-alias.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/refseq/add-alias.ts)_
1049
1083
 
1050
1084
  ## `apollo refseq get`
1051
1085
 
@@ -1077,7 +1111,7 @@ EXAMPLES
1077
1111
  ```
1078
1112
 
1079
1113
  _See code:
1080
- [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/refseq/get.ts)_
1114
+ [src/commands/refseq/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/refseq/get.ts)_
1081
1115
 
1082
1116
  ## `apollo status`
1083
1117
 
@@ -1099,7 +1133,7 @@ DESCRIPTION
1099
1133
  ```
1100
1134
 
1101
1135
  _See code:
1102
- [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/status.ts)_
1136
+ [src/commands/status.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/status.ts)_
1103
1137
 
1104
1138
  ## `apollo user get`
1105
1139
 
@@ -1135,6 +1169,6 @@ EXAMPLES
1135
1169
  ```
1136
1170
 
1137
1171
  _See code:
1138
- [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.1/packages/apollo-cli/src/commands/user/get.ts)_
1172
+ [src/commands/user/get.ts](https://github.com/GMOD/Apollo3/blob/v0.3.2/packages/apollo-cli/src/commands/user/get.ts)_
1139
1173
 
1140
1174
  <!-- commandsstop -->
@@ -8,17 +8,21 @@ import { queryApollo, submitAssembly } from '../../utils.js';
8
8
  export default class AddFasta extends FileCommand {
9
9
  static summary = 'Add a new assembly from fasta input';
10
10
  static description = `Add new assembly. The input fasta may be:
11
- * A local file
12
- * An external fasta file
11
+ * A local file bgzip'd and indexed. It can be uncompressed if the -e/--editable is set (but see description of -e)
12
+ * An external fasta file bgzip'd and indexed
13
13
  * The id of a file previously uploaded to Apollo`;
14
14
  static examples = [
15
15
  {
16
- description: 'From local file:',
16
+ description: 'From local file assuming indexes genome.gz.fai and genome.gz.gzi are present:',
17
+ command: '<%= config.bin %> <%= command.id %> genome.fa.gz -a myAssembly',
18
+ },
19
+ {
20
+ description: 'Local file with editable sequence does not require compression and indexing:',
17
21
  command: '<%= config.bin %> <%= command.id %> genome.fa -a myAssembly',
18
22
  },
19
23
  {
20
- description: 'From external source we also need the URL of the index:',
21
- command: '<%= config.bin %> <%= command.id %> https://.../genome.fa -x https://.../genome.fa.fai -a myAssembly',
24
+ description: 'From external source assuming there are also indexes https://.../genome.fa.gz.fai and https://.../genome.fa.gz.gzi:',
25
+ command: '<%= config.bin %> <%= command.id %> https://.../genome.fa.gz -a myAssembly',
22
26
  },
23
27
  ];
24
28
  static args = {
@@ -27,7 +31,7 @@ export default class AddFasta extends FileCommand {
27
31
  file. For local or remote files, it is assumed the file is bgzip'd with \
28
32
  `bgzip` and indexed with `samtools faidx`. The indexes are assumed to be at \
29
33
  <my.fasta.gz>.fai and <my.fasta.gz>.gzi unless the options --fai and --gzi are \
30
- provided.",
34
+ provided. A local file can be uncompressed if the flag -e/--editable is set (but see below about using -e)",
31
35
  required: true,
32
36
  }),
33
37
  };
@@ -71,8 +75,19 @@ often has unintended side effects.',
71
75
  const isExternal = isValidHttpUrl(args.input);
72
76
  let body;
73
77
  if (isExternal) {
78
+ if (flags.editable) {
79
+ this.error(`External fasta files are not editable. The -e/--editable has been set with an external input file.`);
80
+ }
74
81
  const fai = flags.fai ?? `${args.input}.fai`;
82
+ const faiExists = await fetch(fai);
83
+ if (!faiExists.ok) {
84
+ this.error(`Index file ${fai} does not exist`);
85
+ }
75
86
  const gzi = flags.gzi ?? `${args.input}.gzi`;
87
+ const gziExists = await fetch(gzi);
88
+ if (!gziExists.ok) {
89
+ this.error(`Index file ${gzi} does not exist`);
90
+ }
76
91
  body = {
77
92
  assemblyName,
78
93
  typeName: 'AddAssemblyFromExternalChange',
@@ -106,8 +121,8 @@ often has unintended side effects.',
106
121
  const fai = flags.fai ?? `${args.input}.fai`;
107
122
  const gziIsFileId = await isFileId(gzi, access.address, access.accessToken);
108
123
  const faiIsFileId = await isFileId(fai, access.address, access.accessToken);
109
- if (!fs.existsSync(gzi) && !gziIsFileId) {
110
- this.error(`Only bgzip'd and indexed fasta files are supported at the moment. "${gzi}" is neither a file or a file id`);
124
+ if (!fs.existsSync(gzi) && !gziIsFileId && !flags.editable) {
125
+ this.error(`Only bgzip'd and indexed fasta files are supported unless option -e/--editable is set. "${gzi}" is neither a file or a file id`);
111
126
  }
112
127
  if (!fs.existsSync(fai) && !faiIsFileId) {
113
128
  this.error(`Only bgzip'd and indexed fasta files are supported at the moment. "${fai}" is neither a file or a file id`);
@@ -0,0 +1,15 @@
1
+ import { BaseCommand } from '../../baseCommand.js';
2
+ export default class Get extends BaseCommand<typeof Get> {
3
+ static description: string;
4
+ static examples: {
5
+ description: string;
6
+ command: string;
7
+ }[];
8
+ static args: {
9
+ assembly: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
10
+ };
11
+ static flags: {
12
+ 'include-fasta': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<void>;
15
+ }
@@ -0,0 +1,74 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { fetch } from 'undici';
3
+ import { BaseCommand } from '../../baseCommand.js';
4
+ import { convertAssemblyNameToId, createFetchErrorMessage, idReader, localhostToAddress, } from '../../utils.js';
5
+ import { Readable } from 'node:stream';
6
+ export default class Get extends BaseCommand {
7
+ static description = 'Export the annotations for an assembly to stdout as gff3';
8
+ static examples = [
9
+ {
10
+ description: 'Export annotations for myAssembly:',
11
+ command: '<%= config.bin %> <%= command.id %> myAssembly > out.gff3',
12
+ },
13
+ ];
14
+ static args = {
15
+ assembly: Args.string({
16
+ description: 'Export annotations for this assembly name or id',
17
+ required: true,
18
+ }),
19
+ };
20
+ static flags = {
21
+ 'include-fasta': Flags.boolean({
22
+ description: 'Include fasta sequence in output',
23
+ default: false,
24
+ }),
25
+ };
26
+ async run() {
27
+ const { args } = await this.parse(Get);
28
+ const access = await this.getAccess();
29
+ const assembly = await idReader([args.assembly]);
30
+ const [assemblyId] = await convertAssemblyNameToId(access.address, access.accessToken, assembly);
31
+ if (!assemblyId) {
32
+ this.error(`Invalid assembly name or id: ${args.assembly}`);
33
+ }
34
+ const url = new URL(localhostToAddress(`${access.address}/export/getID`));
35
+ const searchParams = new URLSearchParams({
36
+ assembly: assemblyId,
37
+ });
38
+ url.search = searchParams.toString();
39
+ const uri = url.toString();
40
+ const auth = {
41
+ headers: {
42
+ authorization: `Bearer ${access.accessToken}`,
43
+ },
44
+ };
45
+ const response = await fetch(uri, auth);
46
+ if (!response.ok) {
47
+ const newErrorMessage = await createFetchErrorMessage(response, 'Error when exporting ID');
48
+ throw new Error(newErrorMessage);
49
+ }
50
+ const { exportID } = (await response.json());
51
+ const exportURL = new URL(localhostToAddress(`${access.address}/export`));
52
+ const params = {
53
+ exportID,
54
+ assemblyId,
55
+ includeFASTA: this.flags['include-fasta'] ? 'true' : 'false',
56
+ };
57
+ const exportSearchParams = new URLSearchParams(params);
58
+ exportURL.search = exportSearchParams.toString();
59
+ const exportUri = exportURL.toString();
60
+ const responseExport = await fetch(exportUri, auth);
61
+ if (!responseExport.ok) {
62
+ const newErrorMessage = await createFetchErrorMessage(responseExport, 'Error when exporting gff');
63
+ throw new Error(newErrorMessage);
64
+ }
65
+ const { body } = responseExport;
66
+ if (body) {
67
+ const readable = Readable.from(body);
68
+ readable.pipe(process.stdout);
69
+ }
70
+ else {
71
+ this.error('Failed to export gff3');
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * USAGE
3
+ * From package root directory (`packages/apollo-cli`). Run all tests:
4
+ *
5
+ * yarn test:cli
6
+ *
7
+ * Run only matching pattern:
8
+ *
9
+ * yarn test:cli --test-name-pattern='Print help|Feature get'
10
+ */
11
+ export {};