@yeyuan98/opencode-bioresearcher-plugin 1.5.2 → 1.5.3

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.
@@ -1,167 +1,167 @@
1
- # Rate Limiting Pattern
2
-
3
- Enforce delays between API calls to respect rate limits and avoid throttling.
4
-
5
- ## Overview
6
-
7
- Use this pattern when making sequential API calls to services with rate limits. This is especially important for BioMCP tools that query external biomedical databases.
8
-
9
- ## Pattern Algorithm
10
-
11
- ```
12
- 1. Initialize: delay = D (based on service type)
13
- 2. For each API call:
14
- a. Make the API call
15
- b. If more calls remain:
16
- - Use blockingTimer(delay=D)
17
- c. Continue to next call
18
- ```
19
-
20
- ## Parameters
21
-
22
- | Parameter | Default | Description |
23
- |-----------|---------|-------------|
24
- | `delay` | 0.3 | Wait time in seconds between calls |
25
-
26
- ## Tool: blockingTimer
27
-
28
- ```
29
- blockingTimer(delay: number)
30
- ```
31
-
32
- - Maximum delay: 300 seconds
33
- - Returns: "Timer completed: waited X seconds (actual elapsed: Ys)"
34
-
35
- ## Recommended Delays by Service
36
-
37
- | Service Type | Recommended Delay | Reason |
38
- |--------------|-------------------|--------|
39
- | BioMCP tools | 0.3 - 0.5 seconds | NCBI/API rate limits |
40
- | External APIs | 1 - 2 seconds | General API etiquette |
41
- | NCBI FTP | 2 - 3 seconds | FTP server limits |
42
- | Web scraping | 3 - 5 seconds | Respect robots.txt |
43
-
44
- ## Example: BioMCP Sequential Calls
45
-
46
- ```
47
- # Configuration
48
- delay = 0.3 # 300ms between calls
49
-
50
- # Sequential BioMCP calls with rate limiting
51
- biomcp_search(query="gene:BRAF AND disease:melanoma")
52
- blockingTimer(delay=0.3)
53
-
54
- biomcp_fetch(id="NCT04280705")
55
- blockingTimer(delay=0.3)
56
-
57
- biomcp_article_getter(pmid="35271234")
58
- blockingTimer(delay=0.3)
59
-
60
- # Continue with more calls...
61
- ```
62
-
63
- ## Example: Batch Processing with Rate Limiting
64
-
65
- ```
66
- # Configuration
67
- delay = 0.5 # 500ms for safety
68
- items = ["item1", "item2", "item3", "item4", "item5"]
69
-
70
- # Process with rate limiting
71
- for i, item in enumerate(items):
72
- result = biomcp_fetch(id=item)
73
- process(result)
74
-
75
- # Don't delay after the last item
76
- if i < len(items) - 1:
77
- blockingTimer(delay=delay)
78
- ```
79
-
80
- ## Example: Subagent Rate Limiting
81
-
82
- For bioresearcherDR_worker subagents:
83
-
84
- ```
85
- # Worker configuration
86
- delay = 0.5 # Workers use slightly longer delay
87
-
88
- # Sequential research calls
89
- biomcp_search(query=gene_query)
90
- blockingTimer(delay=0.5)
91
-
92
- biomcp_article_searcher(genes=["BRAF"], diseases=["melanoma"])
93
- blockingTimer(delay=0.5)
94
-
95
- biomcp_trial_searcher(conditions=["melanoma"])
96
- blockingTimer(delay=0.5)
97
- ```
98
-
99
- ## Why Rate Limiting Matters
100
-
101
- 1. **Avoid API bans**: Many services block IPs that exceed rate limits
102
- 2. **Ensure reliability**: Steady requests are less likely to timeout
103
- 3. **Respect resources**: Shared APIs serve many users
104
- 4. **Comply with ToS**: Most APIs require reasonable request rates
105
-
106
- ## Common Rate Limits
107
-
108
- | Service | Rate Limit | Source |
109
- |---------|------------|--------|
110
- | NCBI E-utilities | 3 requests/second | NCBI Guidelines |
111
- | PubMed API | 3 requests/second | NCBI Guidelines |
112
- | ClinicalTrials.gov | Varies | Check API docs |
113
- | MyGene.info | 10 requests/second | BioThings docs |
114
- | MyVariant.info | 10 requests/second | BioThings docs |
115
-
116
- ## Integration with Retry Pattern
117
-
118
- When combining rate limiting with retries:
119
-
120
- ```
121
- # Retry configuration
122
- max_attempts = 3
123
- retry_delay = 2
124
- rate_limit_delay = 0.3
125
-
126
- for attempt in range(max_attempts):
127
- result = api_call()
128
- if result.success:
129
- break
130
-
131
- # Retry delay (longer)
132
- if attempt < max_attempts - 1:
133
- blockingTimer(delay=retry_delay)
134
- retry_delay *= 2 # Exponential backoff
135
- continue
136
-
137
- # Rate limit before next call
138
- blockingTimer(delay=rate_limit_delay)
139
- ```
140
-
141
- ## Best Practices
142
-
143
- 1. **Be conservative**: Use 0.5s when uncertain about limits
144
- 2. **Don't skip delays**: Even "quick" calls need spacing
145
- 3. **Adjust for errors**: Increase delay if getting 429 errors
146
- 4. **Document your delays**: Note why specific values were chosen
147
- 5. **Parallel with caution**: Parallel calls multiply effective rate
148
-
149
- ## Error Handling
150
-
151
- If you receive rate limit errors (HTTP 429):
152
-
153
- ```
154
- # Detect rate limit error
155
- if response.status_code == 429:
156
- # Increase delay and retry
157
- blockingTimer(delay=5) # Wait longer
158
- retry_request()
159
- ```
160
-
161
- ## Integration with Other Patterns
162
-
163
- | Pattern | Integration |
164
- |---------|-------------|
165
- | `retry.md` | Rate limit delay + retry backoff |
166
- | `progress.md` | Rate limiting during batch progress |
167
- | `subagent-waves.md` | Each subagent applies its own rate limiting |
1
+ # Rate Limiting Pattern
2
+
3
+ Enforce delays between API calls to respect rate limits and avoid throttling.
4
+
5
+ ## Overview
6
+
7
+ Use this pattern when making sequential API calls to services with rate limits. This is especially important for BioMCP tools that query external biomedical databases.
8
+
9
+ ## Pattern Algorithm
10
+
11
+ ```
12
+ 1. Initialize: delay = D (based on service type)
13
+ 2. For each API call:
14
+ a. Make the API call
15
+ b. If more calls remain:
16
+ - Use blockingTimer(delay=D)
17
+ c. Continue to next call
18
+ ```
19
+
20
+ ## Parameters
21
+
22
+ | Parameter | Default | Description |
23
+ |-----------|---------|-------------|
24
+ | `delay` | 0.3 | Wait time in seconds between calls |
25
+
26
+ ## Tool: blockingTimer
27
+
28
+ ```
29
+ blockingTimer(delay: number)
30
+ ```
31
+
32
+ - Maximum delay: 300 seconds
33
+ - Returns: "Timer completed: waited X seconds (actual elapsed: Ys)"
34
+
35
+ ## Recommended Delays by Service
36
+
37
+ | Service Type | Recommended Delay | Reason |
38
+ |--------------|-------------------|--------|
39
+ | BioMCP tools | 0.3 - 0.5 seconds | NCBI/API rate limits |
40
+ | External APIs | 1 - 2 seconds | General API etiquette |
41
+ | NCBI FTP | 2 - 3 seconds | FTP server limits |
42
+ | Web scraping | 3 - 5 seconds | Respect robots.txt |
43
+
44
+ ## Example: BioMCP Sequential Calls
45
+
46
+ ```
47
+ # Configuration
48
+ delay = 0.3 # 300ms between calls
49
+
50
+ # Sequential BioMCP calls with rate limiting
51
+ biomcp_search(query="gene:BRAF AND disease:melanoma")
52
+ blockingTimer(delay=0.3)
53
+
54
+ biomcp_fetch(id="NCT04280705")
55
+ blockingTimer(delay=0.3)
56
+
57
+ biomcp_article_getter(pmid="35271234")
58
+ blockingTimer(delay=0.3)
59
+
60
+ # Continue with more calls...
61
+ ```
62
+
63
+ ## Example: Batch Processing with Rate Limiting
64
+
65
+ ```
66
+ # Configuration
67
+ delay = 0.5 # 500ms for safety
68
+ items = ["item1", "item2", "item3", "item4", "item5"]
69
+
70
+ # Process with rate limiting
71
+ for i, item in enumerate(items):
72
+ result = biomcp_fetch(id=item)
73
+ process(result)
74
+
75
+ # Don't delay after the last item
76
+ if i < len(items) - 1:
77
+ blockingTimer(delay=delay)
78
+ ```
79
+
80
+ ## Example: Subagent Rate Limiting
81
+
82
+ For bioresearcherDR_worker subagents:
83
+
84
+ ```
85
+ # Worker configuration
86
+ delay = 0.5 # Workers use slightly longer delay
87
+
88
+ # Sequential research calls
89
+ biomcp_search(query=gene_query)
90
+ blockingTimer(delay=0.5)
91
+
92
+ biomcp_article_searcher(genes=["BRAF"], diseases=["melanoma"])
93
+ blockingTimer(delay=0.5)
94
+
95
+ biomcp_trial_searcher(conditions=["melanoma"])
96
+ blockingTimer(delay=0.5)
97
+ ```
98
+
99
+ ## Why Rate Limiting Matters
100
+
101
+ 1. **Avoid API bans**: Many services block IPs that exceed rate limits
102
+ 2. **Ensure reliability**: Steady requests are less likely to timeout
103
+ 3. **Respect resources**: Shared APIs serve many users
104
+ 4. **Comply with ToS**: Most APIs require reasonable request rates
105
+
106
+ ## Common Rate Limits
107
+
108
+ | Service | Rate Limit | Source |
109
+ |---------|------------|--------|
110
+ | NCBI E-utilities | 3 requests/second | NCBI Guidelines |
111
+ | PubMed API | 3 requests/second | NCBI Guidelines |
112
+ | ClinicalTrials.gov | Varies | Check API docs |
113
+ | MyGene.info | 10 requests/second | BioThings docs |
114
+ | MyVariant.info | 10 requests/second | BioThings docs |
115
+
116
+ ## Integration with Retry Pattern
117
+
118
+ When combining rate limiting with retries:
119
+
120
+ ```
121
+ # Retry configuration
122
+ max_attempts = 3
123
+ retry_delay = 2
124
+ rate_limit_delay = 0.3
125
+
126
+ for attempt in range(max_attempts):
127
+ result = api_call()
128
+ if result.success:
129
+ break
130
+
131
+ # Retry delay (longer)
132
+ if attempt < max_attempts - 1:
133
+ blockingTimer(delay=retry_delay)
134
+ retry_delay *= 2 # Exponential backoff
135
+ continue
136
+
137
+ # Rate limit before next call
138
+ blockingTimer(delay=rate_limit_delay)
139
+ ```
140
+
141
+ ## Best Practices
142
+
143
+ 1. **Be conservative**: Use 0.5s when uncertain about limits
144
+ 2. **Don't skip delays**: Even "quick" calls need spacing
145
+ 3. **Adjust for errors**: Increase delay if getting 429 errors
146
+ 4. **Document your delays**: Note why specific values were chosen
147
+ 5. **Parallel with caution**: Parallel calls multiply effective rate
148
+
149
+ ## Error Handling
150
+
151
+ If you receive rate limit errors (HTTP 429):
152
+
153
+ ```
154
+ # Detect rate limit error
155
+ if response.status_code == 429:
156
+ # Increase delay and retry
157
+ blockingTimer(delay=5) # Wait longer
158
+ retry_request()
159
+ ```
160
+
161
+ ## Integration with Other Patterns
162
+
163
+ | Pattern | Integration |
164
+ |---------|-------------|
165
+ | `retry.md` | Rate limit delay + retry backoff |
166
+ | `progress.md` | Rate limiting during batch progress |
167
+ | `subagent-waves.md` | Each subagent applies its own rate limiting |
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: gromacs-guides
3
+ description: Reusable guides for GROMACS molecular dynamics workflows
4
+ allowedTools:
5
+ - Read
6
+ - Bash
7
+ ---
8
+
9
+ # GROMACS Guides
10
+
11
+ This skill provides reusable guides for common GROMACS molecular dynamics workflows.
12
+
13
+ ## Quick Start
14
+
15
+ ### Step 1: Load This Skill
16
+ The skill is loaded automatically when agent calls `skill gromacs-guides`.
17
+
18
+ ### Step 2: Extract Skill Path
19
+ From the `<skill_files>` section in the skill tool output, extract the `<skill_path>` value.
20
+
21
+ ### Step 3: Read the Relevant Guide
22
+ ```
23
+ Read <skill_path>/guides/inspect_tpr.md
24
+ Read <skill_path>/guides/create_index.md
25
+ ```
26
+
27
+ ## Available Guides
28
+
29
+ | Task | Guide |
30
+ |------|-------|
31
+ | TPR inspection | `guides/inspect_tpr.md` |
32
+ | Index file creation | `guides/create_index.md` |
33
+
34
+ ## Guide Summaries
35
+
36
+ ### inspect_tpr.md
37
+ Commands for extracting molecule information from TPR files:
38
+ - Quick summary and detailed dump commands
39
+ - Molecule type/counts extraction
40
+ - Cyclic molecule bond detection
41
+ - Molecule independence checking
42
+
43
+ ### create_index.md
44
+ Workflow for creating GROMACS index files:
45
+ - Basic `make_ndx` usage
46
+ - `splitch` artefact identification and fixing
47
+ - Merge → verify → delete → rename workflow
48
+ - C-alpha group creation
@@ -0,0 +1,96 @@
1
+ # Creating Index Files for Protein Chains
2
+
3
+ ## Basic Method
4
+
5
+ ```bash
6
+ # Interactive mode
7
+ gmx make_ndx -f <tpr_file> -o <index_file.ndx>
8
+
9
+ # Non-interactive: split protein group by chain
10
+ printf "splitch <protein_group>\nq\n" | gmx make_ndx -f <tpr_file> -o <index_file.ndx>
11
+ ```
12
+
13
+ ## Caveat: `splitch` Artefacts
14
+
15
+ `splitch` uses topological connectivity and may incorrectly split a single chain into multiple groups when:
16
+ - Hydrogen atoms were rebuilt by `pdb2gmx` (N-terminal residues get extra H1/H2/H3 atoms)
17
+ - Residue numbering has gaps (e.g., residues 1-18, then 26-108)
18
+
19
+ **Symptom**: After `splitch`, a single protein chain appears as multiple `Protein_chainN` groups where the atom counts don't match expected molecule boundaries.
20
+
21
+ ## Recommended Workflow: Fix Incorrectly Split Chains
22
+
23
+ **Step 1: Identify the incorrect split**
24
+ After `splitch`, press Enter (empty line) in `make_ndx` to list all groups. Compare atom counts against your expected molecule sizes.
25
+
26
+ **Step 2: Merge the incorrectly split groups**
27
+ ```
28
+ <group_N> | <group_M>
29
+ ```
30
+ This creates a new merged group named `Protein_chainN_Protein_chainM` at the end of the list.
31
+
32
+ **Step 3: Verify the merged group**
33
+ Press Enter to list groups again. The merged group should have the correct total atom count.
34
+
35
+ **Step 4: Delete the incorrect split groups**
36
+ Delete in DESCENDING order to avoid index shifting confusion:
37
+ ```
38
+ del <higher_index>
39
+ del <lower_index>
40
+ ```
41
+ After `k` deletions, the merged group index shifts down by `k`.
42
+
43
+ **Step 5: Rename the merged group (optional)**
44
+ ```
45
+ name <final_index> <custom_name>
46
+ ```
47
+
48
+ ## Generic Example (interactive `make_ndx` session)
49
+
50
+ ```
51
+ > splitch 1
52
+ Found N chains
53
+ 1: XXX atoms (a to b)
54
+ 2: YY atoms (c to d) <-- suspiciously small, may be incorrect split
55
+ 3: ZZZ atoms (e to f) <-- remainder of same chain
56
+
57
+ > <-- press Enter to list groups
58
+ ...
59
+ N Protein_chain1 XXX atoms
60
+ N+1 Protein_chain2 YY atoms <-- wrong split (too small)
61
+ N+2 Protein_chain3 ZZZ atoms <-- wrong split (remainder)
62
+ ...
63
+
64
+ > N+1 | N+2 <-- merge the incorrectly split groups
65
+ Merged two groups with OR: YY ZZZ -> (YY+ZZZ)
66
+
67
+ > <-- press Enter to verify
68
+ ...
69
+ M Protein_chain2_Protein_chain3 (YY+ZZZ) atoms <-- correct total!
70
+
71
+ > del N+2 <-- delete higher index first
72
+ > del N+1 <-- then lower index
73
+
74
+ > <-- press Enter
75
+ ...
76
+ M-2 Protein_chain2_Protein_chain3 (YY+ZZZ) atoms <-- shifted!
77
+
78
+ > name M-2 <your_chain_name>
79
+ > q
80
+ ```
81
+
82
+ **Key insight**: After deleting `k` groups that were created AFTER the merged group, the merged group's index decreases by `k`.
83
+
84
+ ## Non-interactive Equivalent
85
+
86
+ ```bash
87
+ printf "splitch 1\n<group_N> | <group_M>\ndel <higher>\ndel <lower>\nname <final> <name>\nq\n" | \
88
+ gmx make_ndx -f <tpr_file> -o <index_file.ndx>
89
+ ```
90
+
91
+ ## Creating C-alpha Groups
92
+
93
+ In `make_ndx` interactive mode:
94
+ ```
95
+ a CA & <chain_group> # creates C-alpha selection for specified chain
96
+ ```
@@ -0,0 +1,93 @@
1
+ # Inspecting TPR Files for Molecule Information
2
+
3
+ ## Quick Summary
4
+
5
+ ```bash
6
+ gmx dump -s <tpr_file> 2>&1 | grep -A 5 "moltype"
7
+ ```
8
+
9
+ ## Detailed Breakdown
10
+
11
+ ```bash
12
+ # Full dump (verbose)
13
+ gmx dump -s <tpr_file>
14
+
15
+ # Extract molecule block info
16
+ gmx dump -s <tpr_file> 2>&1 | grep -E "(molblock|#molecules|moltype.*=)"
17
+ ```
18
+
19
+ **Output interpretation:**
20
+ ```
21
+ molblock (N):
22
+ moltype = M "MoleculeName" # Molecule type name
23
+ #molecules = X # Number of copies in system
24
+
25
+ moltype (M):
26
+ name="MoleculeName"
27
+ atoms:
28
+ atom (N): # N atoms in this molecule type
29
+ ```
30
+
31
+ ## Key Information to Extract
32
+
33
+ | Information | How to Find |
34
+ |-------------|-------------|
35
+ | Molecule type names | `grep 'moltype.*='` after `gmx dump` |
36
+ | Molecule counts | `grep '#molecules'` after `gmx dump` |
37
+ | Atoms per molecule type | Check `atom (N):` line under each `moltype` section |
38
+ | Solvent molecule count | Find SOL/Water moltype, read `#molecules` |
39
+ | Ion counts by type | Find NA, CL, etc. moltypes, read `#molecules` each |
40
+ | Protein molecule chains | Count moltypes with "Protein" or similar in name |
41
+
42
+ ## Detecting Cyclic Molecule Configuration
43
+
44
+ For protein chains, check if the molecule is cyclic (e.g., cyclic peptides) by examining bonds within the moltype.
45
+
46
+ **Detection strategy:**
47
+ 1. Get atom count for the moltype from `atom (N):` line (N atoms, indexed 0 to N-1)
48
+ 2. Search the Bond section for a bond between atom 0 and the C-terminal atom (typically atom N-2, which is the C atom before the terminal O)
49
+ 3. If such a bond exists, the molecule is cyclic
50
+
51
+ **Bond format in gmx dump:**
52
+ ```
53
+ Bond:
54
+ nr: <count>
55
+ iatoms:
56
+ 0 type=441 (BONDS) 0 2
57
+ 1 type=442 (BONDS) 0 273 <-- bond from atom 0 to atom 273
58
+ ```
59
+
60
+ **Example:** For a 275-atom cyclic peptide (atoms 0-274):
61
+ - Atom 0: N-terminal N
62
+ - Atom 273: C-terminal C (the backbone carbon)
63
+ - Atom 274: C-terminal O
64
+ - A bond `0 273` indicates the N-C cyclization
65
+
66
+ **Quick check for cyclic bond:**
67
+ ```bash
68
+ # Get atom count for a protein moltype
69
+ gmx dump -s <tpr_file> 2>&1 | grep -A 1 "atom (" | head -4
70
+
71
+ # Search for bonds involving atom 0 and the C-terminal atom (N-2)
72
+ # Replace <N-2> with actual value (e.g., 273 for 275-atom molecule)
73
+ gmx dump -s <tpr_file> 2>&1 | grep -E "BONDS.*0.*<N-2>"
74
+ ```
75
+
76
+ **Example command for 275-atom molecule:**
77
+ ```bash
78
+ gmx dump -s <tpr_file> 2>&1 | grep -E "BONDS.*0.*273"
79
+ ```
80
+
81
+ ## Checking Molecule Independence
82
+
83
+ ```bash
84
+ gmx dump -s <tpr_file> 2>&1 | grep "bIntermolecularInteractions"
85
+ ```
86
+ - `false` = Molecules are independent (correct for most simulations)
87
+ - `true` = Bonded interactions exist between molecule types (unusual)
88
+
89
+ ## Quick System Overview
90
+
91
+ ```bash
92
+ echo "q" | gmx make_ndx -f <tpr_file> 2>&1 | grep -E "(System|Protein|Water|Ion|atoms)"
93
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeyuan98/opencode-bioresearcher-plugin",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "OpenCode plugin that adds a bioresearcher agent",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",