Skip to content

Add batch mode support for Folddisco queries#117

Open
igmorv-genesis wants to merge 1 commit intosoedinglab:masterfrom
genesistherapeutics:folddisco-batch-upstream
Open

Add batch mode support for Folddisco queries#117
igmorv-genesis wants to merge 1 commit intosoedinglab:masterfrom
genesistherapeutics:folddisco-batch-upstream

Conversation

@igmorv-genesis
Copy link
Copy Markdown

@igmorv-genesis igmorv-genesis commented Mar 27, 2026

Summary

Add support for querying multiple protein structures with multiple motifs in a single Folddisco job request, using the folddisco query -q <batch_file> CLI interface.

API changes

  • Accept queries[] and motifs[] array parameters for batch submissions via both multipart/form-data and URL-encoded requests
  • Each motifs[] entry may contain multiple motifs separated by ;, allowing a single structure to be searched with several motif specifications without re-uploading
  • Add configurable top parameter to control the number of results per query (default: 1000)
  • Single-query mode (q + motif parameters) remains fully backward-compatible

Backend changes

  • folddiscojob.go: Add Motifs [][]string and queries []string fields for batch state. Add WriteBatchFiles() to generate per-query structure files and a 3-column tab-separated batch file (structure path, motif, output path). Extract validateFolddiscoDatabases() helper. Include Top and batch fields in job hash for correct caching.
  • jobsystem.go: Dispatch to WriteBatchFiles() for batch jobs in WriteSupportFiles.
  • server.go: Parse queries[]/motifs[] arrays in the ticket handler, split ;-separated motifs, and route to NewFoldDiscoBatchJobRequest or NewFoldDiscoJobRequest.
  • worker.go: For batch jobs, generate a per-database 3-column batch file with output paths in column 3 so each query writes to its own file (avoiding interleaved multi-threaded output). Run a single folddisco query -q <batch_file> invocation with full threading. Concatenate per-query result files into the final alignment output. Extract ismmCIFFirstLine(), readBatchLines(), and concatFiles() helpers.

Batch file format

The generated batch file follows the folddisco query -q specification:

Column Description
1 Path to the query structure (PDB/mmCIF)
2 Comma-separated list of motif residues
3 Path to the output file (avoids stdout interleaving)

Example usage

# Batch: two structures with different motifs, top 10 results each
curl -X POST http://host/api/ticket/folddisco \
  -F "queries[]=@structure1.pdb" \
  -F "queries[]=@structure2.cif" \
  -F "motifs[]=A10,A25,A32" \
  -F "motifs[]=A5,A15" \
  -F "database[]=h_sapiens_folddisco" \
  -F "top=10"

# Single query (unchanged)
curl -X POST http://host/api/ticket/folddisco \
  -F "q=@query.pdb" \
  -F "motif=A10,A25,A32" \
  -F "database[]=h_sapiens_folddisco"

Add support for querying multiple protein structures with multiple
motifs in a single Folddisco job request.

API changes:
- Accept queries[] and motifs[] array parameters for batch submissions
- Each motifs[] entry may contain multiple motifs separated by ";"
- Add configurable --top N parameter (default: 1000)
- Support both multipart/form-data and URL-encoded requests

Backend changes:
- Add FoldDiscoJob.Motifs and queries fields for batch state
- Add WriteBatchFiles() to generate per-query structure files and a
  3-column tab-separated batch file (structure, motif, output path)
- Generate per-database batch files with column 3 output paths so each
  query writes to its own file, avoiding interleaved output and enabling
  full multi-threading
- Concatenate per-query result files into the final alignment output
- Extract validateFolddiscoDatabases() and ismmCIFFirstLine() helpers
- Include Top and batch fields in job hash for correct caching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant