Skip to content

Commit

Permalink
use integevers as input for taxa2lca and taxonomy
Browse files Browse the repository at this point in the history
  • Loading branch information
bmesuere committed Nov 28, 2024
1 parent 7c8d1a3 commit 5f14a81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/commands/unipept/taxa2lca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
2 changes: 2 additions & 0 deletions lib/commands/unipept/taxonomy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
7 changes: 6 additions & 1 deletion lib/commands/unipept/unipept_subcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f14a81

Please sign in to comment.