diff --git a/lib/commands/unipept/taxa2lca.ts b/lib/commands/unipept/taxa2lca.ts index 0dccba06..a52c4625 100644 --- a/lib/commands/unipept/taxa2lca.ts +++ b/lib/commands/unipept/taxa2lca.ts @@ -11,6 +11,8 @@ export class Taxa2lca extends UnipeptSubcommand { The command will give priority to the first way NCBI Taxonomy Identifiers are passed, in the order as listed above. Text files and standard input should have one taxon id per line.`; + castInput = true; + constructor() { super("taxa2lca"); diff --git a/lib/commands/unipept/taxonomy.ts b/lib/commands/unipept/taxonomy.ts index ae8426a1..0798a2fd 100644 --- a/lib/commands/unipept/taxonomy.ts +++ b/lib/commands/unipept/taxonomy.ts @@ -11,6 +11,8 @@ export class Taxonomy extends UnipeptSubcommand { The command will give priority to the first way taxon id's are passed, in the order as listed above. Text files and standard input should have one taxon id per line.`; + castInput = true; + constructor() { super("taxonomy"); diff --git a/lib/commands/unipept/unipept_subcommand.ts b/lib/commands/unipept/unipept_subcommand.ts index 0a503047..cb30f2dd 100644 --- a/lib/commands/unipept/unipept_subcommand.ts +++ b/lib/commands/unipept/unipept_subcommand.ts @@ -23,6 +23,7 @@ export abstract class UnipeptSubcommand { firstBatch = true; selectedFields?: RegExp[]; fasta: boolean; + castInput = false; // we must save this to be able to close it properly in tests private streamInterface?: Interface; @@ -241,8 +242,12 @@ export abstract class UnipeptSubcommand { private constructRequestBody(slice: string[]): string { const names = this.getSelectedFields().length === 0 || this.getSelectedFields().some(regex => regex.toString().includes("name") || regex.toString().includes(".*$")); + let input: string[] | number[] = slice; + if (this.castInput) { + input = slice.map(s => parseInt(s, 10)); + } return JSON.stringify({ - input: slice, + input: input, equate_il: this.options.equate, extra: this.options.all, names: this.options.all && names