-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from unipept/next-unipept-subcommands
Implement all unipept subcommands and tests
- Loading branch information
Showing
27 changed files
with
714 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2ec extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2ec command retrieves from Unipept the set of EC numbers from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2ec"); | ||
|
||
this.command | ||
.summary("Fetch EC numbers of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "Also return the names of the EC numbers. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 100; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2funct extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2funct command retrieves from Unipept the set of EC numbers and GO terms from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2funct"); | ||
|
||
this.command | ||
.summary("Fetch EC numbers, GO terms and InterPro codes of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "Also return the names of the EC numbers, GO terms and InterPro codes. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 100; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2go extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2go command retrieves from Unipept the set of GO terms from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2go"); | ||
|
||
this.command | ||
.summary("Fetch GO terms of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "Also return the names of the GO terms. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 100; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2interpro extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2interpro command retrieves from Unipept the set of InterPro entries from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2interpro"); | ||
|
||
this.command | ||
.summary("Fetch InterPro entries of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "Also return the names of the InterPro entries. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 100; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2prot extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2prot command retrieves from Unipept all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2prot"); | ||
|
||
this.command | ||
.summary("Fetch UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "report all information fields of UniProt entries available in Unipept. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 5; | ||
} else { | ||
return 10; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Pept2taxa extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept pept2taxa command retrieves from Unipept the set of taxa from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("pept2taxa"); | ||
|
||
this.command | ||
.summary("Fetch taxa of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "report all information fields of NCBI Taxonomy records available in Unipept. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
return 5; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Peptinfo extends UnipeptSubcommand { | ||
|
||
readonly description = `For each tryptic peptide the unipept peptinfo command retrieves from Unipept the functional information and the lowest common ancestor of the set of taxa from all UniProt entries whose protein sequence contains an exact matches to the tryptic peptide. The lowest common ancestor is based on the topology of the Unipept Taxonomy -- a cleaned up version of the NCBI Taxonomy -- and is itself a record from the NCBI Taxonomy. The command expects a list of tryptic peptides that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way tryptic peptides are passed, in the order as listed above. Text files and standard input should have one tryptic peptide per line.`; | ||
|
||
constructor() { | ||
super("peptinfo"); | ||
|
||
this.command | ||
.summary("Fetch functional information and the taxonomic lowest common ancestor of UniProt entries that match tryptic peptides.") | ||
.description(this.description) | ||
.option("-e, --equate", "equate isoleucine (I) and leucine (L) when matching peptides") | ||
.option("-a, --all", "report the names of the functional annotations and all information fields of NCBI Taxonomy records available in Unipept. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[peptides...]", "optionally, 1 or more peptides") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["peptide"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
if (this.options.all) { | ||
return 100; | ||
} else { | ||
return 1000; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Protinfo extends UnipeptSubcommand { | ||
|
||
readonly description = `For each UniProt id the unipept protinfo command retrieves from Unipept the functional information and the NCBI id. The command expects a list of UniProt ids that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
The command will give priority to the first way protein id's are passed, in the order as listed above. Text files and standard input should have one protein id per line.`; | ||
|
||
constructor() { | ||
super("protinfo"); | ||
|
||
this.command | ||
.summary("Fetch functional and taxonomic information of UniProt ids") | ||
.description(this.description) | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[proteins...]", "optionally, 1 or more UniProt ids") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
requiredFields(): string[] { | ||
return ["protein"]; | ||
} | ||
|
||
defaultBatchSize(): number { | ||
return 1000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Option } from "commander"; | ||
import { UnipeptSubcommand } from "./unipept_subcommand.js"; | ||
|
||
export class Taxa2lca extends UnipeptSubcommand { | ||
|
||
readonly description = `The unipept taxa2lca command computes the lowest common ancestor of a given list of NCBI Taxonomy Identifiers. The lowest common ancestor is based on the topology of the Unipept Taxonomy -- a cleaned up version of the NCBI Taxonomy -- and is itself a record from the NCBI Taxonomy. The command expects a list of NCBI Taxonomy Identifiers that are passed | ||
- as separate command line arguments | ||
- in a text file that is passed as an argument to the -i option | ||
- to standard input | ||
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.`; | ||
|
||
constructor() { | ||
super("taxa2lca"); | ||
|
||
this.command | ||
.summary("Compute taxonomic lowest common ancestor for given list of taxa.") | ||
.description(this.description) | ||
.option("-a, --all", "report all information fields of NCBI Taxonomy records available in Unipept. Note that this may have a performance penalty.") | ||
.addOption(new Option("-s --select <fields...>", "select the information fields to return. Selected fields are passed as a comma separated list of field names. Multiple -s (or --select) options may be used.")) | ||
.argument("[taxonids...]", "optionally, 1 or more taxon ids") | ||
.action((args, options) => this.run(args, options)); | ||
} | ||
|
||
defaultBatchSize(): number { | ||
throw new Error("Batch size not needed for this command."); | ||
} | ||
} |
Oops, something went wrong.