@biolibs/bionet-agent 0.1.2 → 0.1.5
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 +46 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/known.d.ts +28 -0
- package/dist/known.d.ts.map +1 -0
- package/dist/known.js +239 -0
- package/dist/known.js.map +1 -0
- package/dist/papers.d.ts +33 -0
- package/dist/papers.d.ts.map +1 -0
- package/dist/papers.js +273 -0
- package/dist/papers.js.map +1 -0
- package/dist/tools.d.ts +14 -3
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +427 -18
- package/dist/tools.js.map +1 -1
- package/package.json +5 -3
- package/src/index.ts +5 -1
- package/src/known.ts +241 -0
- package/src/papers.ts +271 -0
- package/src/tools.ts +421 -21
package/README.md
CHANGED
|
@@ -72,18 +72,63 @@ system's keychain, and puts that command on the clipboard without showing the to
|
|
|
72
72
|
| `find_cutters` | Which enzymes cut a part, and where |
|
|
73
73
|
| `design_primers` | A pair for a stretch or a feature, with why each won and what to watch for |
|
|
74
74
|
| `work_out_pcr`, `work_out_digest`, `work_out_ligation` | What each would give, from the lab's own engines |
|
|
75
|
+
| `list_strains` | What the lab keeps alive, what has been put into it, and the cultures of each |
|
|
76
|
+
| `translate_gene` | The protein a gene codes for, and what its sequence says about it |
|
|
77
|
+
| `work_out_induction` | The protein growing a culture would make, its mass, and where its band should run |
|
|
78
|
+
| `propose_transformation` | Propose putting a construct into a living host |
|
|
79
|
+
| `propose_induction` | Propose growing a culture and turning its promoter on |
|
|
75
80
|
| `add_part` | Say a sequence is a part, such as a primer just designed. Adds no tube |
|
|
76
81
|
| `propose_pcr`, `propose_digest`, `propose_ligation` | Propose a run. Nothing is used or recorded as done |
|
|
77
82
|
| `withdraw_proposal` | Take back a proposal of its own |
|
|
83
|
+
| `search_proteins`, `look_up_protein` | What UniProt knows about a protein: its mature chain, its modified residues, its variants |
|
|
84
|
+
| `work_out_phosphorylation` | Which residues would be phosphorylated, and whether the host has the enzyme |
|
|
85
|
+
| `search_papers` | Search the literature at Europe PMC: PubMed, PMC, preprints and patents together |
|
|
86
|
+
| `read_paper` | Read an open-access paper: its abstract, a named section such as the methods, or its tables |
|
|
87
|
+
| `papers_around` | What a paper cited, and who has cited it since |
|
|
78
88
|
| `search_ncbi` | Search NCBI's nucleotide, protein, gene or pubmed databases by keyword |
|
|
79
89
|
| `fetch_from_ncbi` | Read one record by accession: its sequence, and what it says is marked on it |
|
|
80
90
|
| `keep_from_ncbi` | Keep one as a part, with what the record says is marked on it. No tube |
|
|
81
91
|
|
|
82
|
-
`add_part`, `keep_from_ncbi`, the
|
|
92
|
+
`add_part`, `keep_from_ncbi`, the `propose_` tools and `withdraw_proposal` are the only ones
|
|
83
93
|
that write. A
|
|
84
94
|
proposal may count on a part there is no tube of yet; it then says that the part has to be ordered
|
|
85
95
|
or made first.
|
|
86
96
|
|
|
97
|
+
### Whether the protein will work, not just whether it gets made
|
|
98
|
+
|
|
99
|
+
`look_up_protein` and `work_out_phosphorylation` go to UniProt and to the motif rules. They answer the
|
|
100
|
+
question a project to make a milk protein actually turns on, which is not the question of whether the
|
|
101
|
+
host will express it.
|
|
102
|
+
|
|
103
|
+
`look_up_protein` gives the **mature chain** apart from the precursor — different lengths, different
|
|
104
|
+
masses, and the band a lab should look for is the chain's — and every residue that carries something
|
|
105
|
+
after the protein is made, counted both on the entry (how a paper cites it) and on the chain (how a
|
|
106
|
+
lab holding it counts). It says whether a curator read the entry or a machine inferred it.
|
|
107
|
+
|
|
108
|
+
`work_out_phosphorylation` applies the kinase motifs, compares them against what the curator recorded,
|
|
109
|
+
and says whether the host has the enzyme at all. The comparison is the useful part: on bovine
|
|
110
|
+
β-casein the rule reproduces every recorded site, which is the reason to believe it on a variant
|
|
111
|
+
nobody has studied. The host answer is explicitly not computed, and says so.
|
|
112
|
+
|
|
113
|
+
### Reading what other people did
|
|
114
|
+
|
|
115
|
+
`search_papers`, `read_paper` and `papers_around` go to Europe PMC. They are what turns "which host
|
|
116
|
+
should we express this in?" from something an adviser answers out of whatever it happens to know into
|
|
117
|
+
something it answers with a paper: this group used this host with this promoter and got this much,
|
|
118
|
+
here is the section that says so, here is where to read it.
|
|
119
|
+
|
|
120
|
+
`read_paper` with `section: "methods"` is the one that earns its place. A paper's methods are where
|
|
121
|
+
the recipe is — which strain, which plasmid, what the medium was, what it was induced with and for how
|
|
122
|
+
long — and it comes back as prose, with the citation markers taken out and the tables kept apart.
|
|
123
|
+
Most papers are not open access; a search result says plainly whether its full text can be read, and
|
|
124
|
+
for the rest there is the abstract and a link.
|
|
125
|
+
|
|
126
|
+
The arc the tools are for runs from a gene to a protein: find it, design the primers, work out the PCR,
|
|
127
|
+
design the assembly, rewrite it in the host's codons, check the read against the design, put it into a
|
|
128
|
+
host, and grow that host to make the protein. The last step is the one where the adviser has least to
|
|
129
|
+
say and should say so: `work_out_induction` gives the protein the gene codes for and the mass to look
|
|
130
|
+
for, and predicts no yield, because nothing in a sequence predicts one.
|
|
131
|
+
|
|
87
132
|
### Looking something up
|
|
88
133
|
|
|
89
134
|
The last three are the only ones that reach outside the lab, to NCBI's public databases. They are
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* merges the lab's logs holds it to that.
|
|
9
9
|
*
|
|
10
10
|
* - `tools.ts` — what an adviser is given: the lab to read, the engines, and three things to write
|
|
11
|
-
* - `lookup.ts` — the
|
|
11
|
+
* - `lookup.ts` — the ones that reach outside it, to NCBI's public databases
|
|
12
|
+
* - `papers.ts` — the ones that read the literature, at Europe PMC
|
|
13
|
+
* - `known.ts` — and the ones that say what is known about a protein, at UniProt
|
|
12
14
|
* - `serve.ts` — those tools served over the Model Context Protocol, on this machine only
|
|
13
15
|
*
|
|
14
16
|
* The device that hosts the adviser keeps its key (`hostAdviser` in `@biolibs/bionet-client`), and
|
|
@@ -17,5 +19,7 @@
|
|
|
17
19
|
*/
|
|
18
20
|
export * from "./tools.js";
|
|
19
21
|
export * from "./lookup.js";
|
|
22
|
+
export * from "./papers.js";
|
|
23
|
+
export * from "./known.js";
|
|
20
24
|
export * from "./serve.js";
|
|
21
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* merges the lab's logs holds it to that.
|
|
9
9
|
*
|
|
10
10
|
* - `tools.ts` — what an adviser is given: the lab to read, the engines, and three things to write
|
|
11
|
-
* - `lookup.ts` — the
|
|
11
|
+
* - `lookup.ts` — the ones that reach outside it, to NCBI's public databases
|
|
12
|
+
* - `papers.ts` — the ones that read the literature, at Europe PMC
|
|
13
|
+
* - `known.ts` — and the ones that say what is known about a protein, at UniProt
|
|
12
14
|
* - `serve.ts` — those tools served over the Model Context Protocol, on this machine only
|
|
13
15
|
*
|
|
14
16
|
* The device that hosts the adviser keeps its key (`hostAdviser` in `@biolibs/bionet-client`), and
|
|
@@ -17,5 +19,7 @@
|
|
|
17
19
|
*/
|
|
18
20
|
export * from "./tools.js";
|
|
19
21
|
export * from "./lookup.js";
|
|
22
|
+
export * from "./papers.js";
|
|
23
|
+
export * from "./known.js";
|
|
20
24
|
export * from "./serve.js";
|
|
21
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dist/known.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentTool } from "./tools.js";
|
|
2
|
+
/** The most results one protein search gives back. */
|
|
3
|
+
export declare const MOST_PROTEINS = 25;
|
|
4
|
+
/** How an adviser reaches UniProt. */
|
|
5
|
+
export interface KnownOptions {
|
|
6
|
+
/** Whether to offer these tools at all. On unless a host says otherwise. */
|
|
7
|
+
known?: boolean;
|
|
8
|
+
/** What to call this software to UniProt. Never a person's name. */
|
|
9
|
+
tool?: string;
|
|
10
|
+
/** An address UniProt could use about heavy use, if somebody has set one on purpose. */
|
|
11
|
+
email?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The tools that say what is known about a protein.
|
|
15
|
+
*
|
|
16
|
+
* @param options - Whether to offer them, and what to tell UniProt about who is asking.
|
|
17
|
+
* @returns The tools, or none if a host asked for none.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { knownTools } from "@biolibs/bionet-agent";
|
|
22
|
+
*
|
|
23
|
+
* knownTools().map((one) => one.name);
|
|
24
|
+
* // ["search_proteins", "look_up_protein", "work_out_phosphorylation"]
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function knownTools(options?: KnownOptions): AgentTool[];
|
|
28
|
+
//# sourceMappingURL=known.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known.d.ts","sourceRoot":"","sources":["../src/known.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,sDAAsD;AACtD,eAAO,MAAM,aAAa,KAAK,CAAC;AAEhC,sCAAsC;AACtC,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAuCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,EAAE,CAyJlE"}
|
package/dist/known.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What is known about a protein, and what would be done to it: UniProt, and the motif rules.
|
|
3
|
+
*
|
|
4
|
+
* These two belong together because neither is worth much alone, and together they answer the
|
|
5
|
+
* question a project like making casein in yeast actually turns on.
|
|
6
|
+
*
|
|
7
|
+
* UniProt alone gives a record: here are the five phosphoserines somebody read out of a paper.
|
|
8
|
+
* That is true of the cow's protein and says nothing about a variant, or about a gene that has
|
|
9
|
+
* been rewritten in another host's codons. The motif rules alone give a prediction, and a
|
|
10
|
+
* prediction over a few residues is a thing to be sceptical of. Put together, the comparison is
|
|
11
|
+
* the useful object: the rule reproduces the record on the protein somebody has studied, so it can
|
|
12
|
+
* be believed on the one nobody has.
|
|
13
|
+
*
|
|
14
|
+
* The other thing these answer is the one a lab finds out too late. A host will happily make a
|
|
15
|
+
* protein of the right mass that is the wrong thing, because the modification that makes it work is
|
|
16
|
+
* put on by an enzyme the host does not have. An adviser that can say that before the month is
|
|
17
|
+
* spent is worth more than one that can design the construct.
|
|
18
|
+
*/
|
|
19
|
+
import { UniProtError, lookUpProtein, onTheChain, readProtein, searchProteins, settings } from "@biolibs/uniprot";
|
|
20
|
+
import { HOST_KINASES, PHOSPHO_MOTIFS, comparedWithKnown, hostPhosphorylation, phosphoSites, phosphoWorking } from "@biolibs/bionet-tools";
|
|
21
|
+
/** The most results one protein search gives back. */
|
|
22
|
+
export const MOST_PROTEINS = 25;
|
|
23
|
+
const text = (value, what) => {
|
|
24
|
+
if (typeof value !== "string" || value.trim() === "")
|
|
25
|
+
throw new Error(`${what} has to be given, as text.`);
|
|
26
|
+
return value.trim();
|
|
27
|
+
};
|
|
28
|
+
const whole = (value, what) => {
|
|
29
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value))
|
|
30
|
+
throw new Error(`${what} has to be a whole number.`);
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
/** What UniProt said went wrong, in words the agent can do something about. */
|
|
34
|
+
const asTrouble = (cause) => {
|
|
35
|
+
if (cause instanceof UniProtError) {
|
|
36
|
+
if (cause.status === 429)
|
|
37
|
+
return new Error("UniProt is being asked too often just now. Wait a little and ask again.");
|
|
38
|
+
if (cause.offline)
|
|
39
|
+
return new Error("UniProt could not be reached. This device may be offline.");
|
|
40
|
+
return new Error(cause.message);
|
|
41
|
+
}
|
|
42
|
+
return cause instanceof Error ? cause : new Error(String(cause));
|
|
43
|
+
};
|
|
44
|
+
/** A protein said the way the rest of these tools say things. */
|
|
45
|
+
const proteinView = (protein) => ({
|
|
46
|
+
accession: protein.accession, entry: protein.entryName, name: protein.name,
|
|
47
|
+
gene: protein.gene, organism: protein.organism,
|
|
48
|
+
// The first thing to look at, and the thing an agent is most likely to skip past.
|
|
49
|
+
reviewed_by_a_curator: protein.reviewed,
|
|
50
|
+
...(protein.reviewed ? {} : { unreviewed_note: "This entry was made by machine from similarity, not read out of papers by anybody. What it says is marked on the protein is a guess, and a guess of a different kind from a curator's reading." }),
|
|
51
|
+
precursor_length: protein.length,
|
|
52
|
+
...(protein.mass === null ? {} : { precursor_mass_daltons: protein.mass }),
|
|
53
|
+
...(protein.signal === null ? {} : { signal_peptide: `${protein.signal.from}-${protein.signal.to}` }),
|
|
54
|
+
...(protein.chain === null ? { mature_chain: null } : { mature_chain: {
|
|
55
|
+
name: protein.chain.name, lies: `${protein.chain.from}-${protein.chain.to}`, residues: protein.chain.length,
|
|
56
|
+
note: "This is what a lab ends up holding, and what its band on a gel is. The entry's own sequence is the precursor and is longer.",
|
|
57
|
+
} }),
|
|
58
|
+
keywords: protein.keywords.slice(0, 12),
|
|
59
|
+
look_at: protein.lookAt,
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* The tools that say what is known about a protein.
|
|
63
|
+
*
|
|
64
|
+
* @param options - Whether to offer them, and what to tell UniProt about who is asking.
|
|
65
|
+
* @returns The tools, or none if a host asked for none.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { knownTools } from "@biolibs/bionet-agent";
|
|
70
|
+
*
|
|
71
|
+
* knownTools().map((one) => one.name);
|
|
72
|
+
* // ["search_proteins", "look_up_protein", "work_out_phosphorylation"]
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function knownTools(options = {}) {
|
|
76
|
+
if (options.known === false)
|
|
77
|
+
return [];
|
|
78
|
+
settings.tool = options.tool ?? "bionet-adviser";
|
|
79
|
+
if (options.email !== undefined)
|
|
80
|
+
settings.email = options.email;
|
|
81
|
+
/** Fetch and read one entry. */
|
|
82
|
+
const entry = async (accession) => {
|
|
83
|
+
try {
|
|
84
|
+
return readProtein(await lookUpProtein(accession));
|
|
85
|
+
}
|
|
86
|
+
catch (cause) {
|
|
87
|
+
throw asTrouble(cause);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return [
|
|
91
|
+
{
|
|
92
|
+
name: "search_proteins", title: "Find a protein in UniProt", readOnly: true,
|
|
93
|
+
description: [
|
|
94
|
+
"Search UniProt for a protein, to get the accession that look_up_protein needs.",
|
|
95
|
+
"The query takes plain words and UniProt's fields: `gene:CSN2`, `organism_id:9913`, `taxonomy_name:\"Bos taurus\"`, `reviewed:true`, `length:[200 TO 300]`. For example: `casein AND organism_id:9913`.",
|
|
96
|
+
"Each result says whether a curator has been over it. A reviewed entry (Swiss-Prot) has been read out of papers by somebody; an unreviewed one (TrEMBL) was made by machine from similarity. Prefer a reviewed entry, and say which kind you used.",
|
|
97
|
+
"This reaches the internet. Only the query is sent.",
|
|
98
|
+
].join(" "),
|
|
99
|
+
input: { type: "object", required: ["query"], additionalProperties: false, properties: {
|
|
100
|
+
query: { type: "string", description: "What to look for, in UniProt's syntax." },
|
|
101
|
+
reviewed_only: { type: "boolean", description: "Only entries a curator has been over. Usually what you want." },
|
|
102
|
+
limit: { type: "integer", description: `How many, up to ${MOST_PROTEINS}. 10 if not given.` },
|
|
103
|
+
} },
|
|
104
|
+
run: async (args) => {
|
|
105
|
+
const query = text(args["query"], "The query");
|
|
106
|
+
if (query.length > 300)
|
|
107
|
+
throw new Error("A query is at most 300 characters. This searches by words; a sequence is not something to put in one.");
|
|
108
|
+
try {
|
|
109
|
+
const found = await searchProteins(query, {
|
|
110
|
+
...(args["reviewed_only"] === true ? { reviewedOnly: true } : {}),
|
|
111
|
+
...(args["limit"] === undefined ? {} : { limit: Math.min(MOST_PROTEINS, whole(args["limit"], "The limit")) }),
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
query: found.query,
|
|
115
|
+
results: found.results.map((one) => ({
|
|
116
|
+
accession: one.accession, entry: one.entryName, name: one.name, gene: one.gene,
|
|
117
|
+
organism: one.organism, precursor_length: one.length, reviewed_by_a_curator: one.reviewed, look_at: one.lookAt,
|
|
118
|
+
})),
|
|
119
|
+
...(found.results.length === 0 ? { note: "Nothing matched. Try fewer words, or an organism as organism_id:9913." } : {}),
|
|
120
|
+
from_outside: "This came from UniProt and is what is known outside this lab.",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (cause) {
|
|
124
|
+
throw asTrouble(cause);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "look_up_protein", title: "What UniProt knows about a protein", readOnly: true,
|
|
130
|
+
description: [
|
|
131
|
+
"Read one UniProt entry: what the protein is, where its signal peptide and its mature chain lie, every residue that is modified after it is made, where it varies between individuals or breeds, and its named parts.",
|
|
132
|
+
"Two things here are worth more than the rest.",
|
|
133
|
+
"The mature chain is what a lab actually ends up holding. A UniProt entry's own sequence is usually the precursor, signal peptide and all, and the two are different lengths and so different masses on a gel. Use the chain when you are saying what band to look for.",
|
|
134
|
+
"The modified residues are what a sequence cannot tell you. For a protein like casein the phosphoserines are the whole point — they are what lets it build a micelle — and whether the host will put them on is a different question from whether it will make the protein. work_out_phosphorylation asks that one.",
|
|
135
|
+
"Positions are given both ways: on the entry, which is how UniProt counts and how a paper will cite it, and on the mature chain, which is how a lab holding the protein counts. They differ by the length of the signal peptide, and confusing them is the easiest mistake here to make.",
|
|
136
|
+
"This reaches the internet. Only the accession is sent, and nothing is added to the lab.",
|
|
137
|
+
].join(" "),
|
|
138
|
+
input: { type: "object", required: ["accession"], additionalProperties: false, properties: {
|
|
139
|
+
accession: { type: "string", description: "The UniProt accession, such as P02666." },
|
|
140
|
+
include: { type: "string", enum: ["all", "variants", "regions"], description: "Bring the sequence variants or the named parts too; both are long. Left out if not given." },
|
|
141
|
+
} },
|
|
142
|
+
run: async (args) => {
|
|
143
|
+
const protein = await entry(text(args["accession"], "The accession"));
|
|
144
|
+
const wanted = args["include"] === undefined ? "" : text(args["include"], "What to include");
|
|
145
|
+
const both = (at) => {
|
|
146
|
+
const on = onTheChain(protein, at);
|
|
147
|
+
return { on_the_entry: at, ...(on === null ? { on_the_mature_chain: null } : { on_the_mature_chain: on }) };
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
...proteinView(protein),
|
|
151
|
+
sequence: protein.sequence,
|
|
152
|
+
...(protein.chain === null ? {} : { mature_sequence: protein.chain.sequence }),
|
|
153
|
+
modified_residues: protein.modifications.map((one) => ({
|
|
154
|
+
...both(one.at), residue: one.residue, what: one.what,
|
|
155
|
+
evidence_cited: one.evidenced,
|
|
156
|
+
})),
|
|
157
|
+
...(protein.modifications.length === 0 ? { modified_residues_note: "This entry records none. For an unreviewed entry that usually means nobody has looked, not that there are none." } : {}),
|
|
158
|
+
...(wanted === "all" || wanted === "variants"
|
|
159
|
+
? { variants: protein.variants.map((one) => ({ ...both(one.from), was: one.was, now: one.now, note: one.note })) }
|
|
160
|
+
: protein.variants.length === 0 ? {} : { variants_not_shown: `${protein.variants.length} sequence variants are recorded. Ask with include "variants" to see them; for a protein like beta-casein they are the difference between one milk and another.` }),
|
|
161
|
+
...(wanted === "all" || wanted === "regions"
|
|
162
|
+
? { named_parts: protein.regions.map((one) => ({ lies: `${one.from}-${one.to}`, kind: one.kind, name: one.name })) }
|
|
163
|
+
: protein.regions.length === 0 ? {} : { named_parts_not_shown: protein.regions.length }),
|
|
164
|
+
from_outside: "This came from UniProt. A reviewed entry is a curator's reading of the papers; it is not something this lab has seen.",
|
|
165
|
+
};
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "work_out_phosphorylation", title: "Which residues would be phosphorylated, and whether the host would do it", readOnly: true,
|
|
170
|
+
description: [
|
|
171
|
+
"Work out which serines and threonines of a protein carry a phosphorylation motif, and say whether the host it is being expressed in has the enzyme that would act on them.",
|
|
172
|
+
"This is the question a project to make a milk protein turns on, and it is not the same question as whether the protein gets made. Casein builds a micelle — which is what makes it behave like cheese rather than like dissolved protein — through clusters of phosphorylated serines binding calcium. A host can make casein of exactly the right mass, giving exactly the right band, that will not do the job because it was never phosphorylated.",
|
|
173
|
+
"Two things come back, and they are different in kind. The sites are a rule over the sequence: the secretory-pathway kinase reads Ser-x-Glu, and a serine that is already phosphorylated acts like a glutamate for the one two residues before it, so the sites march backwards along a cluster. That is arithmetic and the working shows it. Whether the host has the kinase is not arithmetic; it is what is generally held, it says how firmly, and it says to check the literature — which search_papers can now do.",
|
|
174
|
+
"Give `uniprot` as well, and the rule is compared against what a curator recorded. That comparison is worth more than either on its own: a rule that reproduces the record on a protein somebody studied can be believed on a variant nobody has.",
|
|
175
|
+
"Give the protein as a sequence, or as a part in this lab, or as a UniProt accession.",
|
|
176
|
+
].join(" "),
|
|
177
|
+
input: { type: "object", additionalProperties: false, properties: {
|
|
178
|
+
sequence: { type: "string", description: "The amino acids, if you have them in hand." },
|
|
179
|
+
uniprot: { type: "string", description: "A UniProt accession, such as P02666. Its recorded sites are compared against the rule." },
|
|
180
|
+
on_the_mature_chain: { type: "boolean", description: "With a UniProt accession: work on the mature chain rather than the precursor. The precursor if not given, since that is how UniProt and a paper number things." },
|
|
181
|
+
host: { type: "string", description: "What it would be expressed in, such as \"Komagataella phaffii\" or \"Saccharomyces cerevisiae\"." },
|
|
182
|
+
} },
|
|
183
|
+
run: async (args) => {
|
|
184
|
+
const accession = args["uniprot"] === undefined ? null : text(args["uniprot"], "The accession");
|
|
185
|
+
const given = args["sequence"] === undefined ? null : text(args["sequence"], "The sequence");
|
|
186
|
+
if (accession === null && given === null)
|
|
187
|
+
throw new Error("Give a sequence, or a UniProt accession to read one from.");
|
|
188
|
+
const protein = accession === null ? null : await entry(accession);
|
|
189
|
+
const mature = args["on_the_mature_chain"] === true;
|
|
190
|
+
if (mature && protein?.chain == null)
|
|
191
|
+
throw new Error("That entry marks no mature chain, so there is no chain to count on.");
|
|
192
|
+
const chain = given ?? (mature ? protein.chain.sequence : protein.sequence);
|
|
193
|
+
const found = phosphoSites(chain);
|
|
194
|
+
if (found.problem !== null)
|
|
195
|
+
throw new Error(found.problem);
|
|
196
|
+
const named = args["host"] === undefined ? null : text(args["host"], "The host");
|
|
197
|
+
const host = named === null ? null : hostPhosphorylation(named);
|
|
198
|
+
// UniProt counts on the precursor; if the chain is what is being looked at, so must this.
|
|
199
|
+
const recorded = protein === null ? null : protein.modifications
|
|
200
|
+
.filter((one) => /phospho/i.test(one.what))
|
|
201
|
+
.map((one) => (mature ? onTheChain(protein, one.at) : one.at))
|
|
202
|
+
.filter((one) => one !== null);
|
|
203
|
+
const against = recorded === null ? null : comparedWithKnown(found.sites.map((one) => one.at), recorded);
|
|
204
|
+
return {
|
|
205
|
+
...(protein === null ? {} : { protein: protein.name, accession: protein.accession, reviewed_by_a_curator: protein.reviewed }),
|
|
206
|
+
counted_on: mature ? "the mature chain" : protein === null ? "the sequence given" : "the whole entry, precursor included",
|
|
207
|
+
residues: chain.length,
|
|
208
|
+
motifs: PHOSPHO_MOTIFS.map((one) => ({ name: one.name, pattern: one.pattern, kinase: one.kinase, about: one.about })),
|
|
209
|
+
sites: found.sites.map((one) => ({
|
|
210
|
+
at: one.at, residue: one.residue, by: one.by, kinase: one.kinase, context: one.context, round: one.round, because: one.because,
|
|
211
|
+
// A residue can carry more than one motif, and which is named first is only the order
|
|
212
|
+
// the rules are tried in. The others are said so that is not read as a finding.
|
|
213
|
+
...(one.alsoBy.length === 0 ? {} : { also_matches: one.alsoBy.map((other) => ({ by: other.name, kinase: other.kinase, because: other.because })) }),
|
|
214
|
+
})),
|
|
215
|
+
rounds: found.rounds,
|
|
216
|
+
...(against === null ? {} : { against_what_is_recorded: {
|
|
217
|
+
recorded, confirmed: against.confirmed, the_rule_missed: against.missed, predicted_only: against.onlyPredicted,
|
|
218
|
+
caught: `${Math.round(against.caught * 100)}% of the recorded sites`,
|
|
219
|
+
note: against.missed.length === 0 && against.confirmed.length > 0
|
|
220
|
+
? "The rule reproduces every site a curator recorded, which is the reason to believe it on a sequence nobody has studied — a variant, or this gene rewritten in another host's codons."
|
|
221
|
+
: "The rule and the record do not agree. Believe the record for this protein, and be careful using the rule on another.",
|
|
222
|
+
} }),
|
|
223
|
+
...(host === null ? (named === null ? {} : { host: named, host_not_known: `Nothing here says what ${named} does. That is not the same as its doing nothing: search_papers is the way to find out.` })
|
|
224
|
+
: { host: {
|
|
225
|
+
host: host.host,
|
|
226
|
+
has_the_secretory_kinase: host.secretoryKinase,
|
|
227
|
+
has_casein_kinase_2: host.casein2,
|
|
228
|
+
says: host.says,
|
|
229
|
+
how_firmly: host.standing,
|
|
230
|
+
check_it: `This is not worked out from anything; it is what is generally held. Search the literature for this host and this protein before spending a month on it.`,
|
|
231
|
+
} }),
|
|
232
|
+
working: phosphoWorking(found, host).map((one) => ({ of: one.of, comes: one.comes, kind: one.kind, steps: one.steps, ...(one.rests === undefined ? {} : { rests: one.rests }) })),
|
|
233
|
+
hosts_this_knows_of: HOST_KINASES.map((one) => one.host),
|
|
234
|
+
};
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
];
|
|
238
|
+
}
|
|
239
|
+
//# sourceMappingURL=known.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"known.js","sourceRoot":"","sources":["../src/known.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAChE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG3I,sDAAsD;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAYhC,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,IAAY,EAAU,EAAE;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,4BAA4B,CAAC,CAAC;IAC3G,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC,CAAC;AACF,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,IAAY,EAAU,EAAE;IACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,4BAA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EAAE,IAAI,EAAE;gCACN,IAAI,EAAE,IAAI,CAAC,IAAI;gCACf,wBAAwB,EAAE,IAAI,CAAC,eAAe;gCAC9C,mBAAmB,EAAE,IAAI,CAAC,OAAO;gCACjC,IAAI,EAAE,IAAI,CAAC,IAAI;gCACf,UAAU,EAAE,IAAI,CAAC,QAAQ;gCACzB,QAAQ,EAAE,yJAAyJ;6BACpK,EAAE,CAAC;oBACR,OAAO,EAAE,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;oBACjL,mBAAmB,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;iBACzD,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/dist/papers.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AgentTool } from "./tools.js";
|
|
2
|
+
/** The longest a query may be. Short enough that a sequence cannot be put in one. */
|
|
3
|
+
export declare const LONGEST_QUERY = 400;
|
|
4
|
+
/** The most characters of a paper handed back in one go. A section, not a book. */
|
|
5
|
+
export declare const MOST_READ = 24000;
|
|
6
|
+
/** How an adviser reaches Europe PMC. */
|
|
7
|
+
export interface PaperOptions {
|
|
8
|
+
/** Whether to offer these tools at all. On unless a host says otherwise. */
|
|
9
|
+
papers?: boolean;
|
|
10
|
+
/** What to call this software to Europe PMC. Never a person's name. */
|
|
11
|
+
tool?: string;
|
|
12
|
+
/**
|
|
13
|
+
* An address Europe PMC could use to get in touch about heavy use, if somebody has given one for
|
|
14
|
+
* that. It is never taken from the lab or from the device.
|
|
15
|
+
*/
|
|
16
|
+
email?: string | null;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The tools that read the literature.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Whether to offer them, and what to tell Europe PMC about who is asking.
|
|
22
|
+
* @returns The tools, or none if a host asked for none.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { paperTools } from "@biolibs/bionet-agent";
|
|
27
|
+
*
|
|
28
|
+
* paperTools({ tool: "bionet-adviser" }).map((one) => one.name);
|
|
29
|
+
* // ["search_papers", "read_paper", "papers_around"]
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function paperTools(options?: PaperOptions): AgentTool[];
|
|
33
|
+
//# sourceMappingURL=papers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"papers.d.ts","sourceRoot":"","sources":["../src/papers.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,qFAAqF;AACrF,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC,mFAAmF;AACnF,eAAO,MAAM,SAAS,QAAS,CAAC;AAEhC,yCAAyC;AACzC,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AA2DD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,YAAiB,GAAG,SAAS,EAAE,CAuJlE"}
|