diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..26acb9706d6e3e8a943d4d9676b9eb014a983372 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioawk via conda (e.g., from bioconda) +RUN conda install -c bioconda bioawk -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioawk_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioawk_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioawk_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_server.py new file mode 100644 index 0000000000000000000000000000000000000000..aa6fff3f8a61663d1375eedf06841e685f590554 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_server.py @@ -0,0 +1,120 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any + +# @mcp.tool() is a placeholder for the actual decorator. +# The user prompt says "NO NEED to import mcp". +def tool(*args, **kwargs): + def decorator(f): + return f + return decorator + +mcp = type("mcp", (), {"tool": tool}) + + +@mcp.tool() +def bioawk( + program: Optional[str] = None, + program_file: Optional[Path] = None, + input_files: Optional[List[Path]] = None, + format: Optional[str] = None, + tab_separator: bool = False, + retain_header: bool = False, + variables: Optional[List[str]] = None, + field_separator: Optional[str] = None, +) -> Dict[str, Any]: + """ + Executes the bioawk tool, a variant of awk for processing biological data formats. + + bioawk extends awk by understanding common bioinformatics formats, making it easy + to parse and manipulate files like FASTA, FASTQ, SAM, VCF, etc. + + Args: + program: The awk program script to execute, provided as a string. + program_file: A file containing the awk program script. + Exactly one of 'program' or 'program_file' must be provided. + input_files: A list of input files to process. If not provided, + bioawk will read from standard input. + format: The format of the input data. Supported formats include: + fasta, fastq, sam, vcf, bed, gff, gtf, psl, blast, hmmer, cigar. + If not specified, bioawk defaults to 'fasta'. + tab_separator: Use tab as the input and output field separator (-t). + retain_header: Retain the header in the output (-H). + variables: A list of variable assignments in 'var=value' format (-v). + field_separator: The input field separator, equivalent to awk's -F option. + + Returns: + A dictionary containing the executed command, stdout, and stderr. + """ + # 1. Input Validation + if not (program or program_file) or (program and program_file): + raise ValueError("Exactly one of 'program' or 'program_file' must be provided.") + + if program_file and not program_file.is_file(): + raise FileNotFoundError(f"Program file not found: {program_file}") + + if input_files: + for file_path in input_files: + if not file_path.is_file(): + raise FileNotFoundError(f"Input file not found: {file_path}") + + VALID_FORMATS = { + "fasta", "fastq", "sam", "vcf", "bed", "gff", + "gtf", "psl", "blast", "hmmer", "cigar" + } + if format and format.lower() not in VALID_FORMATS: + raise ValueError(f"Invalid format '{format}'. Must be one of {VALID_FORMATS}") + + if variables: + for var in variables: + if "=" not in var: + raise ValueError(f"Invalid variable assignment '{var}'. Must be in 'var=value' format.") + + # 2. Command Construction + cmd = ["bioawk"] + + if format: + cmd.extend(["-c", format]) + if tab_separator: + cmd.append("-t") + if retain_header: + cmd.append("-H") + if field_separator: + cmd.extend(["-F", field_separator]) + if variables: + for var in variables: + cmd.extend(["-v", var]) + + if program_file: + cmd.extend(["-f", str(program_file)]) + elif program: + cmd.append(program) + + if input_files: + cmd.extend([str(p) for p in input_files]) + + # 3. Subprocess Execution + command_executed = " ".join(cmd) + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + } + except FileNotFoundError: + # This error is raised if the 'bioawk' command itself is not found. + raise RuntimeError("bioawk command not found. Please ensure it is installed and in your PATH.") + except subprocess.CalledProcessError as e: + # This error is raised if bioawk returns a non-zero exit code. + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"bioawk failed with exit code {e.returncode}" + } diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..be27e408af29bfa8270c21c3af66fc7cd848d983 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/bioawk_server.py') +SERVER_NAME = 'biosci_bioawk' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..7225a96d51707881729bddfe8df7a8a8ad5a61bd --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioawk: + build: . + image: mcp-bioawk:latest + container_name: mcp-bioawk + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioawk + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d850d38d19bdb05c11c590472bc88660b4d32fef --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioawk + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioawk/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..66ba2c07f5ba40e55a52d2cfb656ebaf930c87a3 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-ancombc via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-ancombc -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-ancombc_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-ancombc_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-ancombc_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_server.py new file mode 100644 index 0000000000000000000000000000000000000000..5f4f1ae809aaa666e96b04e26f071abfb81fc2d1 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_server.py @@ -0,0 +1,251 @@ +import subprocess +import tempfile +import textwrap +from pathlib import Path +from typing import Dict, List, Optional + +# @mcp.tool() is a placeholder for the actual decorator. +# The function is written to be compatible with the MCP server environment. +def mcp_tool_placeholder(*args, **kwargs): + def decorator(func): + return func + return decorator + +@mcp_tool_placeholder() +def ancombc2( + otu_table: Path, + sample_metadata: Path, + formula: str, + output_dir: Path, + taxonomy_table: Optional[Path] = None, + p_adj_method: str = "holm", + zero_cut: float = 0.9, + lib_cut: int = 1000, + struc_zero: bool = False, + neg_lb: bool = False, + tol: float = 1e-05, + max_iter: int = 100, + conserve: bool = False, + alpha: float = 0.05, + global_test: bool = False, + group: Optional[str] = None, + mdfdr_dist: str = "normal", + n_cl: int = 1, + verbose: bool = False, + output_prefix: str = "ancombc2_results", +) -> Dict: + """ + Performs differential abundance analysis on microbiome data using ANCOM-BC2. + + ANCOM-BC2 (Analysis of Compositions of Microbiomes with Bias Correction 2) is a + method for identifying differentially abundant taxa between groups while correcting + for sample-specific and taxon-specific biases. + + Args: + otu_table: Path to the feature/OTU count table (CSV format). Rows should be taxa + and columns should be samples. The first column should be taxon IDs. + sample_metadata: Path to the sample metadata file (CSV format). Rows should be + samples and columns should be metadata variables. The first + column should be sample IDs. + formula: An R-style formula string specifying the model, e.g., "age + sex + diagnosis". + Variables must correspond to columns in the sample_metadata file. + output_dir: Path to the directory where output files will be saved. + taxonomy_table: Optional path to the taxonomy table (CSV format). Rows should be + taxa, columns should be taxonomic ranks. The first column must + be taxon IDs matching the OTU table. + p_adj_method: Method for p-value adjustment. + Options: "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". + zero_cut: A numerical value between 0 and 1. Taxa with a proportion of zeros greater + than this value will be excluded from the analysis. + lib_cut: A numerical value. Samples with library sizes less than this value will be + excluded from the analysis. + struc_zero: Whether to detect structural zeros. + neg_lb: Whether to use the negative binomial distribution for modeling sampling fractions. + If FALSE, a log-linear model is used. + tol: Convergence tolerance for the optimization algorithm. + max_iter: Maximum number of iterations for the optimization algorithm. + conserve: Whether to use a conservative variance estimate for the test statistic. + alpha: Significance level for identifying differentially abundant taxa. + global_test: Whether to perform a global test for the specified group variable. + group: The name of the group variable for the global test. Required if `global_test` is True. + Must be a column name in the sample_metadata file. + mdfdr_dist: The assumed distribution of the E-values in m-DFDR. + Options: "normal", "t". + n_cl: Number of CPU cores to use for parallel computation. + verbose: Whether to display progress messages during execution. + output_prefix: Prefix for the output result files. + + Returns: + A dictionary containing the executed command, stdout, stderr, and a list of + paths to the generated output files. + """ + # --- 1. Input Validation --- + if not otu_table.is_file(): + raise FileNotFoundError(f"OTU table not found at: {otu_table}") + if not sample_metadata.is_file(): + raise FileNotFoundError(f"Sample metadata not found at: {sample_metadata}") + if taxonomy_table and not taxonomy_table.is_file(): + raise FileNotFoundError(f"Taxonomy table not found at: {taxonomy_table}") + + p_adj_methods = ["holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none"] + if p_adj_method not in p_adj_methods: + raise ValueError(f"Invalid p_adj_method '{p_adj_method}'. Must be one of {p_adj_methods}") + + mdfdr_dists = ["normal", "t"] + if mdfdr_dist not in mdfdr_dists: + raise ValueError(f"Invalid mdfdr_dist '{mdfdr_dist}'. Must be one of {mdfdr_dists}") + + if not 0 <= zero_cut <= 1: + raise ValueError("zero_cut must be between 0 and 1.") + if not 0 < alpha < 1: + raise ValueError("alpha must be between 0 and 1.") + if lib_cut < 0: + raise ValueError("lib_cut must be a non-negative integer.") + if max_iter <= 0: + raise ValueError("max_iter must be a positive integer.") + if n_cl <= 0: + raise ValueError("n_cl must be a positive integer.") + if tol <= 0: + raise ValueError("tol must be a positive float.") + + if global_test and not group: + raise ValueError("The 'group' parameter is required when 'global_test' is True.") + + # --- 2. Prepare for Execution --- + output_dir.mkdir(parents=True, exist_ok=True) + + output_res_path = output_dir / f"{output_prefix}_DA.csv" + output_files = [str(output_res_path)] + + output_global_res_path = output_dir / f"{output_prefix}_global.csv" + if global_test: + output_files.append(str(output_global_res_path)) + + # Convert Python types to R-compatible strings + r_tax_file = f"'{taxonomy_table.resolve()}'" if taxonomy_table else "NULL" + r_group = f"'{group}'" if group else "NULL" + r_struc_zero = "TRUE" if struc_zero else "FALSE" + r_neg_lb = "TRUE" if neg_lb else "FALSE" + r_conserve = "TRUE" if conserve else "FALSE" + r_global_test = "TRUE" if global_test else "FALSE" + r_verbose = "TRUE" if verbose else "FALSE" + + # --- 3. Generate R Script --- + r_script_content = textwrap.dedent(f""" + # Load required libraries + library(ANCOMBC) + library(phyloseq) + + # --- Parameters --- + otu_file <- '{otu_table.resolve()}' + meta_file <- '{sample_metadata.resolve()}' + tax_file <- {r_tax_file} + output_res_path <- '{output_res_path.resolve()}' + output_global_res_path <- '{output_global_res_path.resolve()}' + + # --- Load and prepare data --- + # read.csv with row.names = 1 assumes first column is the index + otu_mat <- as.matrix(read.csv(otu_file, row.names = 1, check.names = FALSE)) + meta_data <- read.csv(meta_file, row.names = 1, check.names = FALSE) + + # Ensure sample names match and are in the same order + samples_in_common <- intersect(rownames(meta_data), colnames(otu_mat)) + if (length(samples_in_common) == 0) {{ + stop("No common sample IDs found between OTU table and metadata.") + }} + otu_mat <- otu_mat[, samples_in_common, drop = FALSE] + meta_data <- meta_data[samples_in_common, , drop = FALSE] + + OTU <- otu_table(otu_mat, taxa_are_rows = TRUE) + META <- sample_data(meta_data) + + # Load taxonomy if provided + if (!is.null(tax_file)) {{ + tax_mat <- as.matrix(read.csv(tax_file, row.names = 1, check.names = FALSE)) + # Ensure taxon names match + taxa_in_common <- intersect(rownames(tax_mat), rownames(otu_mat)) + if (length(taxa_in_common) == 0) {{ + warning("No common taxon IDs found between OTU table and taxonomy table. Proceeding without taxonomy.") + pseq <- phyloseq(OTU, META) + }} else {{ + tax_mat_filtered <- tax_mat[taxa_in_common, , drop = FALSE] + TAX <- tax_table(tax_mat_filtered) + pseq <- phyloseq(OTU, META, TAX) + }} + }} else {{ + pseq <- phyloseq(OTU, META) + }} + + # --- Run ANCOM-BC2 --- + output <- ancombc2( + data = pseq, + formula = "{formula}", + p_adj_method = "{p_adj_method}", + zero_cut = {zero_cut}, + lib_cut = {lib_cut}, + struc_zero = {r_struc_zero}, + neg_lb = {r_neg_lb}, + tol = {tol}, + max_iter = {max_iter}, + conserve = {r_conserve}, + alpha = {alpha}, + global = {r_global_test}, + group = {r_group}, + mdfdr_dist = "{mdfdr_dist}", + n_cl = {n_cl}, + verbose = {r_verbose} + ) + + # --- Save results --- + # Save differential abundance results + res_df <- data.frame(output$res) + write.csv(res_df, file = output_res_path, row.names = TRUE) + + # Save global test results if applicable + if ({r_global_test} && !is.null(output$res_global)) {{ + res_global_df <- data.frame(output$res_global) + write.csv(res_global_df, file = output_global_res_path, row.names = TRUE) + }} + + print("ANCOM-BC2 analysis completed successfully.") + """) + + # --- 4. Execute --- + with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".R") as r_script_file: + r_script_file.write(r_script_content) + r_script_path = r_script_file.name + + command = ["Rscript", r_script_path] + command_executed = " ".join(command) + + try: + result = subprocess.run( + command, + capture_output=True, + text=True, + check=True, + ) + stdout = result.stdout + stderr = result.stderr + except subprocess.CalledProcessError as e: + # Clean up the temporary script file on error + Path(r_script_path).unlink() + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "return_code": e.returncode, + "output_files": [] + } + finally: + # Ensure temporary script is always cleaned up + if Path(r_script_path).exists(): + Path(r_script_path).unlink() + + # --- 5. Return results --- + return { + "command_executed": command_executed, + "stdout": stdout, + "stderr": stderr, + "output_files": output_files + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..ce6190337cbf3a56bf4b0bbe8a7efa1d4d7db756 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/bioconductor-ancombc_server.py') +SERVER_NAME = 'biosci_bioconductor_ancombc' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..56a3995e609e7415b0dafb7f808bab03c3b49280 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-ancombc: + build: . + image: mcp-bioconductor-ancombc:latest + container_name: mcp-bioconductor-ancombc + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-ancombc + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6b5c51800f55fd28df265e465d5f20d94684402c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-ancombc + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ancombc/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e92d90bc32975c5c742f867f85094b60f17d393d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-bsgenome via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-bsgenome -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-bsgenome_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-bsgenome_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-bsgenome_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..a16172fc9d353b1fa84f3f1c445702f0bc06751b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-bsgenome: + build: . + image: mcp-bioconductor-bsgenome:latest + container_name: mcp-bioconductor-bsgenome + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-bsgenome + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..1d3824d6847258fcb5b0a063d4a0c1268b07dfd8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-bsgenome + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-bsgenome/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1c6ea7c8b91b141d18da6d241b21b2fe2e0440a8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-concordexr via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-concordexr -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-concordexr_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-concordexr_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-concordexr_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e1b553e9f10a96a65b53696eea39809bdc611b61 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_server.py @@ -0,0 +1,221 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import Optional, List + +# Mock the decorator for standalone execution +class mcp: + @staticmethod + def tool(func): + return func + +@mcp.tool +def compute_concordex( + data_file: Path, + ranks_file: Path, + indices_file: Path, + output_dir: Path, + data_type: str = "counts", + abundance_min: float = 1.0, + abundance_max: Optional[float] = None, + sample_min: float = 0.0, + sample_max: Optional[float] = None, + filter_perc: float = 0.0, + filter_count: int = 0, + plot: bool = True, + plot_format: str = "png", + plot_width: int = 10, + plot_height: int = 10, + export: bool = True, + export_rds: bool = True, +): + """ + Computes the Concordance Index (Concordex) using the concordexR package. + + This tool wraps the `computeConcordex` function. It takes expression/count data, + pre-computed ranks, and sample indices to calculate concordex scores. It can + filter data, generate plots, and export results to files. + + Args: + data_file: Path to the input data file (e.g., counts matrix). Assumed to be a tab-separated file with a header and row names in the first column. + ranks_file: Path to the ranks file. Assumed to be a tab-separated file with a header and row names in the first column. + indices_file: Path to the indices file. Assumed to be a single-column, tab-separated file without a header. + output_dir: Path to the directory where output files will be saved. + data_type: The type of data in `data_file`. Must be either 'counts' or 'ranks'. + abundance_min: The minimum abundance of a feature to be included in the analysis. + abundance_max: The maximum abundance of a feature. If None, no upper limit is applied. + sample_min: The minimum value of a sample to be included. + sample_max: The maximum value of a sample. If None, no upper limit is applied. + filter_perc: The percentage of samples a feature must be present in to be retained. Value must be between 0.0 and 1.0. + filter_count: The minimum number of counts a feature must have across all samples to be retained. + plot: If True, generate concordex plots. + plot_format: The format for the output plots (e.g., 'png', 'pdf', 'svg'). + plot_width: The width of the output plots in inches. + plot_height: The height of the output plots in inches. + export: If True, export the concordex results to text files. + export_rds: If True, save the final concordex R object to an .rds file for later use (e.g., with plot_concordex). + """ + # Input validation + if not data_file.is_file(): + raise FileNotFoundError(f"Input data file not found: {data_file}") + if not ranks_file.is_file(): + raise FileNotFoundError(f"Ranks file not found: {ranks_file}") + if not indices_file.is_file(): + raise FileNotFoundError(f"Indices file not found: {indices_file}") + + if data_type not in ["counts", "ranks"]: + raise ValueError("data_type must be either 'counts' or 'ranks'.") + if not (0.0 <= filter_perc <= 1.0): + raise ValueError("filter_perc must be between 0.0 and 1.0.") + if filter_count < 0: + raise ValueError("filter_count must be a non-negative integer.") + if plot_format not in ["png", "pdf", "svg", "jpeg", "tiff"]: + raise ValueError(f"Unsupported plot format: {plot_format}") + + output_dir.mkdir(parents=True, exist_ok=True) + + # Build the R script + r_script_lines = [ + "library(concordexR)", + f'data <- read.table("{data_file.resolve()}", header=TRUE, sep="\\t", row.names=1, check.names=FALSE)', + f'ranks <- read.table("{ranks_file.resolve()}", header=TRUE, sep="\\t", row.names=1, check.names=FALSE)', + f'indices_df <- read.table("{indices_file.resolve()}", header=FALSE, sep="\\t")', + "indices <- as.list(indices_df$V1)", + "concordex_result <- computeConcordex(", + " data = data,", + " ranks = ranks,", + " indices = indices,", + f' type = "{data_type}",', + f" abundance.min = {abundance_min},", + f" abundance.max = {abundance_max if abundance_max is not None else 'Inf'},", + f" sample.min = {sample_min},", + f" sample.max = {sample_max if sample_max is not None else 'Inf'},", + f" filter.perc = {filter_perc},", + f" filter.count = {filter_count},", + f' output.dir = "{output_dir.resolve()}",', + f" plot = {'TRUE' if plot else 'FALSE'},", + f' plot.format = "{plot_format}",', + f" plot.width = {plot_width},", + f" plot.height = {plot_height},", + f" export = {'TRUE' if export else 'FALSE'}", + ")", + ] + + if export_rds: + rds_path = output_dir.resolve() / "concordex_object.rds" + r_script_lines.append(f'saveRDS(concordex_result, file = "{rds_path}")') + + r_script = "\n".join(r_script_lines) + + # Use a temporary file for the R script + with tempfile.NamedTemporaryFile(mode='w', suffix=".R", delete=False) as f: + f.write(r_script) + r_script_path = Path(f.name) + + cmd = ["Rscript", str(r_script_path)] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + + output_files = [str(p) for p in output_dir.glob("**/*") if p.is_file()] + + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"R script execution failed with return code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e + finally: + r_script_path.unlink() + +@mcp.tool +def plot_concordex( + concordex_object_file: Path, + output_dir: Path, + plot_format: str = "png", + plot_width: int = 10, + plot_height: int = 10, +): + """ + Generates plots from a pre-computed concordex object. + + This tool wraps the `plotConcordex` function from the concordexR package. + It takes an .rds file containing a concordex object (generated by the + compute_concordex tool) and creates visualization plots. + + Args: + concordex_object_file: Path to the .rds file containing the concordex object. + output_dir: Path to the directory where output plots will be saved. + plot_format: The format for the output plots (e.g., 'png', 'pdf', 'svg'). + plot_width: The width of the output plots in inches. + plot_height: The height of the output plots in inches. + """ + # Input validation + if not concordex_object_file.is_file(): + raise FileNotFoundError(f"Concordex object file not found: {concordex_object_file}") + if concordex_object_file.suffix != ".rds": + raise ValueError("concordex_object_file must be an .rds file.") + if plot_format not in ["png", "pdf", "svg", "jpeg", "tiff"]: + raise ValueError(f"Unsupported plot format: {plot_format}") + + output_dir.mkdir(parents=True, exist_ok=True) + + # Build the R script + r_script_lines = [ + "library(concordexR)", + f'concordex_obj <- readRDS("{concordex_object_file.resolve()}")', + "plotConcordex(", + " concordex.object = concordex_obj,", + f' output.dir = "{output_dir.resolve()}",', + f' plot.format = "{plot_format}",', + f" plot.width = {plot_width},", + f" plot.height = {plot_height}", + ")", + ] + r_script = "\n".join(r_script_lines) + + with tempfile.NamedTemporaryFile(mode='w', suffix=".R", delete=False) as f: + f.write(r_script) + r_script_path = Path(f.name) + + cmd = ["Rscript", str(r_script_path)] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + + output_files = [str(p) for p in output_dir.glob("**/*") if p.is_file()] + + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"R script execution failed with return code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e + finally: + r_script_path.unlink() \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..1d2aeba621510072cfb8af0fb3c0a1462ea348f7 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/bioconductor-concordexr_server.py') +SERVER_NAME = 'biosci_bioconductor_concordexr' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..8b5291f8e0b390b106dfec8b76ba69c2afb93482 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-concordexr: + build: . + image: mcp-bioconductor-concordexr:latest + container_name: mcp-bioconductor-concordexr + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-concordexr + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bb7159d75e2835693c1a0bd67e14b3e286680365 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-concordexr + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-concordexr/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..d5c0a1b5a4acc0ab1e4f03c7158652c8bdb04b3e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-decipher via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-decipher -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-decipher_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-decipher_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-decipher_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/app/bioconductor-decipher_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/app/bioconductor-decipher_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..38c7b4af8abf546240648e89a8c0ab3ab949d7c5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/app/bioconductor-decipher_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/app/bioconductor-decipher_server.py') +SERVER_NAME = 'biosci_bioconductor_decipher' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..10686798d56c15c9f8d405ebcaf06e7ae62b78ca --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-decipher: + build: . + image: mcp-bioconductor-decipher:latest + container_name: mcp-bioconductor-decipher + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-decipher + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..551ecb92037dae092073d842ab487868a010c2e4 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-decipher + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-decipher/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9b0f11efd1181364a6ae2124d61ec7bc886f56fb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-ensembldb via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-ensembldb -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-ensembldb_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-ensembldb_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-ensembldb_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_server.py new file mode 100644 index 0000000000000000000000000000000000000000..b16aa3887d89f6af557937f4480a2a8aa12f8734 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_server.py @@ -0,0 +1,433 @@ +import subprocess +import tempfile +import textwrap +from pathlib import Path +from typing import Optional, List, Dict, Any + +# Assume mcp.tool is imported from a framework library +class mcp: + def tool(func): + return func + +def _run_r_script(r_script_content: str, args: List[str]) -> Dict[str, Any]: + """ + A helper function to execute an R script using Rscript, handling errors. + + This function requires that R and the required Bioconductor packages + (e.g., ensembldb, AnnotationFilter) are installed in the execution environment. + + Args: + r_script_content: A string containing the R code to execute. + args: A list of command-line arguments for the R script. + + Returns: + A dictionary containing the executed command, stdout, and stderr. + + Raises: + RuntimeError: If Rscript is not found in the system's PATH. + subprocess.CalledProcessError: If the R script execution fails. + """ + try: + with tempfile.NamedTemporaryFile(mode='w', suffix=".R", delete=False, encoding='utf-8') as tmp_script: + script_path = Path(tmp_script.name) + tmp_script.write(r_script_content) + + command = ["Rscript", str(script_path)] + args + + process = subprocess.run( + command, + check=True, + capture_output=True, + text=True, + encoding='utf-8' + ) + return { + "command_executed": " ".join(command), + "stdout": process.stdout, + "stderr": process.stderr + } + except FileNotFoundError: + raise RuntimeError("Rscript not found. Please ensure R is installed and in your PATH.") + except subprocess.CalledProcessError as e: + error_message = ( + f"R script execution failed with exit code {e.returncode}.\n" + f"Command: {' '.join(e.cmd)}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) + # Re-raise with a more informative stderr + raise subprocess.CalledProcessError(e.returncode, e.cmd, output=e.stdout, stderr=error_message) + finally: + if 'script_path' in locals() and script_path.exists(): + script_path.unlink() + +@mcp.tool +def create_ensdb_from_gtf( + gtf_file: Path, + output_db: Path, + organism: str, + genome_version: str, + ensembl_version: str, +) -> Dict[str, Any]: + """ + Creates an EnsemblDB SQLite database from a GTF file. + + This tool wraps the `ensDbFromGtf` function from the R/Bioconductor + package 'ensembldb'. It requires R and the 'ensembldb' package to be + installed in the environment. + + Args: + gtf_file: Path to the input GTF file. + output_db: Path for the output SQLite database file. + organism: Name of the organism (e.g., 'Homo_sapiens'). + genome_version: Genome build version (e.g., 'GRCh38'). + ensembl_version: Ensembl release version (e.g., '104'). + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + # Input validation + if not gtf_file.is_file(): + raise FileNotFoundError(f"Input GTF file not found: {gtf_file}") + if not output_db.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_db.parent}") + if not all([organism, genome_version, ensembl_version]): + raise ValueError("organism, genome_version, and ensembl_version must be non-empty strings.") + + r_script = textwrap.dedent(""" + library("ensembldb") + args <- commandArgs(trailingOnly = TRUE) + ensDbFromGtf( + gtf = args[1], + outfile = args[2], + organism = args[3], + genomeVersion = args[4], + version = args[5] + ) + """) + + args = [ + str(gtf_file), + str(output_db), + organism, + genome_version, + ensembl_version + ] + + result = _run_r_script(r_script, args) + result["output_files"] = [str(output_db)] + return result + +@mcp.tool +def create_ensdb_from_gff( + gff_file: Path, + output_db: Path, + organism: str, + genome_version: str, + ensembl_version: str, +) -> Dict[str, Any]: + """ + Creates an EnsemblDB SQLite database from a GFF3 file. + + This tool wraps the `ensDbFromGff` function from the R/Bioconductor + package 'ensembldb'. It requires R and the 'ensembldb' package to be + installed in the environment. + + Args: + gff_file: Path to the input GFF3 file. + output_db: Path for the output SQLite database file. + organism: Name of the organism (e.g., 'Homo_sapiens'). + genome_version: Genome build version (e.g., 'GRCh38'). + ensembl_version: Ensembl release version (e.g., '104'). + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + # Input validation + if not gff_file.is_file(): + raise FileNotFoundError(f"Input GFF file not found: {gff_file}") + if not output_db.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_db.parent}") + if not all([organism, genome_version, ensembl_version]): + raise ValueError("organism, genome_version, and ensembl_version must be non-empty strings.") + + r_script = textwrap.dedent(""" + library("ensembldb") + args <- commandArgs(trailingOnly = TRUE) + ensDbFromGff( + gff = args[1], + outfile = args[2], + organism = args[3], + genomeVersion = args[4], + version = args[5] + ) + """) + + args = [ + str(gff_file), + str(output_db), + organism, + genome_version, + ensembl_version + ] + + result = _run_r_script(r_script, args) + result["output_files"] = [str(output_db)] + return result + +def _build_query_script(query_function: str, extra_r_code: str = "") -> str: + """Helper to generate the R script for various query types.""" + return textwrap.dedent(f""" + library("ensembldb") + library("AnnotationFilter") + + args <- commandArgs(trailingOnly = TRUE) + + parse_args <- function(args) {{ + params <- list() + for (arg in args) {{ + if (startsWith(arg, "--")) {{ + parts <- strsplit(substring(arg, 3), "=", fixed = TRUE)[[1]] + key <- parts[1] + value <- if (length(parts) > 1) parts[2] else TRUE + params[[key]] <- value + }} + }} + return(params) + }} + + params <- parse_args(args) + + if (is.null(params$db) || is.null(params$outfile)) {{ + stop("Both --db and --outfile arguments are required.") + }} + + edb <- EnsDb(params$db) + + filter_list <- list() + if (!is.null(params$filter_gene_id)) {{ + filter_list <- c(filter_list, GeneIdFilter(params$filter_gene_id)) + }} + if (!is.null(params$filter_gene_biotype)) {{ + filter_list <- c(filter_list, GeneBiotypeFilter(params$filter_gene_biotype)) + }} + if (!is.null(params$filter_seq_name)) {{ + filter_list <- c(filter_list, SeqNameFilter(params$filter_seq_name)) + }} + if (!is.null(params$filter_tx_id)) {{ + filter_list <- c(filter_list, TxIdFilter(params$filter_tx_id)) + }} + if (!is.null(params$filter_tx_biotype)) {{ + filter_list <- c(filter_list, TxBiotypeFilter(params$filter_tx_biotype)) + }} + if (!is.null(params$filter_exon_id)) {{ + filter_list <- c(filter_list, ExonIdFilter(params$filter_exon_id)) + }} + + final_filter <- NULL + if (length(filter_list) > 0) {{ + final_filter <- AnnotationFilterList(filter_list, logicOp = "&") + }} + + {extra_r_code} + + results <- {query_function}(edb, filter = final_filter) + + write.table(as.data.frame(results), file = params$outfile, sep = "\t", row.names = FALSE, quote = FALSE) + + cat("Successfully wrote query results to:", params$outfile, "\n") + """) + +@mcp.tool +def query_genes( + db_file: Path, + output_tsv: Path, + filter_gene_id: Optional[str] = None, + filter_gene_biotype: Optional[str] = None, + filter_seq_name: Optional[str] = None, +) -> Dict[str, Any]: + """ + Queries gene information from an EnsemblDB SQLite database. + + This tool wraps the `genes` function from 'ensembldb'. It requires R, + 'ensembldb', and 'AnnotationFilter' packages. + + Args: + db_file: Path to the input EnsemblDB SQLite file. + output_tsv: Path for the output TSV file. + filter_gene_id: Optional filter by Ensembl gene ID. + filter_gene_biotype: Optional filter by gene biotype (e.g., 'protein_coding'). + filter_seq_name: Optional filter by sequence/chromosome name (e.g., 'X'). + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + if not db_file.is_file(): + raise FileNotFoundError(f"Input database file not found: {db_file}") + if not output_tsv.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_tsv.parent}") + + r_script = _build_query_script("genes") + + args = [f"--db={db_file}", f"--outfile={output_tsv}"] + if filter_gene_id: + args.append(f"--filter_gene_id={filter_gene_id}") + if filter_gene_biotype: + args.append(f"--filter_gene_biotype={filter_gene_biotype}") + if filter_seq_name: + args.append(f"--filter_seq_name={filter_seq_name}") + + result = _run_r_script(r_script, args) + result["output_files"] = [str(output_tsv)] + return result + +@mcp.tool +def query_transcripts( + db_file: Path, + output_tsv: Path, + filter_gene_id: Optional[str] = None, + filter_tx_id: Optional[str] = None, + filter_tx_biotype: Optional[str] = None, +) -> Dict[str, Any]: + """ + Queries transcript information from an EnsemblDB SQLite database. + + This tool wraps the `transcripts` function from 'ensembldb'. It requires R, + 'ensembldb', and 'AnnotationFilter' packages. + + Args: + db_file: Path to the input EnsemblDB SQLite file. + output_tsv: Path for the output TSV file. + filter_gene_id: Optional filter by Ensembl gene ID. + filter_tx_id: Optional filter by Ensembl transcript ID. + filter_tx_biotype: Optional filter by transcript biotype (e.g., 'protein_coding'). + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + if not db_file.is_file(): + raise FileNotFoundError(f"Input database file not found: {db_file}") + if not output_tsv.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_tsv.parent}") + + r_script = _build_query_script("transcripts") + + args = [f"--db={db_file}", f"--outfile={output_tsv}"] + if filter_gene_id: + args.append(f"--filter_gene_id={filter_gene_id}") + if filter_tx_id: + args.append(f"--filter_tx_id={filter_tx_id}") + if filter_tx_biotype: + args.append(f"--filter_tx_biotype={filter_tx_biotype}") + + result = _run_r_script(r_script, args) + result["output_files"] = [str(output_tsv)] + return result + +@mcp.tool +def query_exons( + db_file: Path, + output_tsv: Path, + filter_gene_id: Optional[str] = None, + filter_tx_id: Optional[str] = None, + filter_exon_id: Optional[str] = None, +) -> Dict[str, Any]: + """ + Queries exon information from an EnsemblDB SQLite database. + + This tool wraps the `exons` function from 'ensembldb'. It requires R, + 'ensembldb', and 'AnnotationFilter' packages. + + Args: + db_file: Path to the input EnsemblDB SQLite file. + output_tsv: Path for the output TSV file. + filter_gene_id: Optional filter by Ensembl gene ID. + filter_tx_id: Optional filter by Ensembl transcript ID. + filter_exon_id: Optional filter by Ensembl exon ID. + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + if not db_file.is_file(): + raise FileNotFoundError(f"Input database file not found: {db_file}") + if not output_tsv.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_tsv.parent}") + + r_script = _build_query_script("exons") + + args = [f"--db={db_file}", f"--outfile={output_tsv}"] + if filter_gene_id: + args.append(f"--filter_gene_id={filter_gene_id}") + if filter_tx_id: + args.append(f"--filter_tx_id={filter_tx_id}") + if filter_exon_id: + args.append(f"--filter_exon_id={filter_exon_id}") + + result = _run_r_script(r_script, args) + result["output_files"] = [str(output_tsv)] + return result + +@mcp.tool +def query_promoters( + db_file: Path, + output_tsv: Path, + upstream: int = 2000, + downstream: int = 200, + filter_gene_id: Optional[str] = None, + filter_tx_id: Optional[str] = None, +) -> Dict[str, Any]: + """ + Extracts promoter regions for transcripts from an EnsemblDB. + + This tool wraps the `promoters` function from 'ensembldb'. It requires R, + 'ensembldb', and 'AnnotationFilter' packages. + + Args: + db_file: Path to the input EnsemblDB SQLite file. + output_tsv: Path for the output TSV file. + upstream: The number of bases upstream of the TSS to include. + downstream: The number of bases downstream of the TSS to include. + filter_gene_id: Optional filter by Ensembl gene ID. + filter_tx_id: Optional filter by Ensembl transcript ID. + + Returns: + A dictionary containing the command executed, stdout, stderr, + and a list of output files. + """ + if not db_file.is_file(): + raise FileNotFoundError(f"Input database file not found: {db_file}") + if not output_tsv.parent.is_dir(): + raise NotADirectoryError(f"Output directory does not exist: {output_tsv.parent}") + if upstream < 0 or downstream < 0: + raise ValueError("upstream and downstream values must be non-negative.") + + # The 'promoters' function takes upstream/downstream as direct arguments, + # so we modify the R script generation slightly. + extra_r_code = textwrap.dedent(f""" + up <- as.numeric(params$upstream) + down <- as.numeric(params$downstream) + results <- promoters(edb, upstream = up, downstream = down, filter = final_filter) + """) + + # We remove the final `results <- ...` line from the base template + base_script = _build_query_script("", extra_r_code) + + args = [ + f"--db={db_file}", + f"--outfile={output_tsv}", + f"--upstream={upstream}", + f"--downstream={downstream}" + ] + if filter_gene_id: + args.append(f"--filter_gene_id={filter_gene_id}") + if filter_tx_id: + args.append(f"--filter_tx_id={filter_tx_id}") + + result = _run_r_script(base_script, args) + result["output_files"] = [str(output_tsv)] + return result \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..8313a2a3d9801b46701ee1832c7889bb14e241f8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/bioconductor-ensembldb_server.py') +SERVER_NAME = 'biosci_bioconductor_ensembldb' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..fa827e40424fd2e2a65cbddc7f4cf3a3492f6067 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-ensembldb: + build: . + image: mcp-bioconductor-ensembldb:latest + container_name: mcp-bioconductor-ensembldb + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-ensembldb + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..62a1c11177e8cff952ab7e45ef6a86420acc5fff --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-ensembldb + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-ensembldb/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..058e2e690efb46b0d54a80923d71a0f11fec4ddc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-escher via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-escher -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-escher_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-escher_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-escher_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/app/bioconductor-escher_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/app/bioconductor-escher_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..7ee7b113e8e9d722dc366b15ac8abde8e3ae256c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/app/bioconductor-escher_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/app/bioconductor-escher_server.py') +SERVER_NAME = 'biosci_bioconductor_escher' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..33e3ee7e3a9ca4625e9cc78d2ba5d7a00c40015d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-escher + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-escher/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..dc26f6e5aed612e1d00f134418a4dfb7f9cfe0cb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-genomeinfodbdata via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-genomeinfodbdata -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-genomeinfodbdata_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-genomeinfodbdata_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-genomeinfodbdata_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_server.py new file mode 100644 index 0000000000000000000000000000000000000000..673b3e6005e9431d22f349cbed330bb9973aa3ee --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_server.py @@ -0,0 +1,130 @@ +import subprocess +from pathlib import Path +from typing import List, Optional, Dict, Any + +# MCP decorator placeholder +def tool(*args, **kwargs): + def decorator(f): + return f + return decorator + +# In a real MCP environment, the 'mcp' object would be imported. +# For this standalone script, we define a placeholder. +class mcp: + tool = tool + +@mcp.tool() +def run_rscript( + script_file: Optional[Path] = None, + expressions: Optional[List[str]] = None, + args: Optional[List[str]] = None, + verbose: bool = False, + default_packages: Optional[str] = None, + save: bool = False, + no_environ: bool = False, + no_site_file: bool = False, + no_init_file: bool = False, + restore: bool = False, + vanilla: bool = False, +) -> Dict[str, Any]: + """ + Executes an R script using the Rscript interpreter. + + This tool is a general-purpose wrapper for the Rscript command-line utility. + The 'bioconductor-genomeinfodbdata' package is a data-only package and does not + have its own executable. It is intended to be used within R scripts, which can + be run with this tool. + + Args: + script_file: Path to the R script file to be executed. + expressions: A list of R expressions to be executed. Use this or script_file, not both. + args: A list of arguments to be passed to the R script. + verbose: Print information on progress (--verbose). + default_packages: A comma-separated list of package names to be loaded by default (--default-packages). + save: Save the workspace at the end of the session (--save). + no_environ: Don't read the site and user environment files (--no-environ). + no_site_file: Don't read the site-wide Rprofile (--no-site-file). + no_init_file: Don't read the user R profile (--no-init-file). + restore: Restore previously saved objects at startup (--restore). + vanilla: Combine --no-save, --no-restore, --no-site-file, --no-init-file, and --no-environ (--vanilla). + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output files. + """ + # Input validation + if script_file and expressions: + raise ValueError("Provide either 'script_file' or 'expressions', not both.") + if not script_file and not expressions: + raise ValueError("Either 'script_file' or 'expressions' must be provided.") + + if script_file: + if not script_file.is_file(): + raise FileNotFoundError(f"The script file does not exist: {script_file}") + + cmd = ["Rscript"] + + # Add R-specific options + if vanilla: + cmd.append("--vanilla") + else: + if save: + cmd.append("--save") + if no_environ: + cmd.append("--no-environ") + if no_site_file: + cmd.append("--no-site-file") + if no_init_file: + cmd.append("--no-init-file") + if restore: + cmd.append("--restore") + + if verbose: + cmd.append("--verbose") + if default_packages: + cmd.extend(["--default-packages", default_packages]) + + # Add script file or expressions + if script_file: + cmd.append(str(script_file)) + elif expressions: + for expr in expressions: + cmd.extend(["-e", expr]) + + # Add script arguments + if args: + cmd.extend(args) + + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + stdout = result.stdout + stderr = result.stderr + except FileNotFoundError: + return { + "command_executed": command_executed, + "stdout": "", + "stderr": "Error: Rscript not found. Is R installed and in your PATH?", + "output_files": [] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [] + } + + # Since the script's output files are unknown, we return an empty list. + # The user's R script is responsible for managing its own outputs. + return { + "command_executed": command_executed, + "stdout": stdout, + "stderr": stderr, + "output_files": [], + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..50c7513e3e083a896da9551cc0ea1380659fdd47 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/bioconductor-genomeinfodbdata_server.py') +SERVER_NAME = 'biosci_bioconductor_genomeinfodbdata' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..417a651e07b0490b797620fdf758562f52d5a1cb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-genomeinfodbdata: + build: . + image: mcp-bioconductor-genomeinfodbdata:latest + container_name: mcp-bioconductor-genomeinfodbdata + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-genomeinfodbdata + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e178851c0df5db898851d3336adcacfea12f5cad --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-genomeinfodbdata + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-genomeinfodbdata/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2069a4e8592c1da90c7837bb6d4c45e57bd872d8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-go.db via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-go.db -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-go.db_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-go.db_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-go.db_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_server.py new file mode 100644 index 0000000000000000000000000000000000000000..5c170deb87ad31df741861c1639385656c58f5fa --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_server.py @@ -0,0 +1,327 @@ +import subprocess +import tempfile +import json +from pathlib import Path +from typing import List, Optional, Literal + +@mcp.tool() +def go_db_select( + keys: List[str], + columns: List[str] = ["GOID", "TERM", "ONTOLOGY", "DEFINITION"], + keytype: str = "GOID" +): + """ + General query tool for GO.db using the AnnotationDbi select interface. + + Args: + keys: A list of identifiers to look up (e.g., ["GO:0008150", "GO:0003674"]). + columns: The data columns to return. Available: "GOID", "TERM", "ONTOLOGY", "DEFINITION". + keytype: The type of keys provided. Usually "GOID". + """ + # Validate inputs + if not keys: + return {"error": "No keys provided for lookup."} + + # Format R vectors + keys_r = 'c("' + '","'.join(keys) + '")' + cols_r = 'c("' + '","'.join(columns) + '")' + + r_script = f""" + library(GO.db) + res <- select(GO.db, keys={keys_r}, columns={cols_r}, keytype="{keytype}") + write.csv(res, row.names=FALSE) + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"select(GO.db, keys={keys}, columns={columns}, keytype='{keytype}')", + "stdout": process.stdout, + "stderr": process.stderr, + "description": "Query results from GO.db" + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_get_hierarchy( + go_ids: List[str], + relation_type: Literal["PARENTS", "CHILDREN", "ANCESTOR", "OFFSPRING"] = "CHILDREN" +): + """ + Retrieve hierarchical relationships for Gene Ontology terms. + + Args: + go_ids: List of GO IDs (e.g., ["GO:0007049"]). + relation_type: The type of relationship to retrieve: + - PARENTS: Immediate parents in the GO DAG. + - CHILDREN: Immediate children in the GO DAG. + - ANCESTOR: All nodes above the term in the hierarchy. + - OFFSPRING: All nodes below the term in the hierarchy. + """ + if not go_ids: + return {"error": "No GO IDs provided."} + + # Map relation type to the internal GO.db object name + map_name = f"GO{relation_type}" + go_ids_r = 'c("' + '","'.join(go_ids) + '")' + + r_script = f""" + library(GO.db) + map_obj <- {map_name} + results <- mget({go_ids_r}, map_obj, ifnotfound=NA) + # Convert list to a flat data frame for output + df <- data.frame( + Query_ID = rep(names(results), sapply(results, length)), + Related_ID = unlist(results) + ) + write.csv(df, row.names=FALSE) + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"mget({go_ids}, {map_name})", + "stdout": process.stdout, + "stderr": process.stderr, + "relation": relation_type + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_get_term_details( + go_ids: List[str] +): + """ + Retrieve detailed information (Term, Ontology, Definition) for specific GO IDs. + + Args: + go_ids: List of GO IDs (e.g., ["GO:0008150"]). + """ + if not go_ids: + return {"error": "No GO IDs provided."} + + go_ids_r = 'c("' + '","'.join(go_ids) + '")' + + r_script = f""" + library(GO.db) + # GOTERM is a special mapping object in GO.db + results <- mget({go_ids_r}, GOTERM, ifnotfound=NA) + + output <- data.frame( + GOID = character(), + Term = character(), + Ontology = character(), + Definition = character(), + stringsAsFactors = FALSE + ) + + for (i in seq_along(results)) {{ + term_obj <- results[[i]] + if (!is.na(term_obj)) {{ + output <- rbind(output, data.frame( + GOID = GOID(term_obj), + Term = Term(term_obj), + Ontology = Ontology(term_obj), + Definition = Definition(term_obj) + )) + }} + }} + write.csv(output, row.names=FALSE) + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"mget({go_ids}, GOTERM)", + "stdout": process.stdout, + "stderr": process.stderr + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_get_synonyms( + go_ids: List[str] +): + """ + Retrieve synonyms for specific Gene Ontology terms. + + Args: + go_ids: List of GO IDs. + """ + if not go_ids: + return {"error": "No GO IDs provided."} + + go_ids_r = 'c("' + '","'.join(go_ids) + '")' + + r_script = f""" + library(GO.db) + results <- mget({go_ids_r}, GOSYNONYM, ifnotfound=NA) + df <- data.frame( + GOID = rep(names(results), sapply(results, length)), + Synonym = unlist(results) + ) + write.csv(df, row.names=FALSE) + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"mget({go_ids}, GOSYNONYM)", + "stdout": process.stdout, + "stderr": process.stderr + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_list_resources(): + """ + List all available columns and keytypes in the GO.db package. + """ + r_script = """ + library(GO.db) + cat("COLUMNS:\\n") + cat(columns(GO.db), sep=", ") + cat("\\n\\nKEYTYPES:\\n") + cat(keytypes(GO.db), sep=", ") + cat("\\n") + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "columns(GO.db); keytypes(GO.db)", + "stdout": process.stdout, + "stderr": process.stderr + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_get_obsolete(): + """ + Retrieve all obsolete Gene Ontology terms stored in the database. + """ + r_script = """ + library(GO.db) + obs_ids <- keys(GO.db, keytype="GOID") + # Filter for obsolete terms using the GOOBSOLETE map + obs_map <- as.list(GOOBSOLETE) + df <- data.frame( + GOID = names(obs_map), + Term = sapply(obs_map, Term), + Ontology = sapply(obs_map, Ontology), + Definition = sapply(obs_map, Definition) + ) + write.csv(df, row.names=FALSE) + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "as.list(GOOBSOLETE)", + "stdout": process.stdout, + "stderr": process.stderr + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def go_db_map_ontology_to_ids( + ontology: Literal["BP", "CC", "MF"] = "BP" +): + """ + Retrieve all GO IDs belonging to a specific ontology branch. + + Args: + ontology: The ontology branch to retrieve: + - BP: Biological Process + - CC: Cellular Component + - MF: Molecular Function + """ + # Map ontology to the internal GO.db map object + map_name = f"GO{ontology}MAP" + + r_script = f""" + library(GO.db) + # The MAP objects contain all IDs for that ontology + ids <- keys({map_name}) + cat(ids, sep="\\n") + """ + + try: + process = subprocess.run( + ["Rscript", "-e", r_script], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"keys(GO{ontology}MAP)", + "stdout": process.stdout, + "stderr": process.stderr, + "ontology": ontology + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..8d3ff4d78ea4bcf2cb0b8bc00efcb3109a99ed15 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/app/bioconductor-go.db_server.py') +SERVER_NAME = 'biosci_bioconductor_go_db' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..bcb222a73c2f27a64f265287d9ff4aa040928e68 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-go.db: + build: . + image: mcp-bioconductor-go.db:latest + container_name: mcp-bioconductor-go.db + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-go.db + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0607214ee0c410fe2635325e9264b0cba5fd89bb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-go.db + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-go.db/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..aec6ef0262e5e91545dd92f443010da377b15b4d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-hoodscanr via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-hoodscanr -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-hoodscanr_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-hoodscanr_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-hoodscanr_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_server.py new file mode 100644 index 0000000000000000000000000000000000000000..000dd399219a7d6c90bff6f52623cba3943c1b19 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_server.py @@ -0,0 +1,332 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any + +@mcp.tool() +def hoodscanr_estimate_radius( + input_spe_path: str, + k: int = 6, + method: str = "mean", +) -> Dict[str, Any]: + """ + Estimate the search radius for neighborhood scanning based on the k-nearest neighbors + of cells in a SpatialExperiment object. + + Args: + input_spe_path: Path to the input SpatialExperiment object saved as an RDS file. + k: Number of nearest neighbors to consider for radius estimation. Default is 6. + method: Method to summarize distances ('mean' or 'median'). Default is 'mean'. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + if k <= 0: + return {"error": "Parameter 'k' must be a positive integer."} + + if method not in ["mean", "median"]: + return {"error": "Parameter 'method' must be either 'mean' or 'median'."} + + # R script to estimate radius + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + spe <- readRDS('{input_spe_path}') + radius <- estimate_radius(spe, k = {k}, method = '{method}') + cat(radius) + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"hoodscanR::estimate_radius(spe, k={k}, method='{method}')", + "estimated_radius": float(result.stdout.strip()), + "stdout": result.stdout, + "stderr": result.stderr + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + except ValueError: + return { + "error": "Could not parse radius from R output", + "stdout": result.stdout + } + +@mcp.tool() +def hoodscanr_hoodscan( + input_spe_path: str, + output_spe_path: str, + radius: float, + focal_cell_type: Optional[str] = None, + neighbor_cell_type: Optional[str] = None, +) -> Dict[str, Any]: + """ + Perform cellular neighborhood scanning on a SpatialExperiment object. + + Args: + input_spe_path: Path to the input SpatialExperiment RDS file. + output_spe_path: Path where the updated SpatialExperiment RDS file will be saved. + radius: The search radius for identifying neighbors. + focal_cell_type: Optional; specific cell type to act as the center of neighborhoods. + neighbor_cell_type: Optional; specific cell type to look for in the neighborhood. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + if radius <= 0: + return {"error": "Radius must be a positive number."} + + focal_arg = f"'{focal_cell_type}'" if focal_cell_type else "NULL" + neighbor_arg = f"'{neighbor_cell_type}'" if neighbor_cell_type else "NULL" + + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + spe <- readRDS('{input_spe_path}') + spe <- hoodscan(spe, radius = {radius}, focal_cell_type = {focal_arg}, neighbor_cell_type = {neighbor_arg}) + saveRDS(spe, '{output_spe_path}') + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": f"hoodscanR::hoodscan(spe, radius={radius})", + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_spe_path] + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def hoodscanr_calc_colocalisation( + input_spe_path: str, + output_csv_path: str, + focal_cell_type: Optional[str] = None, + neighbor_cell_type: Optional[str] = None, +) -> Dict[str, Any]: + """ + Calculate the colocalisation matrix between cell types based on neighborhood scanning results. + + Args: + input_spe_path: Path to the SpatialExperiment RDS file (must have been processed by hoodscan). + output_csv_path: Path to save the colocalisation matrix as a CSV file. + focal_cell_type: Optional; filter for specific focal cell types. + neighbor_cell_type: Optional; filter for specific neighbor cell types. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + focal_arg = f"'{focal_cell_type}'" if focal_cell_type else "NULL" + neighbor_arg = f"'{neighbor_cell_type}'" if neighbor_cell_type else "NULL" + + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + spe <- readRDS('{input_spe_path}') + coloc_mat <- calc_colocalisation(spe, focal_cell_type = {focal_arg}, neighbor_cell_type = {neighbor_arg}) + write.csv(as.matrix(coloc_mat), '{output_csv_path}') + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "hoodscanR::calc_colocalisation(spe)", + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_csv_path] + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def hoodscanr_calc_spatial_correlation( + input_spe_path: str, + output_csv_path: str, + focal_cell_type: Optional[str] = None, + neighbor_cell_type: Optional[str] = None, +) -> Dict[str, Any]: + """ + Calculate the spatial correlation between cell types. + + Args: + input_spe_path: Path to the SpatialExperiment RDS file. + output_csv_path: Path to save the spatial correlation matrix as a CSV file. + focal_cell_type: Optional; filter for specific focal cell types. + neighbor_cell_type: Optional; filter for specific neighbor cell types. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + focal_arg = f"'{focal_cell_type}'" if focal_cell_type else "NULL" + neighbor_arg = f"'{neighbor_cell_type}'" if neighbor_cell_type else "NULL" + + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + spe <- readRDS('{input_spe_path}') + corr_mat <- calc_spatial_correlation(spe, focal_cell_type = {focal_arg}, neighbor_cell_type = {neighbor_arg}) + write.csv(as.matrix(corr_mat), '{output_csv_path}') + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "hoodscanR::calc_spatial_correlation(spe)", + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_csv_path] + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def hoodscanr_plot_colocalisation( + input_spe_path: str, + output_plot_path: str, + focal_cell_type: Optional[str] = None, + neighbor_cell_type: Optional[str] = None, + width: int = 8, + height: int = 6, +) -> Dict[str, Any]: + """ + Generate a heatmap of the colocalisation matrix. + + Args: + input_spe_path: Path to the SpatialExperiment RDS file. + output_plot_path: Path to save the plot (e.g., 'plot.png' or 'plot.pdf'). + focal_cell_type: Optional; filter for specific focal cell types. + neighbor_cell_type: Optional; filter for specific neighbor cell types. + width: Width of the output plot in inches. Default is 8. + height: Height of the output plot in inches. Default is 6. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + focal_arg = f"'{focal_cell_type}'" if focal_cell_type else "NULL" + neighbor_arg = f"'{neighbor_cell_type}'" if neighbor_cell_type else "NULL" + + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + library(ggplot2) + spe <- readRDS('{input_spe_path}') + p <- plot_colocalisation(spe, focal_cell_type = {focal_arg}, neighbor_cell_type = {neighbor_arg}) + ggsave('{output_plot_path}', plot = p, width = {width}, height = {height}) + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "hoodscanR::plot_colocalisation(spe)", + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_plot_path] + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def hoodscanr_plot_spatial_correlation( + input_spe_path: str, + output_plot_path: str, + focal_cell_type: Optional[str] = None, + neighbor_cell_type: Optional[str] = None, + width: int = 8, + height: int = 6, +) -> Dict[str, Any]: + """ + Generate a heatmap of the spatial correlation matrix. + + Args: + input_spe_path: Path to the SpatialExperiment RDS file. + output_plot_path: Path to save the plot (e.g., 'plot.png' or 'plot.pdf'). + focal_cell_type: Optional; filter for specific focal cell types. + neighbor_cell_type: Optional; filter for specific neighbor cell types. + width: Width of the output plot in inches. Default is 8. + height: Height of the output plot in inches. Default is 6. + """ + input_path = Path(input_spe_path) + if not input_path.exists(): + return {"error": f"Input file {input_spe_path} does not exist."} + + focal_arg = f"'{focal_cell_type}'" if focal_cell_type else "NULL" + neighbor_arg = f"'{neighbor_cell_type}'" if neighbor_cell_type else "NULL" + + r_command = f""" + library(hoodscanR) + library(SpatialExperiment) + library(ggplot2) + spe <- readRDS('{input_spe_path}') + p <- plot_spatial_correlation(spe, focal_cell_type = {focal_arg}, neighbor_cell_type = {neighbor_arg}) + ggsave('{output_plot_path}', plot = p, width = {width}, height = {height}) + """ + + try: + result = subprocess.run( + ["Rscript", "-e", r_command], + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": "hoodscanR::plot_spatial_correlation(spe)", + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_plot_path] + } + except subprocess.CalledProcessError as e: + return { + "error": "R execution failed", + "stdout": e.stdout, + "stderr": e.stderr + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..8617dbabd837d5b59855258342c92aed9d9a1949 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/app/bioconductor-hoodscanr_server.py') +SERVER_NAME = 'biosci_bioconductor_hoodscanr' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..0426723e9abd2c36b5abba66ed9c683241551437 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-hoodscanr: + build: . + image: mcp-bioconductor-hoodscanr:latest + container_name: mcp-bioconductor-hoodscanr + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-hoodscanr + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b8b491acfe93cc48db6a171302ddf659bd416dfe --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-hoodscanr + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-hoodscanr/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7bdefc8af871aa387cfff8bcbd04cac3c1ed7fff --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-impute via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-impute -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-impute_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-impute_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-impute_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_server.py new file mode 100644 index 0000000000000000000000000000000000000000..b203d73e3610f70d3c9df908e4040416d5cabc3f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_server.py @@ -0,0 +1,170 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import Optional + +# This is a placeholder for the MCP decorator. +# In a real MCP environment, this would be provided by the MCP framework. +def tool(func): + def wrapper(*args, **kwargs): + # In a real scenario, the MCP framework would handle + # the execution environment, dependency management, etc. + return func(*args, **kwargs) + return wrapper + +mcp = type("mcp", (), {"tool": tool}) + + +@mcp.tool +def impute_knn( + data: Path, + output_file: Path, + k: int = 10, + rowmax: float = 0.5, + colmax: float = 0.8, + maxp: int = 1500, + rng_seed: int = 362436069, + input_separator: str = "\t", + has_header: bool = True, + row_names_column: int = 1, +) -> dict: + """ + Imputes missing values in a microarray data matrix using the k-Nearest Neighbors (KNN) algorithm. + + This function is a wrapper for the `impute.knn` function from the Bioconductor 'impute' package. + It takes a data matrix with missing values (represented as NA) and fills them in by averaging + the values from the 'k' most similar rows (genes). + + Args: + data: Path to the input data matrix file (e.g., CSV or TSV). Missing values should be represented as 'NA'. + output_file: Path to save the imputed data matrix. + k: The number of nearest neighbors to use for imputation. + rowmax: The maximum allowed percentage of missing values in any row. Rows exceeding this threshold are not imputed and returned as all NAs. + colmax: The maximum allowed percentage of missing values in any column. If any column exceeds this, the program will abort. + maxp: The maximum number of genes to process in a single batch. If the dataset is larger, it will be processed in chunks. + rng_seed: Seed for the random number generator to ensure reproducibility. + input_separator: The delimiter used in the input file (e.g., '\\t' for TSV, ',' for CSV). + has_header: A boolean indicating if the input file has a header row. + row_names_column: The 1-based index of the column containing row names. + + Returns: + A dictionary containing the executed command, stdout, stderr, and a list of output file paths. + """ + # 1. Input validation + if not data.is_file(): + raise FileNotFoundError(f"Input file not found: {data}") + if k <= 0: + raise ValueError("The number of neighbors 'k' must be a positive integer.") + if not (0.0 <= rowmax <= 1.0): + raise ValueError("'rowmax' must be a float between 0.0 and 1.0.") + if not (0.0 <= colmax <= 1.0): + raise ValueError("'colmax' must be a float between 0.0 and 1.0.") + if maxp <= 0: + raise ValueError("'maxp' must be a positive integer.") + if row_names_column <= 0: + raise ValueError("'row_names_column' must be a positive integer.") + + # 2. R script generation + r_script_content = f""" + # Load the required library + if (!requireNamespace("impute", quietly = TRUE)) {{ + stop("The 'impute' package is not installed. Please install it from Bioconductor.") + }} + library(impute) + + # Define parameters + input_file <- "{data.resolve()}" + output_file <- "{output_file.resolve()}" + k_val <- {k} + rowmax_val <- {rowmax} + colmax_val <- {colmax} + maxp_val <- {maxp} + rng_seed_val <- {rng_seed} + sep_char <- "{input_separator}" + header_bool <- {"TRUE" if has_header else "FALSE"} + row_names_col_idx <- {row_names_column} + + # Read the input data + # Using tryCatch to provide a more informative error message + data_matrix <- tryCatch({{ + as.matrix(read.table( + input_file, + header=header_bool, + sep=sep_char, + row.names=row_names_col_idx, + as.is=TRUE, + check.names=FALSE + )) + }}, error = function(e) {{ + stop(paste("Failed to read the input file:", e$message)) + }}) + + # Set the seed for reproducibility + set.seed(rng_seed_val) + + # Perform KNN imputation + # The result is a list, with the imputed data in the 'data' element + imputed_result <- impute.knn( + data_matrix, + k = k_val, + rowmax = rowmax_val, + colmax = colmax_val, + maxp = maxp_val + ) + imputed_data <- imputed_result$data + + # Write the imputed data to the output file + write.table( + imputed_data, + file = output_file, + sep = sep_char, + quote = FALSE, + col.names = NA # Keeps column names and adds a blank for the row names column + ) + + cat("Imputation complete. Output written to", output_file, "\\n") + """ + + # 3. Subprocess execution + command = [] + stdout_str = "" + stderr_str = "" + + try: + with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix=".R") as r_script_file: + r_script_file.write(r_script_content) + script_path = r_script_file.name + + command = ["Rscript", script_path] + + process = subprocess.run( + command, + check=True, + capture_output=True, + text=True, + ) + stdout_str = process.stdout + stderr_str = process.stderr + + except FileNotFoundError: + raise RuntimeError("Rscript not found. Please ensure R is installed and in your system's PATH.") + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "error": "R script execution failed." + } + finally: + # Clean up the temporary R script + if 'script_path' in locals() and Path(script_path).exists(): + Path(script_path).unlink() + + # 4. Structured result return + return { + "command_executed": " ".join(command), + "stdout": stdout_str, + "stderr": stderr_str, + "output_files": [str(output_file)] + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..d9042b35f4fdaf4ec502bf34ccf23ab820bd56fb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/bioconductor-impute_server.py') +SERVER_NAME = 'biosci_bioconductor_impute' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..48eaf8a733f4024b5f7383bdc2cf9078f1c076f8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-impute: + build: . + image: mcp-bioconductor-impute:latest + container_name: mcp-bioconductor-impute + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-impute + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2203a61220545c7d82d1989a22a9cb738b501456 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-impute + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-impute/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..78c8aad093ce7b8c16bd39ced21755f4ca8bea80 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-iranges via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-iranges -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-iranges_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-iranges_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-iranges_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_server.py new file mode 100644 index 0000000000000000000000000000000000000000..9a01a671b4a997f461c83b9ff6373c8a35f64b79 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_server.py @@ -0,0 +1,123 @@ +import subprocess +from pathlib import Path +from typing import Optional, List + +# MCP decorator is included as per the instructions. +# No import is provided as it's assumed to be in the execution environment. + +@mcp.tool() +def run_iranges_script( + script_file: Optional[Path] = None, + expression: Optional[str] = None, + script_args: Optional[List[str]] = None, + verbose: bool = False, + default_packages: Optional[str] = None, + save: bool = False, + no_environ: bool = False, + no_site_file: bool = False, + no_init_file: bool = False, + restore: bool = False, + vanilla: bool = False, +): + """ + Executes an R script in an environment with the bioconductor-iranges package. + + This tool is a wrapper for the Rscript command-line interpreter. Since + bioconductor-iranges is an R library, this tool allows you to run scripts + that leverage its functionality. You must provide either a script file or an + R expression string to execute. + + Args: + script_file: Path to the R script file to be executed. + expression: An R expression string to be executed directly. + Mutually exclusive with script_file. + script_args: A list of arguments to be passed to the R script. + verbose: Print information on progress. Corresponds to --verbose. + default_packages: Comma-separated list of package names to be loaded, + or 'NULL'. Corresponds to --default-packages. + save: Save the workspace at the end of the session. Corresponds to --save. + no_environ: Don't read the site and user environment files. + Corresponds to --no-environ. + no_site_file: Don't read the site-wide Rprofile. + Corresponds to --no-site-file. + no_init_file: Don't read the user R profile. Corresponds to --no-init-file. + restore: Restore previously saved objects at startup. + Corresponds to --restore. + vanilla: Combine --no-save, --no-restore, --no-site-file, + --no-init-file and --no-environ. Corresponds to --vanilla. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list + of output files (which will be empty as output is script-dependent). + """ + # 1. Input Validation + if not script_file and not expression: + raise ValueError("You must provide either 'script_file' or 'expression'.") + if script_file and expression: + raise ValueError("Parameters 'script_file' and 'expression' are mutually exclusive.") + if script_file and not script_file.is_file(): + raise FileNotFoundError(f"The specified script file does not exist: {script_file}") + + # 2. Command Construction + cmd = ["Rscript"] + + if verbose: + cmd.append("--verbose") + if default_packages: + cmd.append(f"--default-packages={default_packages}") + if save: + cmd.append("--save") + if no_environ: + cmd.append("--no-environ") + if no_site_file: + cmd.append("--no-site-file") + if no_init_file: + cmd.append("--no-init-file") + if restore: + cmd.append("--restore") + if vanilla: + cmd.append("--vanilla") + + # Add script file or expression to execute + if expression: + cmd.extend(["-e", expression]) + elif script_file: + cmd.append(str(script_file)) + + # Add script arguments if provided + if script_args: + cmd.extend(script_args) + + command_executed = " ".join(cmd) + + # 3. Subprocess Execution and Error Handling + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True + ) + # 4. Structured Result Return (Success) + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [] + } + except FileNotFoundError: + # This error occurs if 'Rscript' is not in the system's PATH + return { + "command_executed": command_executed, + "stdout": "", + "stderr": "Error: 'Rscript' command not found. Please ensure R is installed and in your system's PATH.", + "output_files": [] + } + except subprocess.CalledProcessError as e: + # This error occurs if the R script returns a non-zero exit code + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": f"R script execution failed with return code {e.returncode}:\n{e.stderr}", + "output_files": [] + } diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..b91c3aa833d1094e6b8e82c5a51d673a3c655948 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/bioconductor-iranges_server.py') +SERVER_NAME = 'biosci_bioconductor_iranges' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..7a44a8a7f67111158d1ce5c6143cbe40c2b20625 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-iranges: + build: . + image: mcp-bioconductor-iranges:latest + container_name: mcp-bioconductor-iranges + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-iranges + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e7776983b41417b9ccff7c889b7607cae4724926 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-iranges + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-iranges/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_server.py new file mode 100644 index 0000000000000000000000000000000000000000..a9ff4f9494a61ab7631e61fd28099efc282bd234 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_server.py @@ -0,0 +1,271 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Optional + +# MCP.TOOL DECORATOR (should not be included in the final output) +# This is a placeholder for the actual decorator. +def mcp_tool_placeholder(*args, **kwargs): + def decorator(func): + return func + return decorator + +# In a real MCP environment, the following line would be: +# import mcp +# and the decorator would be @mcp.tool() +mcp = type("mcp", (), {"tool": mcp_tool_placeholder}) + + +@mcp.tool() +def org_mm_eg_db_query( + keys: List[str], + keytype: str, + columns: List[str], + output_file: Path, +) -> dict: + """ + Performs an annotation query on the org.Mm.eg.db database. + + This tool uses the AnnotationDbi::select function to retrieve annotations + for a given set of keys. It maps identifiers from a specified keytype to + the desired annotation columns. + + Args: + keys: A list of identifiers to query (e.g., ["14189", "14190"]). + keytype: The type of identifier being provided in `keys`. + Use the `org_mm_eg_db_list_keytypes` tool to see available options. + Example: "ENTREZID". + columns: A list of annotation columns to retrieve. + Use the `org_mm_eg_db_list_columns` tool to see available options. + Example: ["SYMBOL", "GENENAME", "GO"]. + output_file: The path to save the resulting annotation table in TSV format. + + Returns: + A dictionary containing the command executed, stdout, stderr, and the output file path. + """ + if not keys: + raise ValueError("The 'keys' list cannot be empty.") + if not keytype: + raise ValueError("The 'keytype' parameter cannot be empty.") + if not columns: + raise ValueError("The 'columns' list cannot be empty.") + + # Convert Python lists to R vector strings, e.g., c("item1", "item2") + r_keys = 'c({})'.format(', '.join(f'"{key}"' for key in keys)) + r_columns = 'c({})'.format(', '.join(f'"{col}"' for col in columns)) + + r_script_content = f""" + # Suppress startup messages for cleaner output + suppressPackageStartupMessages(library("AnnotationDbi")) + suppressPackageStartupMessages(library("org.Mm.eg.db")) + + # Define parameters + keys_to_query <- {r_keys} + cols_to_fetch <- {r_columns} + key_type <- "{keytype}" + output_path <- "{output_file}" + + # Perform the query + # Use tryCatch to handle potential errors, like invalid keytypes or columns + results <- tryCatch( + {{ + AnnotationDbi::select( + org.Mm.eg.db, + keys = keys_to_query, + columns = cols_to_fetch, + keytype = key_type + ) + }}, + error = function(e) {{ + stop(paste("AnnotationDbi::select failed:", e$message)) + }} + ) + + # Write the output + write.table( + results, + file = output_path, + sep = "\\t", + row.names = FALSE, + quote = FALSE + ) + """ + + with tempfile.NamedTemporaryFile(mode='w', suffix=".R", delete=False) as tmp_script: + tmp_script.write(r_script_content) + script_path = tmp_script.name + + cmd = ["Rscript", script_path] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + # Clean up the temporary script file + Path(script_path).unlink() + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [str(output_file)], + } + except subprocess.CalledProcessError as e: + # Clean up the temporary script file even on error + Path(script_path).unlink() + raise RuntimeError( + f"R script execution failed with exit code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e + + +@mcp.tool() +def org_mm_eg_db_list_columns() -> dict: + """ + Lists all available annotation columns in the org.Mm.eg.db database. + + These column names can be used in the `columns` parameter of the + `org_mm_eg_db_query` tool. + + Returns: + A dictionary containing the command executed and a list of available columns in stdout. + """ + r_script_content = """ + suppressPackageStartupMessages(library("org.Mm.eg.db")) + cat(columns(org.Mm.eg.db), sep = "\\n") + """ + cmd = ["Rscript", "-e", r_script_content] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"R script execution failed with exit code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e + + +@mcp.tool() +def org_mm_eg_db_list_keytypes() -> dict: + """ + Lists all available keytypes in the org.Mm.eg.db database. + + Keytypes define the type of primary identifiers that can be used for querying + in the `keytype` parameter of the `org_mm_eg_db_query` and + `org_mm_eg_db_list_keys` tools. + + Returns: + A dictionary containing the command executed and a list of available keytypes in stdout. + """ + r_script_content = """ + suppressPackageStartupMessages(library("org.Mm.eg.db")) + cat(keytypes(org.Mm.eg.db), sep = "\\n") + """ + cmd = ["Rscript", "-e", r_script_content] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"R script execution failed with exit code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e + + +@mcp.tool() +def org_mm_eg_db_list_keys( + keytype: str, + output_file: Optional[Path] = None, +) -> dict: + """ + Lists all primary keys for a given keytype from the org.Mm.eg.db database. + + Args: + keytype: The type of identifiers to retrieve. Use the + `org_mm_eg_db_list_keytypes` tool to see available options. + output_file: Optional. If provided, saves the list of keys to this file, + one key per line. Otherwise, keys are printed to stdout. + + Returns: + A dictionary containing the command executed, stdout, stderr, and the output file path if provided. + """ + if not keytype: + raise ValueError("The 'keytype' parameter cannot be empty.") + + if output_file: + r_script_content = f""" + suppressPackageStartupMessages(library("org.Mm.eg.db")) + key_type <- "{keytype}" + output_path <- "{output_file}" + keys_list <- keys(org.Mm.eg.db, keytype = key_type) + write.table( + keys_list, + file = output_path, + col.names = FALSE, + row.names = FALSE, + quote = FALSE + ) + """ + else: + r_script_content = f""" + suppressPackageStartupMessages(library("org.Mm.eg.db")) + key_type <- "{keytype}" + keys_list <- keys(org.Mm.eg.db, keytype = key_type) + cat(keys_list, sep = "\\n") + """ + + cmd = ["Rscript", "-e", r_script_content] + command_executed = " ".join(cmd) + + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + output_files = [str(output_file)] if output_file else [] + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"R script execution failed with exit code {e.returncode}.\n" + f"Command: {command_executed}\n" + f"Stdout: {e.stdout}\n" + f"Stderr: {e.stderr}" + ) from e \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..f4f912826cb6bd82ebc9b78ae889af0c9d17420e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/app/bioconductor-org.mm.eg.db_server.py') +SERVER_NAME = 'biosci_bioconductor_org_mm_eg_db' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..0fda34df59609c6bfa58fac6b4e3c48b1cf12d84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-org.mm.eg.db: + build: . + image: mcp-bioconductor-org.mm.eg.db:latest + container_name: mcp-bioconductor-org.mm.eg.db + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-org.mm.eg.db + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e0edb9c821b81883fd437f4d3d385811b12089ee --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-org.mm.eg.db + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-org.mm.eg.db/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-rhtslib/app/bioconductor-rhtslib_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-rhtslib/app/bioconductor-rhtslib_server.py new file mode 100644 index 0000000000000000000000000000000000000000..ff69f539da938d6b1107cc350713f46ff6aff994 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-rhtslib/app/bioconductor-rhtslib_server.py @@ -0,0 +1,72 @@ +import subprocess +import shutil +from typing import Dict, Any + +# MCP framework placeholder for standalone execution +class _Mcp: + def tool(self, *args, **kwargs): + def decorator(func): + return func + return decorator +mcp = _Mcp() + +@mcp.tool() +def check_rhtslib_installation() -> Dict[str, Any]: + """ + Verifies the installation of the bioconductor-rhtslib R package and reports its version. + + bioconductor-rhtslib is an R library package that provides the HTSlib C library + for other R packages to use. It does not offer a direct command-line executable or + any user-facing functions. This utility function serves to confirm that the library + is correctly installed and accessible within the R environment by attempting to + load it and print its version using an Rscript command. + """ + rscript_path = shutil.which("Rscript") + if not rscript_path: + # This is a system configuration error. R is not available. + return { + "command_executed": "Rscript -e '...'", + "stdout": "", + "stderr": "Error: Rscript executable not found. Is R installed and in the system's PATH?", + "output_files": [] + } + + # A simple R command to get the package version. + r_command = 'cat(as.character(packageVersion("Rhtslib")))' + command = [rscript_path, "-e", r_command] + command_executed = " ".join(command) + + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True, + encoding='utf-8' + ) + stdout = process.stdout.strip() + stderr = process.stderr.strip() + + return { + "command_executed": command_executed, + "stdout": f"bioconductor-rhtslib version: {stdout}", + "stderr": stderr, + "output_files": [] + } + + except subprocess.CalledProcessError as e: + # This error is expected if the package is not installed in the R environment. + return { + "command_executed": command_executed, + "stdout": e.stdout.strip(), + "stderr": e.stderr.strip(), + "output_files": [] + } + except Exception as e: + # Catch any other unexpected errors during execution. + return { + "command_executed": command_executed, + "stdout": "", + "stderr": f"An unexpected error occurred: {str(e)}", + "output_files": [] + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7c44948db6edc3bc6b56ff992ca3f6b7ce06e115 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-spatialomicsoverlay via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-spatialomicsoverlay -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-spatialomicsoverlay_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-spatialomicsoverlay_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-spatialomicsoverlay_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_server.py new file mode 100644 index 0000000000000000000000000000000000000000..ed788a8b75160c77c3f23ce0d698f3a184947040 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_server.py @@ -0,0 +1,197 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import Optional, Literal, List +import textwrap + +# from mcp import tool as mcp_tool +# The @mcp.tool decorator is commented out as 'mcp' is not available for import. +# In a real MCP environment, this would be uncommented. + +# @mcp_tool() +def spatial_overlay( + spe_object: Path, + tissue_data: Path, + image_data: Path, + sample_id: str, + image_resolution: float, + output_file: Path, + fluorescence_data: Optional[Path] = None, + flip: Literal["none", "h", "v", "both"] = "none", + show_scale_bar: bool = True, + show_legend: bool = True, + point_alpha: Optional[float] = None, + point_size: Optional[float] = None, + point_color: Optional[str] = None, +) -> dict: + """ + Generates a spatial overlay plot using the Bioconductor spatialomicsOverlay package. + + This tool overlays spatial transcriptomics data (from a SpatialExperiment or Seurat + object) onto high-resolution histology images, allowing for visualization of + gene expression or other features in their spatial context. + + Args: + spe_object: Path to the input SpatialExperiment or Seurat object in RDS format. + tissue_data: Path to the tissue segmentation data in CSV or TSV format. + image_data: Path to the image data in CSV or TSV format. + sample_id: The sample ID within the object to plot. + image_resolution: The resolution of the image (e.g., pixels per micron). + output_file: Path to save the output plot (e.g., plot.png, plot.pdf). + fluorescence_data: Optional path to fluorescence data in CSV or TSV format. + flip: Image flip orientation. Can be 'none', 'h' (horizontal), 'v' (vertical), or 'both'. + show_scale_bar: If True, a scale bar is added to the plot. + show_legend: If True, a legend is added to the plot. + point_alpha: Optional opacity for the data points (value between 0.0 and 1.0). + point_size: Optional size for the data points. + point_color: Optional color for the data points (e.g., 'blue', '#FF0000'). + + Returns: + A dictionary containing the execution command, stdout, stderr, and a list of output files. + """ + # 1. Input Validation + if not spe_object.is_file(): + raise FileNotFoundError(f"Input SPE object not found: {spe_object}") + if not tissue_data.is_file(): + raise FileNotFoundError(f"Input tissue data not found: {tissue_data}") + if not image_data.is_file(): + raise FileNotFoundError(f"Input image data not found: {image_data}") + if fluorescence_data and not fluorescence_data.is_file(): + raise FileNotFoundError(f"Input fluorescence data not found: {fluorescence_data}") + + if point_alpha is not None and not (0.0 <= point_alpha <= 1.0): + raise ValueError("point_alpha must be between 0.0 and 1.0") + if point_size is not None and point_size < 0: + raise ValueError("point_size must be a non-negative number") + + output_file.parent.mkdir(parents=True, exist_ok=True) + + # 2. R Script Generation + # This R script is generated on-the-fly to call the spatialomicsOverlay functions. + r_script_content = textwrap.dedent("""\ + suppressPackageStartupMessages(library(optparse)) + suppressPackageStartupMessages(library(spatialomicsOverlay)) + suppressPackageStartupMessages(library(SpatialExperiment)) + suppressPackageStartupMessages(library(ggplot2)) + suppressPackageStartupMessages(library(SeuratObject)) + + option_list <- list( + make_option(c("--spe_object"), type="character", help="Path to the SpatialExperiment/Seurat RDS object"), + make_option(c("--tissue_data"), type="character", help="Path to the tissue segmentation data (CSV/TSV)"), + make_option(c("--image_data"), type="character", help="Path to the image data (CSV/TSV)"), + make_option(c("--sample_id"), type="character", help="Sample ID to plot"), + make_option(c("--image_resolution"), type="double", help="Resolution of the image"), + make_option(c("--output_file"), type="character", help="Path for the output plot"), + make_option(c("--fluorescence_data"), type="character", default=NULL, help="Path to optional fluorescence data"), + make_option(c("--flip"), type="character", default="none", help="Image flip orientation (none, h, v, both)"), + make_option(c("--show_scale_bar"), action="store_true", default=FALSE, help="Flag to show scale bar"), + make_option(c("--show_legend"), action="store_true", default=FALSE, help="Flag to show legend"), + make_option(c("--point_alpha"), type="double", default=NULL, help="Alpha for points"), + make_option(c("--point_size"), type="double", default=NULL, help="Size for points"), + make_option(c("--point_color"), type="character", default=NULL, help="Color for points") + ) + + opt_parser <- OptionParser(option_list=option_list) + opt <- parse_args(opt_parser) + + if (is.null(opt$spe_object) || is.null(opt$tissue_data) || is.null(opt$image_data) || is.null(opt$sample_id) || is.null(opt$image_resolution) || is.null(opt$output_file)) { + print_help(opt_parser) + stop("Missing one or more required arguments.", call.=FALSE) + } + + # Load data + spe <- readRDS(opt$spe_object) + tissue <- read.csv(opt$tissue_data, row.names=1) + image <- read.csv(opt$image_data, row.names=1) + fluor <- if (!is.null(opt$fluorescence_data)) read.csv(opt$fluorescence_data, row.names=1) else NULL + + # Prepare additional arguments for geom_point + geom_args <- list() + if (!is.null(opt$point_alpha)) geom_args$alpha <- opt$point_alpha + if (!is.null(opt$point_size)) geom_args$size <- opt$point_size + if (!is.null(opt$point_color)) geom_args$color <- opt$point_color + + # Generate plot by calling spatialOverlay with dynamic arguments + plot_obj <- do.call(spatialOverlay, c( + list( + object = spe, + tissue = tissue, + sample = opt$sample_id, + image = image, + res = opt$image_resolution, + fluor = fluor, + flip = opt$flip, + scaleBar = opt$show_scale_bar, + legend = opt$show_legend + ), + geom_args + )) + + # Save the generated plot + ggsave(opt$output_file, plot=plot_obj, width=10, height=10, units="in") + + cat("Plot saved successfully to:", opt$output_file, "\\n") + """) + + # 3. Command Construction + r_script_path = "" + try: + with tempfile.NamedTemporaryFile(mode='w', suffix=".R", delete=False) as r_script_file: + r_script_file.write(r_script_content) + r_script_path = r_script_file.name + + cmd = [ + "Rscript", + r_script_path, + "--spe_object", str(spe_object.resolve()), + "--tissue_data", str(tissue_data.resolve()), + "--image_data", str(image_data.resolve()), + "--sample_id", sample_id, + "--image_resolution", str(image_resolution), + "--output_file", str(output_file.resolve()), + "--flip", flip, + ] + + if fluorescence_data: + cmd.extend(["--fluorescence_data", str(fluorescence_data.resolve())]) + if show_scale_bar: + cmd.append("--show_scale_bar") + if show_legend: + cmd.append("--show_legend") + if point_alpha is not None: + cmd.extend(["--point_alpha", str(point_alpha)]) + if point_size is not None: + cmd.extend(["--point_size", str(point_size)]) + if point_color is not None: + cmd.extend(["--point_color", point_color]) + + # 4. Subprocess Execution + command_executed = " ".join(cmd) + process = subprocess.run( + cmd, + check=True, + capture_output=True, + text=True, + ) + + # 5. Structured Result Return + return { + "command_executed": command_executed, + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": [str(output_file.resolve())] + } + + except subprocess.CalledProcessError as e: + # Enhanced error reporting + error_message = ( + f"R script execution failed with return code {e.returncode}.\n" + f"Stderr:\n{e.stderr}\n" + f"Stdout:\n{e.stdout}" + ) + raise RuntimeError(error_message) from e + + finally: + # Clean up the temporary R script + if r_script_path and Path(r_script_path).exists(): + Path(r_script_path).unlink() diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e3c79bc3fd92d09a672021523e433491262e4ef8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/bioconductor-spatialomicsoverlay_server.py') +SERVER_NAME = 'biosci_bioconductor_spatialomicsoverlay' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..d4c77d9fe1eb83201b0a81ba0e6f16f6c28dc02c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-spatialomicsoverlay: + build: . + image: mcp-bioconductor-spatialomicsoverlay:latest + container_name: mcp-bioconductor-spatialomicsoverlay + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-spatialomicsoverlay + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0ba24fdf1fe638c8118d6b31186f4e7982185968 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-spatialomicsoverlay + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-spatialomicsoverlay/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..b6dd5025d9baa7922f96969c16fd07ea0dfc81a3 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install bioconductor-summarizedexperiment via conda (e.g., from bioconda) +RUN conda install -c bioconda bioconductor-summarizedexperiment -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/bioconductor-summarizedexperiment_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/bioconductor-summarizedexperiment_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/bioconductor-summarizedexperiment_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_server.py new file mode 100644 index 0000000000000000000000000000000000000000..d0073ee0af48c264d78c9845242d581fd331ec1a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_server.py @@ -0,0 +1,123 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Dict, Any, Optional + +# No mcp import needed as per instructions + +# The 'bioconductor-summarizedexperiment' tool is an R package (library), not a +# standalone command-line executable with its own set of CLI subcommands and parameters. +# The provided documentation describes its purpose, dependencies, and how to install +# and use it within an R environment (e.g., via `BiocManager::install("SummarizedExperiment")` +# and then calling R functions like `library(SummarizedExperiment)`). +# +# Therefore, it does not expose direct command-line functions or parameters that can be +# extracted and wrapped as individual MCP tools in the traditional sense (e.g., +# `summarizedexperiment --input file.txt`). +# +# To interact with such an R package from a command-line context, the standard approach +# is to execute an R script that utilizes the package's functions. This MCP tool +# provides a generic function to execute an R script, assuming the 'SummarizedExperiment' +# package (and its dependencies) are installed in the R environment where this tool runs. +# Specific functionalities of 'SummarizedExperiment' would be implemented within the +# R script content provided by the user. + +@mcp.tool() +def execute_r_script_with_summarizedexperiment( + r_script_content: str, + output_dir: Path, + r_executable: str = "Rscript", + additional_r_args: Optional[List[str]] = None, +) -> Dict[str, Any]: + """ + Executes an R script that can utilize the Bioconductor SummarizedExperiment package. + + This tool provides a generic way to run R code. The R script content should + contain the necessary R commands to load and use the SummarizedExperiment package + and perform desired operations. + + As 'bioconductor-summarizedexperiment' is an R package (library) and does not + expose direct command-line functions, this tool wraps the execution of an + arbitrary R script. The R environment where this tool runs must have the + 'SummarizedExperiment' package installed. + + Args: + r_script_content: A string containing the R script to be executed. + Example: "library(SummarizedExperiment); # Your R code here" + output_dir: Directory where any output files generated by the R script + should be placed. This directory will be created if it doesn't exist. + r_executable: The R executable to use (e.g., "Rscript", "R", or a full path). + Defaults to "Rscript" for non-interactive script execution. + additional_r_args: Optional list of additional arguments to pass to the R executable. + These are typically arguments for `Rscript` itself (e.g., `--verbose`), + not arguments for the R script content. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any + output files generated. + """ + # Input validation + if not r_script_content: + raise ValueError("R script content cannot be empty.") + if not isinstance(output_dir, Path): + raise TypeError("output_dir must be a pathlib.Path object.") + if not isinstance(r_executable, str) or not r_executable: + raise ValueError("r_executable must be a non-empty string.") + if additional_r_args is not None and not isinstance(additional_r_args, list): + raise TypeError("additional_r_args must be a list of strings or None.") + if additional_r_args: + for arg in additional_r_args: + if not isinstance(arg, str): + raise TypeError("All elements in additional_r_args must be strings.") + + # File path handling + output_dir.mkdir(parents=True, exist_ok=True) + + command: List[str] = [r_executable] + if additional_r_args: + command.extend(additional_r_args) + + temp_r_script_path: Optional[Path] = None + try: + # Use a temporary file for the R script content + with tempfile.NamedTemporaryFile(mode="w", suffix=".R", delete=False) as temp_r_script_file: + temp_r_script_file.write(r_script_content) + temp_r_script_path = Path(temp_r_script_file.name) + + command.append(str(temp_r_script_path)) + + # Subprocess execution + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True, # Raise CalledProcessError for non-zero exit codes + cwd=output_dir # Run R script in the output directory to simplify file paths + ) + stdout = process.stdout + stderr = process.stderr + command_executed = " ".join(command) + + # List output files. This is a generic approach; a more specific R script + # might write to specific known files. + output_files = [str(f) for f in output_dir.iterdir() if f.is_file()] + + return { + "command_executed": command_executed, + "stdout": stdout, + "stderr": stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + # Error handling + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"R script execution failed with exit code {e.returncode}", + "output_files": [], + } + finally: + # Ensure temporary script file is deleted + if temp_r_script_path and temp_r_script_path.exists(): + temp_r_script_path.unlink() \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..67ec2f9c41c9c46ff3d1d5e7c9a0b5dbe2824684 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/bioconductor-summarizedexperiment_server.py') +SERVER_NAME = 'biosci_bioconductor_summarizedexperiment' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..40cc6f412dfde8f9b5d29646830b73e4e427a9d8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-bioconductor-summarizedexperiment: + build: . + image: mcp-bioconductor-summarizedexperiment:latest + container_name: mcp-bioconductor-summarizedexperiment + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=bioconductor-summarizedexperiment + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..eca97cba7113f0dcbdb6e4f96f690ecdde52b1b7 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - bioconductor-summarizedexperiment + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_bioconductor-summarizedexperiment/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..45f32a9d8a3e4b71b03206319f3bed5e2c2f8713 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install checkm-genome via conda (e.g., from bioconda) +RUN conda install -c bioconda checkm-genome -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/checkm-genome_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/checkm-genome_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/checkm-genome_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_server.py new file mode 100644 index 0000000000000000000000000000000000000000..579fe9a244dad7fec6fb4e7ea38b9447c0549a05 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_server.py @@ -0,0 +1,1230 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Optional, Dict, Any, Union + +# Helper function to execute CheckM commands +def _run_checkm_command( + command: List[str], + output_dir: Optional[Path] = None, + log_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, + pplacer_path: Optional[Path] = None, + hmmer_path: Optional[Path] = None, + prodigal_path: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Internal helper function to execute CheckM commands and handle common options. + + Args: + command: A list of strings representing the CheckM subcommand and its specific arguments. + output_dir: An optional Path to a directory where the tool is expected to write output files. + Used for collecting output_files in the result. + log_file: An optional Path to a file where stdout/stderr should be redirected. + quiet: If True, suppress CheckM's stdout. + debug: If True, enable CheckM's debug mode. + force: If True, force overwrite of existing files. + tmpdir: An optional Path to a temporary directory for CheckM. + threads: Number of threads for CheckM to use. + pplacer_path: Path to the pplacer executable. + hmmer_path: Path to HMMER executables. + prodigal_path: Path to the Prodigal executable. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + cmd = ["checkm"] + command + + if quiet: + cmd.append("-q") + if debug: + cmd.append("-d") + if force: + cmd.append("--force") + if tmpdir: + if not tmpdir.is_dir(): + raise ValueError(f"Temporary directory '{tmpdir}' does not exist or is not a directory.") + cmd.extend(["--tmpdir", str(tmpdir)]) + if threads > 1: + cmd.extend(["-t", str(threads)]) + if pplacer_path: + if not pplacer_path.is_file(): + raise ValueError(f"pplacer executable '{pplacer_path}' not found.") + cmd.extend(["--pplacer_path", str(pplacer_path)]) + if hmmer_path: + if not hmmer_path.is_file(): + raise ValueError(f"HMMER executable '{hmmer_path}' not found.") + cmd.extend(["--hmmer_path", str(hmmer_path)]) + if prodigal_path: + if not prodigal_path.is_file(): + raise ValueError(f"Prodigal executable '{prodigal_path}' not found.") + cmd.extend(["--prodigal_path", str(prodigal_path)]) + + stdout_output = "" + stderr_output = "" + output_files = [] + + try: + process = subprocess.run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) + stdout_output = process.stdout + stderr_output = process.stderr + except subprocess.CalledProcessError as e: + stdout_output = e.stdout + stderr_output = e.stderr + return { + "command_executed": " ".join(cmd), + "stdout": stdout_output, + "stderr": stderr_output, + "output_files": [], + "error": str(e), + } + + if log_file: + log_file.parent.mkdir(parents=True, exist_ok=True) + with open(log_file, "w") as f: + f.write(f"Command: {' '.join(cmd)}\n\n") + f.write("STDOUT:\n") + f.write(stdout_output) + f.write("\nSTDERR:\n") + f.write(stderr_output) + + if output_dir and output_dir.is_dir(): + output_files.extend([str(p) for p in output_dir.rglob("*") if p.is_file()]) + + return { + "command_executed": " ".join(cmd), + "stdout": stdout_output, + "stderr": stderr_output, + "output_files": output_files, + } + +# Helper function to add plotting arguments +def _add_plotting_args( + cmd: List[str], + image_file: Optional[Path] = None, + image_type: Optional[str] = None, + font_size: Optional[int] = None, + dpi: Optional[int] = None, + width: Optional[float] = None, + height: Optional[float] = None, + title: Optional[str] = None, + label: Optional[str] = None, + color: Optional[str] = None, + marker_size: Optional[int] = None, + line_width: Optional[int] = None, +) -> None: + """ + Internal helper function to append common plotting arguments to a command list. + Only appends arguments if their values are explicitly provided (not None). + """ + if image_file: + cmd.extend(["--image_file", str(image_file)]) + if image_type: + cmd.extend(["--image_type", image_type]) + if font_size is not None: + cmd.extend(["--font_size", str(font_size)]) + if dpi is not None: + cmd.extend(["--dpi", str(dpi)]) + if width is not None: + cmd.extend(["--width", str(width)]) + if height is not None: + cmd.extend(["--height", str(height)]) + if title: + cmd.extend(["--title", title]) + if label: + cmd.extend(["--label", label]) + if color: + cmd.extend(["--color", color]) + if marker_size is not None: + cmd.extend(["--marker_size", str(marker_size)]) + if line_width is not None: + cmd.extend(["--line_width", str(line_width)]) + + +@mcp.tool() +def data( + download_folder: Optional[Path] = None, + output_file: Optional[Path] = None, + force: bool = False, + quiet: bool = False, + debug: bool = False, +) -> Dict[str, Any]: + """ + Downloads and installs the CheckM reference data. + + Args: + download_folder: Folder to download data to. If not specified, CheckM's default data folder is used. + output_file: File to write output to. If not specified, output goes to stdout. + force: Force overwrite of existing files. + quiet: Suppress stdout. + debug: Enable debug mode. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + cmd = ["data"] + + if download_folder: + download_folder.mkdir(parents=True, exist_ok=True) + cmd.extend(["--download_folder", str(download_folder)]) + + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--file", str(output_file)]) + + return _run_checkm_command( + cmd, + log_file=output_file, + force=force, + quiet=quiet, + debug=debug, + ) + + +@mcp.tool() +def lineage_wf( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + reduced_tree: bool = False, + output_alignment_files: bool = False, + output_nucleotide_sequences: bool = False, + tab_output_file: Optional[Path] = None, + skip_gtdb_r207: bool = False, + skip_gtdb_r207_cpr: bool = False, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, + pplacer_path: Optional[Path] = None, + hmmer_path: Optional[Path] = None, + prodigal_path: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Performs a lineage-specific workflow for assessing genome quality. + This is the recommended workflow for most users. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + reduced_tree: Use a reduced tree for phylogenetic placement. + output_alignment_files: Output alignment files. + output_nucleotide_sequences: Output nucleotide sequences. + tab_output_file: File to write tab-separated output to. + skip_gtdb_r207: Skip GTDB R207 marker set. + skip_gtdb_r207_cpr: Skip GTDB R207 CPR marker set. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + pplacer_path: Path to pplacer executable. + hmmer_path: Path to HMMER executables. + prodigal_path: Path to Prodigal executable. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["lineage_wf", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if reduced_tree: + cmd.append("-r") + if output_alignment_files: + cmd.append("--ali") + if output_nucleotide_sequences: + cmd.append("--nt") + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + if skip_gtdb_r207: + cmd.append("--skip_gtdb_r207") + if skip_gtdb_r207_cpr: + cmd.append("--skip_gtdb_r207_cpr") + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + pplacer_path=pplacer_path, + hmmer_path=hmmer_path, + prodigal_path=prodigal_path, + ) + + +@mcp.tool() +def taxonomy_wf( + taxonomy_level: str, + taxonomy_id: str, + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + output_alignment_files: bool = False, + output_nucleotide_sequences: bool = False, + tab_output_file: Optional[Path] = None, + skip_gtdb_r207: bool = False, + skip_gtdb_r207_cpr: bool = False, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, + pplacer_path: Optional[Path] = None, + hmmer_path: Optional[Path] = None, + prodigal_path: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Performs a taxonomy-specific workflow for assessing genome quality. + + Args: + taxonomy_level: Taxonomy level (e.g., 'domain', 'phylum', 'class', 'order', 'family', 'genus', 'species'). + taxonomy_id: Taxonomy identifier (e.g., 'Bacteria', 'Firmicutes', 'Bacilli'). + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + output_alignment_files: Output alignment files. + output_nucleotide_sequences: Output nucleotide sequences. + tab_output_file: File to write tab-separated output to. + skip_gtdb_r207: Skip GTDB R207 marker set. + skip_gtdb_r207_cpr: Skip GTDB R207 CPR marker set. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + pplacer_path: Path to pplacer executable. + hmmer_path: Path to HMMER executables. + prodigal_path: Path to Prodigal executable. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + valid_levels = ['domain', 'phylum', 'class', 'order', 'family', 'genus', 'species'] + if taxonomy_level not in valid_levels: + raise ValueError(f"Invalid taxonomy_level: '{taxonomy_level}'. Must be one of {valid_levels}.") + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["taxonomy_wf", taxonomy_level, taxonomy_id, str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if output_alignment_files: + cmd.append("--ali") + if output_nucleotide_sequences: + cmd.append("--nt") + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + if skip_gtdb_r207: + cmd.append("--skip_gtdb_r207") + if skip_gtdb_r207_cpr: + cmd.append("--skip_gtdb_r207_cpr") + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + pplacer_path=pplacer_path, + hmmer_path=hmmer_path, + prodigal_path=prodigal_path, + ) + + +@mcp.tool() +def tree_wf( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + full_tree: bool = False, + output_alignment_files: bool = False, + output_nucleotide_sequences: bool = False, + tab_output_file: Optional[Path] = None, + skip_gtdb_r207: bool = False, + skip_gtdb_r207_cpr: bool = False, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, + pplacer_path: Optional[Path] = None, + hmmer_path: Optional[Path] = None, + prodigal_path: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Performs a tree-specific workflow for assessing genome quality. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + full_tree: Use a full tree for phylogenetic placement instead of the default reduced tree. + output_alignment_files: Output alignment files. + output_nucleotide_sequences: Output nucleotide sequences. + tab_output_file: File to write tab-separated output to. + skip_gtdb_r207: Skip GTDB R207 marker set. + skip_gtdb_r207_cpr: Skip GTDB R207 CPR marker set. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + pplacer_path: Path to pplacer executable. + hmmer_path: Path to HMMER executables. + prodigal_path: Path to Prodigal executable. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["tree_wf", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if full_tree: + cmd.append("--full_tree") + if output_alignment_files: + cmd.append("--ali") + if output_nucleotide_sequences: + cmd.append("--nt") + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + if skip_gtdb_r207: + cmd.append("--skip_gtdb_r207") + if skip_gtdb_r207_cpr: + cmd.append("--skip_gtdb_r207_cpr") + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + pplacer_path=pplacer_path, + hmmer_path=hmmer_path, + prodigal_path=prodigal_path, + ) + + +@mcp.tool() +def tree( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + reduced_tree: bool = False, + output_alignment_files: bool = False, + output_nucleotide_sequences: bool = False, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, + pplacer_path: Optional[Path] = None, + hmmer_path: Optional[Path] = None, + prodigal_path: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Constructs a phylogenetic tree from a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + reduced_tree: Use a reduced tree for phylogenetic placement. + output_alignment_files: Output alignment files. + output_nucleotide_sequences: Output nucleotide sequences. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + pplacer_path: Path to pplacer executable. + hmmer_path: Path to HMMER executables. + prodigal_path: Path to Prodigal executable. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["tree", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if reduced_tree: + cmd.append("-r") + if output_alignment_files: + cmd.append("--ali") + if output_nucleotide_sequences: + cmd.append("--nt") + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + pplacer_path=pplacer_path, + hmmer_path=hmmer_path, + prodigal_path=prodigal_path, + ) + + +@mcp.tool() +def qa( + marker_gene_folder: Path, + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + skip_gtdb_r207: bool = False, + skip_gtdb_r207_cpr: bool = False, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Performs quality assessment on a set of genomes using marker genes. + + Args: + marker_gene_folder: Folder containing marker gene files (output from `checkm tree` or `checkm lineage_wf`). + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + skip_gtdb_r207: Skip GTDB R207 marker set. + skip_gtdb_r207_cpr: Skip GTDB R207 CPR marker set. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not marker_gene_folder.is_dir(): + raise ValueError(f"Marker gene folder '{marker_gene_folder}' does not exist or is not a directory.") + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["qa", str(marker_gene_folder), str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + if skip_gtdb_r207: + cmd.append("--skip_gtdb_r207") + if skip_gtdb_r207_cpr: + cmd.append("--skip_gtdb_r207_cpr") + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def plot( + checkm_output_folder: Path, + image_folder: Path, + output_file: Optional[Path] = None, + image_file: Optional[Path] = None, + image_type: str = 'png', + font_size: int = 12, + dpi: int = 300, + width: float = 10.0, + height: float = 8.0, + title: Optional[str] = None, + label: Optional[str] = None, + color: Optional[str] = None, + marker_size: int = 10, + line_width: int = 1, + force: bool = False, + quiet: bool = False, + debug: bool = False, +) -> Dict[str, Any]: + """ + Generates various plots for visualizing genome quality. + + Args: + checkm_output_folder: Folder containing CheckM output files (e.g., from `lineage_wf`). + image_folder: Folder to write image files to. + output_file: File to write summary output to. If not specified, output goes to stdout. + image_file: File to write the main image to. If not specified, 'checkm_plot.png' in image_folder. + image_type: Image type (e.g., 'png', 'pdf', 'svg'). + font_size: Font size for plots. + dpi: DPI for plots. + width: Width of plots in inches. + height: Height of plots in inches. + title: Title for plots. + label: Label for plots. + color: Color for plots (e.g., 'red', '#FF0000'). + marker_size: Marker size for plots. + line_width: Line width for plots. + force: Force overwrite of existing files. + quiet: Suppress stdout. + debug: Enable debug mode. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not checkm_output_folder.is_dir(): + raise ValueError(f"CheckM output folder '{checkm_output_folder}' does not exist or is not a directory.") + image_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["plot", str(checkm_output_folder), str(image_folder)] + + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + + _add_plotting_args( + cmd, + image_file=image_file, + image_type=image_type, + font_size=font_size, + dpi=dpi, + width=width, + height=height, + title=title, + label=label, + color=color, + marker_size=marker_size, + line_width=line_width, + ) + + return _run_checkm_command( + cmd, + output_dir=image_folder, + log_file=output_file, + force=force, + quiet=quiet, + debug=debug, + ) + + +@mcp.tool() +def ssu_finder( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Identifies SSU rRNA genes in genome files. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["ssu_finder", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def unique_markers( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Identifies unique marker genes for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["unique_markers", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def profile( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Profiles the distribution of marker genes across a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["profile", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def tetra( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Calculates tetranucleotide frequencies for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["tetra", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def dist( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Calculates genomic characteristics distributions for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["dist", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def coverage( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + tab_output_file: Optional[Path] = None, + quiet: bool = False, + debug: bool = False, + force: bool = False, + tmpdir: Optional[Path] = None, + threads: int = 1, +) -> Dict[str, Any]: + """ + Calculates coverage statistics for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + tab_output_file: File to write tab-separated output to. + quiet: Suppress stdout. + debug: Enable debug mode. + force: Force overwrite of existing files. + tmpdir: Temporary directory. + threads: Number of threads to use. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["coverage", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + if tab_output_file: + tab_output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["--tab_file", str(tab_output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + quiet=quiet, + debug=debug, + force=force, + tmpdir=tmpdir, + threads=threads, + ) + + +@mcp.tool() +def len_hist( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + image_file: Optional[Path] = None, + image_type: str = 'png', + font_size: int = 12, + dpi: int = 300, + width: float = 10.0, + height: float = 8.0, + title: Optional[str] = None, + label: Optional[str] = None, + color: Optional[str] = None, + force: bool = False, + quiet: bool = False, + debug: bool = False, +) -> Dict[str, Any]: + """ + Generates a length histogram for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + image_file: File to write the image to. If not specified, 'len_hist.png' in output_folder. + image_type: Image type (e.g., 'png', 'pdf', 'svg'). + font_size: Font size for plots. + dpi: DPI for plots. + width: Width of plots in inches. + height: Height of plots in inches. + title: Title for plots. + label: Label for plots. + color: Color for plots (e.g., 'red', '#FF0000'). + force: Force overwrite of existing files. + quiet: Suppress stdout. + debug: Enable debug mode. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["len_hist", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + + _add_plotting_args( + cmd, + image_file=image_file, + image_type=image_type, + font_size=font_size, + dpi=dpi, + width=width, + height=height, + title=title, + label=label, + color=color, + ) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + force=force, + quiet=quiet, + debug=debug, + ) + + +@mcp.tool() +def nx_plot( + genome_folder: Path, + output_folder: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + image_file: Optional[Path] = None, + image_type: str = 'png', + font_size: int = 12, + dpi: int = 300, + width: float = 10.0, + height: float = 8.0, + title: Optional[str] = None, + label: Optional[str] = None, + color: Optional[str] = None, + force: bool = False, + quiet: bool = False, + debug: bool = False, +) -> Dict[str, Any]: + """ + Generates an N50/L50 plot for a set of genomes. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_folder: Folder to write output to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + image_file: File to write the image to. If not specified, 'nx_plot.png' in output_folder. + image_type: Image type (e.g., 'png', 'pdf', 'svg'). + font_size: Font size for plots. + dpi: DPI for plots. + width: Width of plots in inches. + height: Height of plots in inches. + title: Title for plots. + label: Label for plots. + color: Color for plots (e.g., 'red', '#FF0000'). + force: Force overwrite of existing files. + quiet: Suppress stdout. + debug: Enable debug mode. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_folder.mkdir(parents=True, exist_ok=True) + + cmd = ["nx_plot", str(genome_folder), str(output_folder)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + + _add_plotting_args( + cmd, + image_file=image_file, + image_type=image_type, + font_size=font_size, + dpi=dpi, + width=width, + height=height, + title=title, + label=label, + color=color, + ) + + return _run_checkm_command( + cmd, + output_dir=output_folder, + log_file=output_file, + force=force, + quiet=quiet, + debug=debug, + ) + + +@mcp.tool() +def bin_set( + genome_folder: Path, + output_bin_set_file: Path, + extension: str = "fna", + output_file: Optional[Path] = None, + force: bool = False, + quiet: bool = False, + debug: bool = False, +) -> Dict[str, Any]: + """ + Creates a set of bins from a folder of genome files. + + Args: + genome_folder: Folder containing genome files (e.g., .fna, .fasta). + output_bin_set_file: File to write the bin set to. + extension: Extension for genome files (e.g., 'fna', 'fasta'). + output_file: File to write summary output to. If not specified, output goes to stdout. + force: Force overwrite of existing files. + quiet: Suppress stdout. + debug: Enable debug mode. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if not genome_folder.is_dir(): + raise ValueError(f"Genome folder '{genome_folder}' does not exist or is not a directory.") + output_bin_set_file.parent.mkdir(parents=True, exist_ok=True) + + cmd = ["bin_set", str(genome_folder), str(output_bin_set_file)] + + if extension: + cmd.extend(["-x", extension]) + if output_file: + output_file.parent.mkdir(parents=True, exist_ok=True) + cmd.extend(["-f", str(output_file)]) + + return _run_checkm_command( + cmd, + output_dir=output_bin_set_file.parent, + log_file=output_file, + force=force, + quiet=quiet, + debug=debug, + ) \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e8dd21055a5fdcba779e74fd7f64b0ea3627585f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/checkm-genome_server.py') +SERVER_NAME = 'biosci_checkm_genome' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..827bc8b98e8dbac49cb5cdf3b5fd1c80af23be1d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-checkm-genome: + build: . + image: mcp-checkm-genome:latest + container_name: mcp-checkm-genome + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=checkm-genome + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..db3586dbcccb4a04ca221852c6bcb0650b5b783a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - checkm-genome + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_checkm-genome/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9bb972086de47f81e888399bf3714c07381fcacb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install crispresso2 via conda (e.g., from bioconda) +RUN conda install -c bioconda crispresso2 -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/crispresso2_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/crispresso2_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/crispresso2_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/app/crispresso2_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/app/crispresso2_server.py new file mode 100644 index 0000000000000000000000000000000000000000..181154e6976b01f32805a1fadf394aa56c70284b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/app/crispresso2_server.py @@ -0,0 +1,1008 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any, Literal +import tempfile + +# Define common adapter trimming options based on documentation +ADAPTER_TRIMMING_OPTIONS = Literal[ + "No Trimming", + "Nextera PE", + "TruSeq3 PE", + "TruSeq3 SE", + "TruSeq2 PE", + "TruSeq2 SE", +] + +# Define common nuclease types +NUCLEASE_TYPES = Literal[ + "Cas9", + "Cpf1", + "Base Editor", + "Other" +] + +def _run_command(cmd: List[str], output_dir: Path) -> Dict[str, Any]: + """ + Helper function to execute a shell command and capture its output. + """ + output_dir.mkdir(parents=True, exist_ok=True) + try: + process = subprocess.run( + cmd, + cwd=output_dir, + capture_output=True, + text=True, + check=True + ) + stdout = process.stdout + stderr = process.stderr + # In a real scenario, you'd parse the output_dir for generated files. + # For this exercise, we'll just list the directory contents. + output_files = [str(f.relative_to(output_dir)) for f in output_dir.rglob("*") if f.is_file()] + return { + "command_executed": " ".join(cmd), + "stdout": stdout, + "stderr": stderr, + "output_files": output_files + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"Command failed with exit code {e.returncode}: {e}", + "returncode": e.returncode, + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": " ".join(cmd), + "stdout": "", + "stderr": f"Error: The executable '{cmd[0]}' not found. Please ensure CRISPResso2 is installed and in your PATH.", + "error": f"Executable '{cmd[0]}' not found", + "returncode": 127, + "output_files": [] + } + +@mcp.tool() +def crispresso( + fastq_r1: Path, + amplicon_fasta: Path, + guide_rna_sequence: str, + output_directory: Path, + fastq_r2: Optional[Path] = None, + hdr_sequence_fasta: Optional[Path] = None, + exon_sequence_fasta: Optional[Path] = None, + nuclease_name: NUCLEASE_TYPES = "Cas9", + name: Optional[str] = None, + min_quality_score: int = 20, + adapter_trimming_mode: ADAPTER_TRIMMING_OPTIONS = "No Trimming", + min_read_length: int = 20, + max_read_length: int = 250, + min_alignment_score: float = 60.0, + min_frequency_threshold: float = 0.001, + exclude_bp_from_guide: int = 3, + exclude_bp_from_amplicon_start: int = 5, + exclude_bp_from_amplicon_end: int = 5, + min_allele_frequency_for_report: float = 0.001, + min_reads_aligned: int = 100, + plot_window_size: int = 20, + quantification_window_size: int = 10, + base_editor_output: bool = False, + split_by_allele: bool = False, + keep_intermediate_files: bool = False, + verbose: bool = False, + debug: bool = False, + n_processes: int = 1, + overwrite: bool = False, + log_file: Optional[Path] = None, + save_also_as_pdf: bool = False, + save_also_as_png: bool = False, + plot_on_target_only: bool = False, + plot_indel_size_hist: bool = False, + plot_indel_position_hist: bool = False, + plot_nucleotide_percentage: bool = False, + plot_insertion_deletion_map: bool = False, + plot_base_editor_map: bool = False, + plot_allele_frequency_heatmap: bool = False, + plot_allele_frequency_bar_plot: bool = False, + plot_allele_frequency_pie_chart: bool = False, + plot_allele_frequency_table: bool = False, + plot_allele_frequency_text: bool = False, + plot_allele_frequency_csv: bool = False, + plot_allele_frequency_json: bool = False, + plot_allele_frequency_html: bool = False, + plot_allele_frequency_excel: bool = False, + plot_allele_frequency_tsv: bool = False, + plot_allele_frequency_fasta: bool = False, + plot_allele_frequency_vcf: bool = False, + plot_allele_frequency_bed: bool = False, + plot_allele_frequency_gff: bool = False, + plot_allele_frequency_wig: bool = False, + plot_allele_frequency_bigwig: bool = False, + plot_allele_frequency_bam: bool = False, + plot_allele_frequency_sam: bool = False, + plot_allele_frequency_fastq: bool = False, + plot_allele_frequency_pileup: bool = False, + plot_allele_frequency_custom: Optional[str] = None, +) -> Dict[str, Any]: + """ + Analyzes and interprets single experimental conditions on a single amplicon. + + This tool aligns sequencing reads to a reference sequence, quantifies insertions, + mutations, and deletions to determine whether a read is modified or unmodified + by genome editing, and summarizes editing results in intuitive plots and datasets. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not fastq_r1.is_file(): + raise FileNotFoundError(f"Input FASTQ R1 file not found: {fastq_r1}") + if fastq_r2 and not fastq_r2.is_file(): + raise FileNotFoundError(f"Input FASTQ R2 file not found: {fastq_r2}") + if not amplicon_fasta.is_file(): + raise FileNotFoundError(f"Amplicon FASTA file not found: {amplicon_fasta}") + if hdr_sequence_fasta and not hdr_sequence_fasta.is_file(): + raise FileNotFoundError(f"HDR sequence FASTA file not found: {hdr_sequence_fasta}") + if exon_sequence_fasta and not exon_sequence_fasta.is_file(): + raise FileNotFoundError(f"Exon sequence FASTA file not found: {exon_sequence_fasta}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPResso", # Assuming 'CRISPResso' is the executable name for this subcommand + "-r1", str(fastq_r1), + "-a", str(amplicon_fasta), + "-g", guide_rna_sequence, + "-o", str(output_directory), + ] + + if fastq_r2: + cmd.extend(["-r2", str(fastq_r2)]) + if hdr_sequence_fasta: + cmd.extend(["--hdr_seq", str(hdr_sequence_fasta)]) + if exon_sequence_fasta: + cmd.extend(["--exon_seq", str(exon_sequence_fasta)]) + if nuclease_name != "Cas9": + cmd.extend(["--nuclease_name", nuclease_name]) + if name: + cmd.extend(["--name", name]) + if min_quality_score != 20: + cmd.extend(["--min_qual_score", str(min_quality_score)]) + if adapter_trimming_mode != "No Trimming": + cmd.extend(["--trim_adapters", adapter_trimming_mode]) + if min_read_length != 20: + cmd.extend(["--min_read_length", str(min_read_length)]) + if max_read_length != 250: + cmd.extend(["--max_read_length", str(max_read_length)]) + if min_alignment_score != 60.0: + cmd.extend(["--min_alignment_score", str(min_alignment_score)]) + if min_frequency_threshold != 0.001: + cmd.extend(["--min_freq_threshold", str(min_frequency_threshold)]) + if exclude_bp_from_guide != 3: + cmd.extend(["--exclude_bp_from_guide", str(exclude_bp_from_guide)]) + if exclude_bp_from_amplicon_start != 5: + cmd.extend(["--exclude_bp_from_amplicon_start", str(exclude_bp_from_amplicon_start)]) + if exclude_bp_from_amplicon_end != 5: + cmd.extend(["--exclude_bp_from_amplicon_end", str(exclude_bp_from_amplicon_end)]) + if min_allele_frequency_for_report != 0.001: + cmd.extend(["--min_allele_freq_for_report", str(min_allele_frequency_for_report)]) + if min_reads_aligned != 100: + cmd.extend(["--min_reads_aligned", str(min_reads_aligned)]) + if plot_window_size != 20: + cmd.extend(["--plot_window_size", str(plot_window_size)]) + if quantification_window_size != 10: + cmd.extend(["--quantification_window_size", str(quantification_window_size)]) + if base_editor_output: + cmd.append("--base_editor_output") + if split_by_allele: + cmd.append("--split_by_allele") + if keep_intermediate_files: + cmd.append("--keep_intermediate_files") + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if n_processes != 1: + cmd.extend(["--n_processes", str(n_processes)]) + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if save_also_as_pdf: + cmd.append("--save_also_as_pdf") + if save_also_as_png: + cmd.append("--save_also_as_png") + if plot_on_target_only: + cmd.append("--plot_on_target_only") + if plot_indel_size_hist: + cmd.append("--plot_indel_size_hist") + if plot_indel_position_hist: + cmd.append("--plot_indel_position_hist") + if plot_nucleotide_percentage: + cmd.append("--plot_nucleotide_percentage") + if plot_insertion_deletion_map: + cmd.append("--plot_insertion_deletion_map") + if plot_base_editor_map: + cmd.append("--plot_base_editor_map") + if plot_allele_frequency_heatmap: + cmd.append("--plot_allele_frequency_heatmap") + if plot_allele_frequency_bar_plot: + cmd.append("--plot_allele_frequency_bar_plot") + if plot_allele_frequency_pie_chart: + cmd.append("--plot_allele_frequency_pie_chart") + if plot_allele_frequency_table: + cmd.append("--plot_allele_frequency_table") + if plot_allele_frequency_text: + cmd.append("--plot_allele_frequency_text") + if plot_allele_frequency_csv: + cmd.append("--plot_allele_frequency_csv") + if plot_allele_frequency_json: + cmd.append("--plot_allele_frequency_json") + if plot_allele_frequency_html: + cmd.append("--plot_allele_frequency_html") + if plot_allele_frequency_excel: + cmd.append("--plot_allele_frequency_excel") + if plot_allele_frequency_tsv: + cmd.append("--plot_allele_frequency_tsv") + if plot_allele_frequency_fasta: + cmd.append("--plot_allele_frequency_fasta") + if plot_allele_frequency_vcf: + cmd.append("--plot_allele_frequency_vcf") + if plot_allele_frequency_bed: + cmd.append("--plot_allele_frequency_bed") + if plot_allele_frequency_gff: + cmd.append("--plot_allele_frequency_gff") + if plot_allele_frequency_wig: + cmd.append("--plot_allele_frequency_wig") + if plot_allele_frequency_bigwig: + cmd.append("--plot_allele_frequency_bigwig") + if plot_allele_frequency_bam: + cmd.append("--plot_allele_frequency_bam") + if plot_allele_frequency_sam: + cmd.append("--plot_allele_frequency_sam") + if plot_allele_frequency_fastq: + cmd.append("--plot_allele_frequency_fastq") + if plot_allele_frequency_pileup: + cmd.append("--plot_allele_frequency_pileup") + if plot_allele_frequency_custom: + cmd.extend(["--plot_allele_frequency_custom", plot_allele_frequency_custom]) + + return _run_command(cmd, output_directory) + +@mcp.tool() +def crispresso_batch( + samples_manifest: Path, + output_directory: Path, + amplicon_fasta: Optional[Path] = None, + guide_rna_sequence: Optional[str] = None, + hdr_sequence_fasta: Optional[Path] = None, + exon_sequence_fasta: Optional[Path] = None, + nuclease_name: NUCLEASE_TYPES = "Cas9", + batch_name: Optional[str] = None, + min_quality_score: int = 20, + adapter_trimming_mode: ADAPTER_TRIMMING_OPTIONS = "No Trimming", + min_read_length: int = 20, + max_read_length: int = 250, + min_alignment_score: float = 60.0, + min_frequency_threshold: float = 0.001, + exclude_bp_from_guide: int = 3, + exclude_bp_from_amplicon_start: int = 5, + exclude_bp_from_amplicon_end: int = 5, + min_allele_frequency_for_report: float = 0.001, + min_reads_aligned: int = 100, + plot_window_size: int = 20, + quantification_window_size: int = 10, + base_editor_output: bool = False, + split_by_allele: bool = False, + keep_intermediate_files: bool = False, + verbose: bool = False, + debug: bool = False, + n_processes: int = 1, + overwrite: bool = False, + log_file: Optional[Path] = None, + # Batch-specific options (inferred) + # Assuming plotting options are similar to crispresso and can be controlled globally + save_also_as_pdf: bool = False, + save_also_as_png: bool = False, + plot_on_target_only: bool = False, + plot_indel_size_hist: bool = False, + plot_indel_position_hist: bool = False, + plot_nucleotide_percentage: bool = False, + plot_insertion_deletion_map: bool = False, + plot_base_editor_map: bool = False, + plot_allele_frequency_heatmap: bool = False, + plot_allele_frequency_bar_plot: bool = False, + plot_allele_frequency_pie_chart: bool = False, + plot_allele_frequency_table: bool = False, + plot_allele_frequency_text: bool = False, + plot_allele_frequency_csv: bool = False, + plot_allele_frequency_json: bool = False, + plot_allele_frequency_html: bool = False, + plot_allele_frequency_excel: bool = False, + plot_allele_frequency_tsv: bool = False, + plot_allele_frequency_fasta: bool = False, + plot_allele_frequency_vcf: bool = False, + plot_allele_frequency_bed: bool = False, + plot_allele_frequency_gff: bool = False, + plot_allele_frequency_wig: bool = False, + plot_allele_frequency_bigwig: bool = False, + plot_allele_frequency_bam: bool = False, + plot_allele_frequency_sam: bool = False, + plot_allele_frequency_fastq: bool = False, + plot_allele_frequency_pileup: bool = False, + plot_allele_frequency_custom: Optional[str] = None, +) -> Dict[str, Any]: + """ + Analyzes and compares multiple experimental conditions at the same site. + + This tool takes a manifest file describing multiple samples and runs CRISPResso + analysis for each, then provides comparative summaries. Global parameters can + be overridden by sample-specific settings in the manifest. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not samples_manifest.is_file(): + raise FileNotFoundError(f"Samples manifest file not found: {samples_manifest}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPRessoBatch", # Assuming 'CRISPRessoBatch' is the executable name + "-i", str(samples_manifest), + "-o", str(output_directory), + ] + + if amplicon_fasta: + cmd.extend(["-a", str(amplicon_fasta)]) + if guide_rna_sequence: + cmd.extend(["-g", guide_rna_sequence]) + if hdr_sequence_fasta: + cmd.extend(["--hdr_seq", str(hdr_sequence_fasta)]) + if exon_sequence_fasta: + cmd.extend(["--exon_seq", str(exon_sequence_fasta)]) + if nuclease_name != "Cas9": + cmd.extend(["--nuclease_name", nuclease_name]) + if batch_name: + cmd.extend(["--name", batch_name]) + if min_quality_score != 20: + cmd.extend(["--min_qual_score", str(min_quality_score)]) + if adapter_trimming_mode != "No Trimming": + cmd.extend(["--trim_adapters", adapter_trimming_mode]) + if min_read_length != 20: + cmd.extend(["--min_read_length", str(min_read_length)]) + if max_read_length != 250: + cmd.extend(["--max_read_length", str(max_read_length)]) + if min_alignment_score != 60.0: + cmd.extend(["--min_alignment_score", str(min_alignment_score)]) + if min_frequency_threshold != 0.001: + cmd.extend(["--min_freq_threshold", str(min_frequency_threshold)]) + if exclude_bp_from_guide != 3: + cmd.extend(["--exclude_bp_from_guide", str(exclude_bp_from_guide)]) + if exclude_bp_from_amplicon_start != 5: + cmd.extend(["--exclude_bp_from_amplicon_start", str(exclude_bp_from_amplicon_start)]) + if exclude_bp_from_amplicon_end != 5: + cmd.extend(["--exclude_bp_from_amplicon_end", str(exclude_bp_from_amplicon_end)]) + if min_allele_frequency_for_report != 0.001: + cmd.extend(["--min_allele_freq_for_report", str(min_allele_frequency_for_report)]) + if min_reads_aligned != 100: + cmd.extend(["--min_reads_aligned", str(min_reads_aligned)]) + if plot_window_size != 20: + cmd.extend(["--plot_window_size", str(plot_window_size)]) + if quantification_window_size != 10: + cmd.extend(["--quantification_window_size", str(quantification_window_size)]) + if base_editor_output: + cmd.append("--base_editor_output") + if split_by_allele: + cmd.append("--split_by_allele") + if keep_intermediate_files: + cmd.append("--keep_intermediate_files") + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if n_processes != 1: + cmd.extend(["--n_processes", str(n_processes)]) + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if save_also_as_pdf: + cmd.append("--save_also_as_pdf") + if save_also_as_png: + cmd.append("--save_also_as_png") + if plot_on_target_only: + cmd.append("--plot_on_target_only") + if plot_indel_size_hist: + cmd.append("--plot_indel_size_hist") + if plot_indel_position_hist: + cmd.append("--plot_indel_position_hist") + if plot_nucleotide_percentage: + cmd.append("--plot_nucleotide_percentage") + if plot_insertion_deletion_map: + cmd.append("--plot_insertion_deletion_map") + if plot_base_editor_map: + cmd.append("--plot_base_editor_map") + if plot_allele_frequency_heatmap: + cmd.append("--plot_allele_frequency_heatmap") + if plot_allele_frequency_bar_plot: + cmd.append("--plot_allele_frequency_bar_plot") + if plot_allele_frequency_pie_chart: + cmd.append("--plot_allele_frequency_pie_chart") + if plot_allele_frequency_table: + cmd.append("--plot_allele_frequency_table") + if plot_allele_frequency_text: + cmd.append("--plot_allele_frequency_text") + if plot_allele_frequency_csv: + cmd.append("--plot_allele_frequency_csv") + if plot_allele_frequency_json: + cmd.append("--plot_allele_frequency_json") + if plot_allele_frequency_html: + cmd.append("--plot_allele_frequency_html") + if plot_allele_frequency_excel: + cmd.append("--plot_allele_frequency_excel") + if plot_allele_frequency_tsv: + cmd.append("--plot_allele_frequency_tsv") + if plot_allele_frequency_fasta: + cmd.append("--plot_allele_frequency_fasta") + if plot_allele_frequency_vcf: + cmd.append("--plot_allele_frequency_vcf") + if plot_allele_frequency_bed: + cmd.append("--plot_allele_frequency_bed") + if plot_allele_frequency_gff: + cmd.append("--plot_allele_frequency_gff") + if plot_allele_frequency_wig: + cmd.append("--plot_allele_frequency_wig") + if plot_allele_frequency_bigwig: + cmd.append("--plot_allele_frequency_bigwig") + if plot_allele_frequency_bam: + cmd.append("--plot_allele_frequency_bam") + if plot_allele_frequency_sam: + cmd.append("--plot_allele_frequency_sam") + if plot_allele_frequency_fastq: + cmd.append("--plot_allele_frequency_fastq") + if plot_allele_frequency_pileup: + cmd.append("--plot_allele_frequency_pileup") + if plot_allele_frequency_custom: + cmd.extend(["--plot_allele_frequency_custom", plot_allele_frequency_custom]) + + return _run_command(cmd, output_directory) + +@mcp.tool() +def crispresso_pooled( + fastq_r1: Path, + amplicons_fasta: Path, + guide_rnas_file: Path, + output_directory: Path, + fastq_r2: Optional[Path] = None, + hdr_sequence_fasta: Optional[Path] = None, + exon_sequence_fasta: Optional[Path] = None, + nuclease_name: NUCLEASE_TYPES = "Cas9", + name: Optional[str] = None, + min_quality_score: int = 20, + adapter_trimming_mode: ADAPTER_TRIMMING_OPTIONS = "No Trimming", + min_read_length: int = 20, + max_read_length: int = 250, + min_alignment_score: float = 60.0, + min_frequency_threshold: float = 0.001, + exclude_bp_from_guide: int = 3, + exclude_bp_from_amplicon_start: int = 5, + exclude_bp_from_amplicon_end: int = 5, + min_allele_frequency_for_report: float = 0.001, + min_reads_aligned: int = 100, + plot_window_size: int = 20, + quantification_window_size: int = 10, + base_editor_output: bool = False, + split_by_allele: bool = False, + keep_intermediate_files: bool = False, + verbose: bool = False, + debug: bool = False, + n_processes: int = 1, + overwrite: bool = False, + log_file: Optional[Path] = None, + min_amplicon_reads: int = 100, + # Assuming plotting options are similar to crispresso and can be controlled globally + save_also_as_pdf: bool = False, + save_also_as_png: bool = False, + plot_on_target_only: bool = False, + plot_indel_size_hist: bool = False, + plot_indel_position_hist: bool = False, + plot_nucleotide_percentage: bool = False, + plot_insertion_deletion_map: bool = False, + plot_base_editor_map: bool = False, + plot_allele_frequency_heatmap: bool = False, + plot_allele_frequency_bar_plot: bool = False, + plot_allele_frequency_pie_chart: bool = False, + plot_allele_frequency_table: bool = False, + plot_allele_frequency_text: bool = False, + plot_allele_frequency_csv: bool = False, + plot_allele_frequency_json: bool = False, + plot_allele_frequency_html: bool = False, + plot_allele_frequency_excel: bool = False, + plot_allele_frequency_tsv: bool = False, + plot_allele_frequency_fasta: bool = False, + plot_allele_frequency_vcf: bool = False, + plot_allele_frequency_bed: bool = False, + plot_allele_frequency_gff: bool = False, + plot_allele_frequency_wig: bool = False, + plot_allele_frequency_bigwig: bool = False, + plot_allele_frequency_bam: bool = False, + plot_allele_frequency_sam: bool = False, + plot_allele_frequency_fastq: bool = False, + plot_allele_frequency_pileup: bool = False, + plot_allele_frequency_custom: Optional[str] = None, +) -> Dict[str, Any]: + """ + Analyzes multiple amplicons from a pooled amplicon sequencing experiment. + + This tool processes sequencing data from experiments where multiple amplicons + are sequenced in a single pool, identifying and quantifying editing events + for each amplicon. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not fastq_r1.is_file(): + raise FileNotFoundError(f"Input FASTQ R1 file not found: {fastq_r1}") + if fastq_r2 and not fastq_r2.is_file(): + raise FileNotFoundError(f"Input FASTQ R2 file not found: {fastq_r2}") + if not amplicons_fasta.is_file(): + raise FileNotFoundError(f"Amplicons FASTA file not found: {amplicons_fasta}") + if not guide_rnas_file.is_file(): + raise FileNotFoundError(f"Guide RNAs file not found: {guide_rnas_file}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPRessoPooled", # Assuming 'CRISPRessoPooled' is the executable name + "-r1", str(fastq_r1), + "-a", str(amplicons_fasta), + "-g", str(guide_rnas_file), # Assuming -g is used for the guide RNAs file in pooled mode + "-o", str(output_directory), + ] + + if fastq_r2: + cmd.extend(["-r2", str(fastq_r2)]) + if hdr_sequence_fasta: + cmd.extend(["--hdr_seq", str(hdr_sequence_fasta)]) + if exon_sequence_fasta: + cmd.extend(["--exon_seq", str(exon_sequence_fasta)]) + if nuclease_name != "Cas9": + cmd.extend(["--nuclease_name", nuclease_name]) + if name: + cmd.extend(["--name", name]) + if min_quality_score != 20: + cmd.extend(["--min_qual_score", str(min_quality_score)]) + if adapter_trimming_mode != "No Trimming": + cmd.extend(["--trim_adapters", adapter_trimming_mode]) + if min_read_length != 20: + cmd.extend(["--min_read_length", str(min_read_length)]) + if max_read_length != 250: + cmd.extend(["--max_read_length", str(max_read_length)]) + if min_alignment_score != 60.0: + cmd.extend(["--min_alignment_score", str(min_alignment_score)]) + if min_frequency_threshold != 0.001: + cmd.extend(["--min_freq_threshold", str(min_frequency_threshold)]) + if exclude_bp_from_guide != 3: + cmd.extend(["--exclude_bp_from_guide", str(exclude_bp_from_guide)]) + if exclude_bp_from_amplicon_start != 5: + cmd.extend(["--exclude_bp_from_amplicon_start", str(exclude_bp_from_amplicon_start)]) + if exclude_bp_from_amplicon_end != 5: + cmd.extend(["--exclude_bp_from_amplicon_end", str(exclude_bp_from_amplicon_end)]) + if min_allele_frequency_for_report != 0.001: + cmd.extend(["--min_allele_freq_for_report", str(min_allele_frequency_for_report)]) + if min_reads_aligned != 100: + cmd.extend(["--min_reads_aligned", str(min_reads_aligned)]) + if plot_window_size != 20: + cmd.extend(["--plot_window_size", str(plot_window_size)]) + if quantification_window_size != 10: + cmd.extend(["--quantification_window_size", str(quantification_window_size)]) + if base_editor_output: + cmd.append("--base_editor_output") + if split_by_allele: + cmd.append("--split_by_allele") + if keep_intermediate_files: + cmd.append("--keep_intermediate_files") + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if n_processes != 1: + cmd.extend(["--n_processes", str(n_processes)]) + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if min_amplicon_reads != 100: + cmd.extend(["--min_amplicon_reads", str(min_amplicon_reads)]) + if save_also_as_pdf: + cmd.append("--save_also_as_pdf") + if save_also_as_png: + cmd.append("--save_also_as_png") + if plot_on_target_only: + cmd.append("--plot_on_target_only") + if plot_indel_size_hist: + cmd.append("--plot_indel_size_hist") + if plot_indel_position_hist: + cmd.append("--plot_indel_position_hist") + if plot_nucleotide_percentage: + cmd.append("--plot_nucleotide_percentage") + if plot_insertion_deletion_map: + cmd.append("--plot_insertion_deletion_map") + if plot_base_editor_map: + cmd.append("--plot_base_editor_map") + if plot_allele_frequency_heatmap: + cmd.append("--plot_allele_frequency_heatmap") + if plot_allele_frequency_bar_plot: + cmd.append("--plot_allele_frequency_bar_plot") + if plot_allele_frequency_pie_chart: + cmd.append("--plot_allele_frequency_pie_chart") + if plot_allele_frequency_table: + cmd.append("--plot_allele_frequency_table") + if plot_allele_frequency_text: + cmd.append("--plot_allele_frequency_text") + if plot_allele_frequency_csv: + cmd.append("--plot_allele_frequency_csv") + if plot_allele_frequency_json: + cmd.append("--plot_allele_frequency_json") + if plot_allele_frequency_html: + cmd.append("--plot_allele_frequency_html") + if plot_allele_frequency_excel: + cmd.append("--plot_allele_frequency_excel") + if plot_allele_frequency_tsv: + cmd.append("--plot_allele_frequency_tsv") + if plot_allele_frequency_fasta: + cmd.append("--plot_allele_frequency_fasta") + if plot_allele_frequency_vcf: + cmd.append("--plot_allele_frequency_vcf") + if plot_allele_frequency_bed: + cmd.append("--plot_allele_frequency_bed") + if plot_allele_frequency_gff: + cmd.append("--plot_allele_frequency_gff") + if plot_allele_frequency_wig: + cmd.append("--plot_allele_frequency_wig") + if plot_allele_frequency_bigwig: + cmd.append("--plot_allele_frequency_bigwig") + if plot_allele_frequency_bam: + cmd.append("--plot_allele_frequency_bam") + if plot_allele_frequency_sam: + cmd.append("--plot_allele_frequency_sam") + if plot_allele_frequency_fastq: + cmd.append("--plot_allele_frequency_fastq") + if plot_allele_frequency_pileup: + cmd.append("--plot_allele_frequency_pileup") + if plot_allele_frequency_custom: + cmd.extend(["--plot_allele_frequency_custom", plot_allele_frequency_custom]) + + return _run_command(cmd, output_directory) + +@mcp.tool() +def crispresso_wgs( + fastq_r1: Path, + genome_fasta: Path, + target_sites_bed: Path, + output_directory: Path, + fastq_r2: Optional[Path] = None, + nuclease_name: NUCLEASE_TYPES = "Cas9", + name: Optional[str] = None, + min_quality_score: int = 20, + adapter_trimming_mode: ADAPTER_TRIMMING_OPTIONS = "No Trimming", + min_read_length: int = 20, + max_read_length: int = 250, + min_alignment_score: float = 60.0, + min_frequency_threshold: float = 0.001, + exclude_bp_from_guide: int = 3, + exclude_bp_from_amplicon_start: int = 5, + exclude_bp_from_amplicon_end: int = 5, + min_allele_frequency_for_report: float = 0.001, + min_reads_aligned: int = 100, + plot_window_size: int = 20, + quantification_window_size: int = 10, + base_editor_output: bool = False, + keep_intermediate_files: bool = False, + verbose: bool = False, + debug: bool = False, + n_processes: int = 1, + overwrite: bool = False, + log_file: Optional[Path] = None, + mapping_quality_threshold: int = 30, + # Assuming plotting options are similar to crispresso and can be controlled globally + save_also_as_pdf: bool = False, + save_also_as_png: bool = False, + plot_on_target_only: bool = False, + plot_indel_size_hist: bool = False, + plot_indel_position_hist: bool = False, + plot_nucleotide_percentage: bool = False, + plot_insertion_deletion_map: bool = False, + plot_base_editor_map: bool = False, + plot_allele_frequency_heatmap: bool = False, + plot_allele_frequency_bar_plot: bool = False, + plot_allele_frequency_pie_chart: bool = False, + plot_allele_frequency_table: bool = False, + plot_allele_frequency_text: bool = False, + plot_allele_frequency_csv: bool = False, + plot_allele_frequency_json: bool = False, + plot_allele_frequency_html: bool = False, + plot_allele_frequency_excel: bool = False, + plot_allele_frequency_tsv: bool = False, + plot_allele_frequency_fasta: bool = False, + plot_allele_frequency_vcf: bool = False, + plot_allele_frequency_bed: bool = False, + plot_allele_frequency_gff: bool = False, + plot_allele_frequency_wig: bool = False, + plot_allele_frequency_bigwig: bool = False, + plot_allele_frequency_bam: bool = False, + plot_allele_frequency_sam: bool = False, + plot_allele_frequency_fastq: bool = False, + plot_allele_frequency_pileup: bool = False, + plot_allele_frequency_custom: Optional[str] = None, +) -> Dict[str, Any]: + """ + Analyzes specific sites in whole-genome sequencing samples. + + This tool processes whole-genome sequencing data to identify and quantify + genome editing events at predefined target sites. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not fastq_r1.is_file(): + raise FileNotFoundError(f"Input FASTQ R1 file not found: {fastq_r1}") + if fastq_r2 and not fastq_r2.is_file(): + raise FileNotFoundError(f"Input FASTQ R2 file not found: {fastq_r2}") + if not genome_fasta.is_file(): + raise FileNotFoundError(f"Genome FASTA file not found: {genome_fasta}") + if not target_sites_bed.is_file(): + raise FileNotFoundError(f"Target sites BED file not found: {target_sites_bed}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPRessoWGS", # Assuming 'CRISPRessoWGS' is the executable name + "-r1", str(fastq_r1), + "-g", str(genome_fasta), # Assuming -g is used for genome FASTA in WGS mode + "-t", str(target_sites_bed), # Assuming -t is used for target sites BED file + "-o", str(output_directory), + ] + + if fastq_r2: + cmd.extend(["-r2", str(fastq_r2)]) + if nuclease_name != "Cas9": + cmd.extend(["--nuclease_name", nuclease_name]) + if name: + cmd.extend(["--name", name]) + if min_quality_score != 20: + cmd.extend(["--min_qual_score", str(min_quality_score)]) + if adapter_trimming_mode != "No Trimming": + cmd.extend(["--trim_adapters", adapter_trimming_mode]) + if min_read_length != 20: + cmd.extend(["--min_read_length", str(min_read_length)]) + if max_read_length != 250: + cmd.extend(["--max_read_length", str(max_read_length)]) + if min_alignment_score != 60.0: + cmd.extend(["--min_alignment_score", str(min_alignment_score)]) + if min_frequency_threshold != 0.001: + cmd.extend(["--min_freq_threshold", str(min_frequency_threshold)]) + if exclude_bp_from_guide != 3: + cmd.extend(["--exclude_bp_from_guide", str(exclude_bp_from_guide)]) + if exclude_bp_from_amplicon_start != 5: + cmd.extend(["--exclude_bp_from_amplicon_start", str(exclude_bp_from_amplicon_start)]) + if exclude_bp_from_amplicon_end != 5: + cmd.extend(["--exclude_bp_from_amplicon_end", str(exclude_bp_from_amplicon_end)]) + if min_allele_frequency_for_report != 0.001: + cmd.extend(["--min_allele_freq_for_report", str(min_allele_frequency_for_report)]) + if min_reads_aligned != 100: + cmd.extend(["--min_reads_aligned", str(min_reads_aligned)]) + if plot_window_size != 20: + cmd.extend(["--plot_window_size", str(plot_window_size)]) + if quantification_window_size != 10: + cmd.extend(["--quantification_window_size", str(quantification_window_size)]) + if base_editor_output: + cmd.append("--base_editor_output") + if keep_intermediate_files: + cmd.append("--keep_intermediate_files") + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if n_processes != 1: + cmd.extend(["--n_processes", str(n_processes)]) + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if mapping_quality_threshold != 30: + cmd.extend(["--min_map_qual", str(mapping_quality_threshold)]) + if save_also_as_pdf: + cmd.append("--save_also_as_pdf") + if save_also_as_png: + cmd.append("--save_also_as_png") + if plot_on_target_only: + cmd.append("--plot_on_target_only") + if plot_indel_size_hist: + cmd.append("--plot_indel_size_hist") + if plot_indel_position_hist: + cmd.append("--plot_indel_position_hist") + if plot_nucleotide_percentage: + cmd.append("--plot_nucleotide_percentage") + if plot_insertion_deletion_map: + cmd.append("--plot_insertion_deletion_map") + if plot_base_editor_map: + cmd.append("--plot_base_editor_map") + if plot_allele_frequency_heatmap: + cmd.append("--plot_allele_frequency_heatmap") + if plot_allele_frequency_bar_plot: + cmd.append("--plot_allele_frequency_bar_plot") + if plot_allele_frequency_pie_chart: + cmd.append("--plot_allele_frequency_pie_chart") + if plot_allele_frequency_table: + cmd.append("--plot_allele_frequency_table") + if plot_allele_frequency_text: + cmd.append("--plot_allele_frequency_text") + if plot_allele_frequency_csv: + cmd.append("--plot_allele_frequency_csv") + if plot_allele_frequency_json: + cmd.append("--plot_allele_frequency_json") + if plot_allele_frequency_html: + cmd.append("--plot_allele_frequency_html") + if plot_allele_frequency_excel: + cmd.append("--plot_allele_frequency_excel") + if plot_allele_frequency_tsv: + cmd.append("--plot_allele_frequency_tsv") + if plot_allele_frequency_fasta: + cmd.append("--plot_allele_frequency_fasta") + if plot_allele_frequency_vcf: + cmd.append("--plot_allele_frequency_vcf") + if plot_allele_frequency_bed: + cmd.append("--plot_allele_frequency_bed") + if plot_allele_frequency_gff: + cmd.append("--plot_allele_frequency_gff") + if plot_allele_frequency_wig: + cmd.append("--plot_allele_frequency_wig") + if plot_allele_frequency_bigwig: + cmd.append("--plot_allele_frequency_bigwig") + if plot_allele_frequency_bam: + cmd.append("--plot_allele_frequency_bam") + if plot_allele_frequency_sam: + cmd.append("--plot_allele_frequency_sam") + if plot_allele_frequency_fastq: + cmd.append("--plot_allele_frequency_fastq") + if plot_allele_frequency_pileup: + cmd.append("--plot_allele_frequency_pileup") + if plot_allele_frequency_custom: + cmd.extend(["--plot_allele_frequency_custom", plot_allele_frequency_custom]) + + return _run_command(cmd, output_directory) + +@mcp.tool() +def crispresso_compare( + sample1_crispresso_output_dir: Path, + sample2_crispresso_output_dir: Path, + output_directory: Path, + sample1_name: str = "Sample1", + sample2_name: str = "Sample2", + name: Optional[str] = None, + verbose: bool = False, + debug: bool = False, + overwrite: bool = False, + log_file: Optional[Path] = None, + plot_comparison_heatmap: bool = True, + plot_comparison_bar_chart: bool = True, + # Additional comparison-specific plotting options (inferred) + plot_difference_map: bool = False, + plot_indel_distribution_comparison: bool = False, +) -> Dict[str, Any]: + """ + Compares editing between two samples (e.g., treated vs control). + + This tool takes the output directories of two previous CRISPResso runs and + generates comparative analyses and visualizations. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not sample1_crispresso_output_dir.is_dir(): + raise FileNotFoundError(f"Sample 1 CRISPResso output directory not found: {sample1_crispresso_output_dir}") + if not sample2_crispresso_output_dir.is_dir(): + raise FileNotFoundError(f"Sample 2 CRISPResso output directory not found: {sample2_crispresso_output_dir}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPRessoCompare", # Assuming 'CRISPRessoCompare' is the executable name + "-s1", str(sample1_crispresso_output_dir), + "-s2", str(sample2_crispresso_output_dir), + "-o", str(output_directory), + "--s1_name", sample1_name, + "--s2_name", sample2_name, + ] + + if name: + cmd.extend(["--name", name]) + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if not plot_comparison_heatmap: + cmd.append("--no_comparison_heatmap") # Inferred flag + if not plot_comparison_bar_chart: + cmd.append("--no_comparison_bar_chart") # Inferred flag + if plot_difference_map: + cmd.append("--plot_difference_map") + if plot_indel_distribution_comparison: + cmd.append("--plot_indel_distribution_comparison") + + return _run_command(cmd, output_directory) + +@mcp.tool() +def crispresso_aggregate( + crispresso_output_dirs: List[Path], + output_directory: Path, + name: Optional[str] = None, + verbose: bool = False, + debug: bool = False, + overwrite: bool = False, + log_file: Optional[Path] = None, + group_by_column: Optional[str] = None, + metadata_file: Optional[Path] = None, + # Aggregation-specific plotting options (inferred) + plot_aggregated_heatmap: bool = True, + plot_aggregated_bar_chart: bool = True, +) -> Dict[str, Any]: + """ + Aggregates results from previously-run CRISPResso analyses. + + This tool combines and summarizes results from multiple CRISPResso runs, + allowing for broader analysis and visualization across experiments. + + Note: Parameter names and defaults are inferred based on common CRISPResso2 usage + and general bioinformatics practices, as detailed CLI documentation was not provided. + """ + # Input validation + if not crispresso_output_dirs: + raise ValueError("At least one CRISPResso output directory must be provided.") + for d in crispresso_output_dirs: + if not d.is_dir(): + raise FileNotFoundError(f"CRISPResso output directory not found: {d}") + if metadata_file and not metadata_file.is_file(): + raise FileNotFoundError(f"Metadata file not found: {metadata_file}") + + output_directory.mkdir(parents=True, exist_ok=True) + + cmd = [ + "CRISPRessoAggregate", # Assuming 'CRISPRessoAggregate' is the executable name + "-o", str(output_directory), + ] + for d in crispresso_output_dirs: + cmd.extend(["-i", str(d)]) + + if name: + cmd.extend(["--name", name]) + if verbose: + cmd.append("--verbose") + if debug: + cmd.append("--debug") + if overwrite: + cmd.append("--overwrite") + if log_file: + cmd.extend(["--log_file", str(log_file)]) + if group_by_column: + cmd.extend(["--group_by", group_by_column]) + if metadata_file: + cmd.extend(["--metadata", str(metadata_file)]) + if not plot_aggregated_heatmap: + cmd.append("--no_aggregated_heatmap") # Inferred flag + if not plot_aggregated_bar_chart: + cmd.append("--no_aggregated_bar_chart") # Inferred flag + + return _run_command(cmd, output_directory) \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c3c563ab0ce72ff9d6ec27842a104b0b769aad61 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - crispresso2 + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_crispresso2/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..37cd61592db3e088374c73f6c4a857a24f48a05d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install echidna via conda (e.g., from bioconda) +RUN conda install -c bioconda echidna -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/echidna_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/echidna_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/echidna_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_server.py new file mode 100644 index 0000000000000000000000000000000000000000..6c7a40b00b82bc9820adb6f8a6db00e899bf9e3e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_server.py @@ -0,0 +1,132 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import Optional, List + +# This is a placeholder for the MCP decorator. +# In a real MCP environment, this would be provided by the MCP framework. +def tool(*args, **kwargs): + def decorator(func): + return func + return decorator + +mcp = type("mcp", (), {"tool": tool}) + + +@mcp.tool() +def run_echidna( + input_adata: Path, + output_prefix: str, + timepoint_label: str = "timepoint", + counts_layer: str = "counts", + clusters: str = "leiden", + seed: int = 42, + n_steps: int = 10000, + learning_rate: float = 0.1, + val_split: float = 0.1, + patience: int = 30, + device: str = "cpu", + verbose: bool = True, + inverse_gamma: bool = False, + eta_mean_init: float = 2.0, + lkj_concentration: float = 1.0, + q_corr_init: float = 0.01, + q_shape_rate_scaler: float = 10.0, +): + """ + Runs the Echidna model for joint probabilistic modeling of single-cell gene + expression and chromosomal copy number variation. + + This tool serves as a command-line wrapper for the `echidna` Python library, + which integrates scRNA-seq and bulk WGS data to quantify gene dosage effects. + """ + # --- Input Validation --- + if not input_adata.is_file(): + raise FileNotFoundError(f"Input AnnData file not found: {input_adata}") + + if n_steps <= 0: + raise ValueError("n_steps must be a positive integer.") + if learning_rate <= 0: + raise ValueError("learning_rate must be positive.") + if not (0.0 < val_split < 1.0): + raise ValueError("val_split must be between 0.0 and 1.0.") + if patience < 0: + raise ValueError("patience must be a non-negative integer.") + if device not in ["cpu", "cuda"]: + raise ValueError("device must be either 'cpu' or 'cuda'.") + if lkj_concentration <= 0: + raise ValueError("lkj_concentration must be positive.") + + # --- Command-line construction --- + # Echidna is a library, so we are assuming a hypothetical wrapper script + # `run_echidna_script.py` that exposes its functionality via CLI. + # This is a common pattern for converting libraries to MCP tools. + cmd = [ + "echidna_runner", # Hypothetical executable script + "--input-adata", str(input_adata), + "--output-prefix", output_prefix, + "--timepoint-label", timepoint_label, + "--counts-layer", counts_layer, + "--clusters", clusters, + "--seed", str(seed), + "--n-steps", str(n_steps), + "--learning-rate", str(learning_rate), + "--val-split", str(val_split), + "--patience", str(patience), + "--device", device, + "--eta-mean-init", str(eta_mean_init), + "--lkj-concentration", str(lkj_concentration), + "--q-corr-init", str(q_corr_init), + "--q-shape-rate-scaler", str(q_shape_rate_scaler), + ] + + if verbose: + cmd.append("--verbose") + if inverse_gamma: + cmd.append("--inverse-gamma") + + # --- Subprocess Execution --- + command_executed = " ".join(cmd) + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + stdout = result.stdout + stderr = result.stderr + except FileNotFoundError: + return { + "command_executed": command_executed, + "stdout": "", + "stderr": "Error: The 'echidna_runner' executable was not found. Please ensure the echidna environment is correctly configured and the wrapper script is in the system's PATH.", + "output_files": [], + "return_code": 1, + } + except subprocess.CalledProcessError as e: + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "return_code": e.returncode, + } + + # --- Structured Result Return --- + # Define expected output files based on the hypothetical wrapper's behavior. + # This typically includes the updated AnnData object, a saved model, and plots. + output_files = [ + f"{output_prefix}_adata.h5ad", + f"{output_prefix}_model.pt", + f"{output_prefix}_gene_dosage.csv", + f"{output_prefix}_gene_dosage.png", + ] + + return { + "command_executed": command_executed, + "stdout": stdout, + "stderr": stderr, + "output_files": output_files, + "return_code": 0, + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..94ef6035ddb7af6614feb5b512febd2eaad60a13 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/echidna_server.py') +SERVER_NAME = 'biosci_echidna' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..78fd44fdf9682830e405e76fca22a707c8231e55 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-echidna: + build: . + image: mcp-echidna:latest + container_name: mcp-echidna + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=echidna + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..60a32b0534f3d831b7da5bdc70ae46c2dfffa49d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_echidna/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - echidna + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..80c83092c1eed5725af59162ee1858464459857a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install famsa via conda (e.g., from bioconda) +RUN conda install -c bioconda famsa -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/famsa_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/famsa_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/famsa_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e788d77fc07f0977c7253f3cb0b6006f9c4538f5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_server.py @@ -0,0 +1,184 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any + +# from mcp import tool as mcp_tool # MCP decorator is assumed to be available + +# For local testing, you can use a dummy decorator +class mcp_tool: + def __init__(self, *args, **kwargs): + pass + def __call__(self, func): + return func + +mcp = type('mcp', (), {'tool': mcp_tool}) + + +@mcp.tool() +def famsa_align( + input_file: Path, + output_file: Path, + input_file_2: Optional[Path] = None, + threads: int = 0, + verbose: bool = False, + guide_tree_method: str = 'sl', + guide_tree_import_file: Optional[Path] = None, + medoidtree: bool = False, + medoid_threshold: Optional[int] = None, + medoid_seeds: Optional[int] = None, + gt_export: bool = False, + dist_export: bool = False, + square_matrix: bool = False, + pid: bool = False, + keep_duplicates: bool = False, + gz: bool = False, + gz_level: Optional[int] = None, + remove_rare_columns: Optional[float] = None, + refine_mode: str = 'auto' +) -> Dict[str, Any]: + """ + Performs multiple sequence alignment (MSA) or profile-profile alignment using FAMSA. + + FAMSA is a fast and accurate algorithm for large-scale multiple sequence alignments. + This tool can perform standard MSA on a single input FASTA file (gaps are removed) + or a profile-profile alignment if two input FASTA files are provided (gaps are preserved). + + Args: + input_file: Path to the input file in FASTA format. + output_file: Path to the output file. The content depends on other flags (alignment, guide tree, or distance matrix). + input_file_2: Optional path to a second input file for profile-profile alignment. + threads: Number of threads to use. 0 indicates half of all logical cores. + verbose: Show timing information. + guide_tree_method: Guide tree method. Can be 'sl' (single linkage), 'upgma', 'nj' (neighbour joining), or 'import'. + guide_tree_import_file: Path to a Newick file to import as the guide tree. Required if guide_tree_method is 'import'. + medoidtree: Use MedoidTree heuristic for speeding up tree construction. + medoid_threshold: If specified, medoid trees are used only for sets with this many sequences or more. Requires medoidtree=True. + medoid_seeds: Number of seeds k in medoid trees. Requires medoidtree=True. (From GitHub docs). + gt_export: Export a guide tree to the output file in Newick format. + dist_export: Export a distance matrix to the output file in CSV format. + square_matrix: Generate a square distance matrix instead of a triangle. Requires dist_export=True. + pid: Generate pairwise identity instead of distance. Requires dist_export=True. + keep_duplicates: Keep duplicated sequences during alignment. + gz: Enable gzipped output. + gz_level: Gzip compression level [0-9]. Requires gz=True. + remove_rare_columns: Remove columns with less than this fraction of non-gap characters. + refine_mode: Refinement mode. Can be 'on', 'off', or 'auto'. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output files. + """ + # --- Input Validation --- + if not input_file.is_file(): + raise FileNotFoundError(f"Input file not found: {input_file}") + if input_file_2 and not input_file_2.is_file(): + raise FileNotFoundError(f"Second input file not found: {input_file_2}") + + valid_gt_methods = ['sl', 'upgma', 'nj', 'import'] + if guide_tree_method not in valid_gt_methods: + raise ValueError(f"guide_tree_method must be one of {valid_gt_methods}, not '{guide_tree_method}'") + + if guide_tree_method == 'import': + if not guide_tree_import_file: + raise ValueError("guide_tree_import_file must be provided when guide_tree_method is 'import'") + if not guide_tree_import_file.is_file(): + raise FileNotFoundError(f"Guide tree import file not found: {guide_tree_import_file}") + elif guide_tree_import_file: + raise ValueError("guide_tree_import_file can only be used when guide_tree_method is 'import'") + + if (medoid_threshold is not None or medoid_seeds is not None) and not medoidtree: + raise ValueError("medoid_threshold and medoid_seeds can only be used when medoidtree is True") + + if gt_export and dist_export: + raise ValueError("Cannot use gt_export and dist_export simultaneously as they both write to the same output file.") + + if (square_matrix or pid) and not dist_export: + raise ValueError("square_matrix and pid options require dist_export to be True") + + if gz_level is not None: + if not gz: + raise ValueError("gz_level can only be specified when gz is True") + if not (0 <= gz_level <= 9): + raise ValueError(f"gz_level must be between 0 and 9, not {gz_level}") + + if remove_rare_columns is not None and not (0.0 <= remove_rare_columns <= 1.0): + raise ValueError(f"remove_rare_columns must be a fraction between 0.0 and 1.0, not {remove_rare_columns}") + + valid_refine_modes = ['on', 'off', 'auto'] + if refine_mode not in valid_refine_modes: + raise ValueError(f"refine_mode must be one of {valid_refine_modes}, not '{refine_mode}'") + + # --- Command Construction --- + cmd = ["famsa"] + + # Options + cmd.extend(["-t", str(threads)]) + if verbose: + cmd.append("-v") + + if guide_tree_method == 'import': + cmd.extend(["-gt", "import", str(guide_tree_import_file)]) + else: + cmd.extend(["-gt", guide_tree_method]) + + if medoidtree: + cmd.append("-medoidtree") + if medoid_threshold is not None: + cmd.extend(["-medoid_threshold", str(medoid_threshold)]) + if medoid_seeds is not None: + cmd.extend(["-medoid_seeds", str(medoid_seeds)]) + + if gt_export: + cmd.append("-gt_export") + if dist_export: + cmd.append("-dist_export") + if square_matrix: + cmd.append("-square_matrix") + if pid: + cmd.append("-pid") + if keep_duplicates: + cmd.append("-keep-duplicates") + if gz: + cmd.append("-gz") + if gz_level is not None: + cmd.extend(["-gz-lev", str(gz_level)]) + if remove_rare_columns is not None: + cmd.extend(["-remove-rare-columns", str(remove_rare_columns)]) + + cmd.extend(["-refine_mode", refine_mode]) + + # Positional arguments + cmd.append(str(input_file)) + if input_file_2: + cmd.append(str(input_file_2)) + cmd.append(str(output_file)) + + command_executed = " ".join(cmd) + + # --- Subprocess Execution --- + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True + ) + except FileNotFoundError: + raise RuntimeError("famsa executable not found. Please ensure it is in your system's PATH.") + except subprocess.CalledProcessError as e: + # Return structured error information + return { + "error": "FAMSA execution failed.", + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "return_code": e.returncode, + "output_files": [] + } + + # --- Structured Result Return --- + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [str(output_file)] + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..04bc7e41165c29f64b5f9e25b594893ad87c8381 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/famsa_server.py') +SERVER_NAME = 'biosci_famsa' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..fdb0839cb09d27a96bc4b87d0a75ed34a493c142 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-famsa: + build: . + image: mcp-famsa:latest + container_name: mcp-famsa + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=famsa + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b0688ff831224a992091d09803b41cf1e19fd40e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - famsa + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_famsa/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2e31cd043c911df0418526ab7803215b8f145169 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install gffutils via conda (e.g., from bioconda) +RUN conda install -c bioconda gffutils -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/gffutils_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/gffutils_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/gffutils_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_server.py new file mode 100644 index 0000000000000000000000000000000000000000..19e3ec78e9ef6b04b65bb12ce475c402923a9acc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_server.py @@ -0,0 +1,616 @@ +import subprocess +from pathlib import Path +from typing import List, Optional + +# This is a placeholder for the actual decorator as per the user's request. +class mcp: + @staticmethod + def tool(): + def decorator(func): + return func + return decorator + +def _add_flag(cmd: list, flag: str, value: bool): + """Helper to add a boolean flag to a command list if True.""" + if value: + cmd.append(flag) + +def _add_optional_arg(cmd: list, arg_name: str, value): + """Helper to add an optional argument with its value to a command list.""" + if value is not None: + cmd.extend([arg_name, str(value)]) + +@mcp.tool() +def gffutils_create( + db: Path, + gff_files: List[Path], + gff_dialect: Optional[str] = None, + id_spec: Optional[str] = None, + merge_strategy: str = "error", + transform: Optional[Path] = None, + force: bool = False, + verbose: bool = False, + disable_infer_transcripts: bool = False, + disable_infer_genes: bool = False, + disable_infer_extents: bool = False, + disable_infer_cds_extent: bool = False, + disable_infer_exon_extent: bool = False, + disable_infer_transcript_extent: bool = False, + disable_infer_gene_extent: bool = False, + disable_create_introns: bool = False, + disable_fix_strand: bool = False, + disable_fix_parent_child: bool = False, + disable_fix_start_stop: bool = False, + disable_fix_attributes: bool = False, + disable_fix_gff3_dialect: bool = False, + disable_fix_gtf_dialect: bool = False, + disable_dialect_check: bool = False, + disable_pragma_check: bool = False, + disable_order_check: bool = False, + disable_id_check: bool = False, + disable_feature_check: bool = False, + disable_relationship_check: bool = False, + disable_format_check: bool = False, + disable_all_fixes: bool = False, + disable_all_checks: bool = False, +): + """ + Creates a new gffutils database from GFF/GTF files. + """ + if not gff_files: + raise ValueError("At least one GFF/GTF file must be provided.") + for gff_file in gff_files: + if str(gff_file) != "-" and not gff_file.exists(): + raise FileNotFoundError(f"Input GFF/GTF file not found: {gff_file}") + if transform and not transform.exists(): + raise FileNotFoundError(f"Transform file not found: {transform}") + if merge_strategy not in ["merge", "create_unique", "error", "warning", "ignore"]: + raise ValueError(f"Invalid merge_strategy: {merge_strategy}") + + cmd = ["gffutils-cli", "create", str(db)] + cmd.extend([str(f) for f in gff_files]) + + _add_optional_arg(cmd, "--gff-dialect", gff_dialect) + _add_optional_arg(cmd, "--id-spec", id_spec) + _add_optional_arg(cmd, "--merge-strategy", merge_strategy) + _add_optional_arg(cmd, "--transform", transform) + _add_flag(cmd, "--force", force) + _add_flag(cmd, "--verbose", verbose) + + disable_flags = { + "--disable-infer-transcripts": disable_infer_transcripts, "--disable-infer-genes": disable_infer_genes, + "--disable-infer-extents": disable_infer_extents, "--disable-infer-cds-extent": disable_infer_cds_extent, + "--disable-infer-exon-extent": disable_infer_exon_extent, "--disable-infer-transcript-extent": disable_infer_transcript_extent, + "--disable-infer-gene-extent": disable_infer_gene_extent, "--disable-create-introns": disable_create_introns, + "--disable-fix-strand": disable_fix_strand, "--disable-fix-parent-child": disable_fix_parent_child, + "--disable-fix-start-stop": disable_fix_start_stop, "--disable-fix-attributes": disable_fix_attributes, + "--disable-fix-gff3-dialect": disable_fix_gff3_dialect, "--disable-fix-gtf-dialect": disable_fix_gtf_dialect, + "--disable-dialect-check": disable_dialect_check, "--disable-pragma-check": disable_pragma_check, + "--disable-order-check": disable_order_check, "--disable-id-check": disable_id_check, + "--disable-feature-check": disable_feature_check, "--disable-relationship-check": disable_relationship_check, + "--disable-format-check": disable_format_check, "--disable-all-fixes": disable_all_fixes, + "--disable-all-checks": disable_all_checks, + } + for flag, value in disable_flags.items(): + _add_flag(cmd, flag, value) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [str(db)], + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli create failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_update( + db: Path, + gff_files: List[Path], + gff_dialect: Optional[str] = None, + id_spec: Optional[str] = None, + merge_strategy: str = "error", + transform: Optional[Path] = None, + verbose: bool = False, + disable_infer_transcripts: bool = False, + disable_infer_genes: bool = False, + disable_infer_extents: bool = False, + disable_infer_cds_extent: bool = False, + disable_infer_exon_extent: bool = False, + disable_infer_transcript_extent: bool = False, + disable_infer_gene_extent: bool = False, + disable_create_introns: bool = False, + disable_fix_strand: bool = False, + disable_fix_parent_child: bool = False, + disable_fix_start_stop: bool = False, + disable_fix_attributes: bool = False, + disable_fix_gff3_dialect: bool = False, + disable_fix_gtf_dialect: bool = False, + disable_dialect_check: bool = False, + disable_pragma_check: bool = False, + disable_order_check: bool = False, + disable_id_check: bool = False, + disable_feature_check: bool = False, + disable_relationship_check: bool = False, + disable_format_check: bool = False, + disable_all_fixes: bool = False, + disable_all_checks: bool = False, +): + """ + Updates an existing gffutils database with new GFF/GTF files. + """ + if not db.exists(): + raise FileNotFoundError(f"Database to update not found: {db}") + if not gff_files: + raise ValueError("At least one GFF/GTF file must be provided.") + for gff_file in gff_files: + if str(gff_file) != "-" and not gff_file.exists(): + raise FileNotFoundError(f"Input GFF/GTF file not found: {gff_file}") + if transform and not transform.exists(): + raise FileNotFoundError(f"Transform file not found: {transform}") + if merge_strategy not in ["merge", "create_unique", "error", "warning", "ignore"]: + raise ValueError(f"Invalid merge_strategy: {merge_strategy}") + + cmd = ["gffutils-cli", "update", str(db)] + cmd.extend([str(f) for f in gff_files]) + + _add_optional_arg(cmd, "--gff-dialect", gff_dialect) + _add_optional_arg(cmd, "--id-spec", id_spec) + _add_optional_arg(cmd, "--merge-strategy", merge_strategy) + _add_optional_arg(cmd, "--transform", transform) + _add_flag(cmd, "--verbose", verbose) + + disable_flags = { + "--disable-infer-transcripts": disable_infer_transcripts, "--disable-infer-genes": disable_infer_genes, + "--disable-infer-extents": disable_infer_extents, "--disable-infer-cds-extent": disable_infer_cds_extent, + "--disable-infer-exon-extent": disable_infer_exon_extent, "--disable-infer-transcript-extent": disable_infer_transcript_extent, + "--disable-infer-gene-extent": disable_infer_gene_extent, "--disable-create-introns": disable_create_introns, + "--disable-fix-strand": disable_fix_strand, "--disable-fix-parent-child": disable_fix_parent_child, + "--disable-fix-start-stop": disable_fix_start_stop, "--disable-fix-attributes": disable_fix_attributes, + "--disable-fix-gff3-dialect": disable_fix_gff3_dialect, "--disable-fix-gtf-dialect": disable_fix_gtf_dialect, + "--disable-dialect-check": disable_dialect_check, "--disable-pragma-check": disable_pragma_check, + "--disable-order-check": disable_order_check, "--disable-id-check": disable_id_check, + "--disable-feature-check": disable_feature_check, "--disable-relationship-check": disable_relationship_check, + "--disable-format-check": disable_format_check, "--disable-all-fixes": disable_all_fixes, + "--disable-all-checks": disable_all_checks, + } + for flag, value in disable_flags.items(): + _add_flag(cmd, flag, value) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [str(db)], + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli update failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_merge( + dbs: List[Path], + output: Optional[Path] = None, + force: bool = False, +): + """ + Merges multiple gffutils databases into a single database. + """ + if not dbs: + raise ValueError("At least one database must be provided for merging.") + for db_path in dbs: + if not db_path.exists(): + raise FileNotFoundError(f"Input database not found: {db_path}") + + cmd = ["gffutils-cli", "merge"] + cmd.extend([str(db) for db in dbs]) + + _add_optional_arg(cmd, "--output", output) + _add_flag(cmd, "--force", force) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli merge failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_clean( + db: Path, + output: Optional[Path] = None, + force: bool = False, +): + """ + Cleans a gffutils database by removing orphaned features. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + + cmd = ["gffutils-cli", "clean", str(db)] + _add_optional_arg(cmd, "--output", output) + _add_flag(cmd, "--force", force) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_file = output if output else db + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [str(output_file)], + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli clean failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_dump( + db: Path, + output: Optional[Path] = None, + dialect: Optional[str] = None, + featuretype: Optional[str] = None, + id: Optional[str] = None, + seqid: Optional[str] = None, + start: Optional[int] = None, + end: Optional[int] = None, + strand: Optional[str] = None, + revcomp: bool = False, + limit: Optional[int] = None, + offset: Optional[int] = None, + attribute_split_char: Optional[str] = None, + attributes: Optional[str] = None, + extra_attributes: Optional[str] = None, + no_attributes: bool = False, + raw: bool = False, + table: Optional[str] = None, + fasta: Optional[Path] = None, + chrom_lookup: Optional[Path] = None, +): + """ + Dumps data from a gffutils database to various formats. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + if fasta and not fasta.exists(): + raise FileNotFoundError(f"FASTA file not found: {fasta}") + if chrom_lookup and not chrom_lookup.exists(): + raise FileNotFoundError(f"Chromosome lookup file not found: {chrom_lookup}") + if strand and strand not in ["+", "-", "."]: + raise ValueError(f"Invalid strand: {strand}. Must be '+', '-', or '.'.") + + cmd = ["gffutils-cli", "dump", str(db)] + _add_optional_arg(cmd, "--output", output) + _add_optional_arg(cmd, "--dialect", dialect) + _add_optional_arg(cmd, "--featuretype", featuretype) + _add_optional_arg(cmd, "--id", id) + _add_optional_arg(cmd, "--seqid", seqid) + _add_optional_arg(cmd, "--start", start) + _add_optional_arg(cmd, "--end", end) + _add_optional_arg(cmd, "--strand", strand) + _add_flag(cmd, "--revcomp", revcomp) + _add_optional_arg(cmd, "--limit", limit) + _add_optional_arg(cmd, "--offset", offset) + _add_optional_arg(cmd, "--attribute-split-char", attribute_split_char) + _add_optional_arg(cmd, "--attributes", attributes) + _add_optional_arg(cmd, "--extra-attributes", extra_attributes) + _add_flag(cmd, "--no-attributes", no_attributes) + _add_flag(cmd, "--raw", raw) + _add_optional_arg(cmd, "--table", table) + _add_optional_arg(cmd, "--fasta", fasta) + _add_optional_arg(cmd, "--chrom-lookup", chrom_lookup) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli dump failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_gff( + db: Path, + ids: List[str], + output: Optional[Path] = None, + parents: bool = False, + children: bool = False, + ancestors: bool = False, + descendants: bool = False, + level: Optional[int] = None, + featuretype: Optional[str] = None, + reverse: bool = False, + limit: Optional[int] = None, +): + """ + Retrieves features and their relatives from a database in GFF format. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + if not ids: + raise ValueError("At least one feature ID must be provided.") + + cmd = ["gffutils-cli", "gff", str(db)] + cmd.extend(ids) + + _add_optional_arg(cmd, "--output", output) + _add_flag(cmd, "--parents", parents) + _add_flag(cmd, "--children", children) + _add_flag(cmd, "--ancestors", ancestors) + _add_flag(cmd, "--descendants", descendants) + _add_optional_arg(cmd, "--level", level) + _add_optional_arg(cmd, "--featuretype", featuretype) + _add_flag(cmd, "--reverse", reverse) + _add_optional_arg(cmd, "--limit", limit) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli gff failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_fasta( + db: Path, + fasta: Path, + ids: List[str], + output: Optional[Path] = None, + featuretype: Optional[str] = None, + attribute: Optional[str] = None, + use_strand: bool = False, + prefix: Optional[str] = None, +): + """ + Retrieves sequences for features from a database. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + if not fasta.exists(): + raise FileNotFoundError(f"Input FASTA file not found: {fasta}") + if not ids: + raise ValueError("At least one feature ID must be provided.") + + cmd = ["gffutils-cli", "fasta", str(db)] + cmd.extend(ids) + cmd.extend(["--fasta", str(fasta)]) + + _add_optional_arg(cmd, "--output", output) + _add_optional_arg(cmd, "--featuretype", featuretype) + _add_optional_arg(cmd, "--attribute", attribute) + _add_flag(cmd, "--use-strand", use_strand) + _add_optional_arg(cmd, "--prefix", prefix) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli fasta failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_bed( + db: Path, + output: Optional[Path] = None, + featuretype: Optional[str] = None, + name_attribute: str = "ID", + score_attribute: Optional[str] = None, + thick_attribute: Optional[str] = None, + block_attribute: Optional[str] = None, + track_line: Optional[str] = None, +): + """ + Converts features from a gffutils database to BED format. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + + cmd = ["gffutils-cli", "bed", str(db)] + _add_optional_arg(cmd, "--output", output) + _add_optional_arg(cmd, "--featuretype", featuretype) + _add_optional_arg(cmd, "--name-attribute", name_attribute) + _add_optional_arg(cmd, "--score-attribute", score_attribute) + _add_optional_arg(cmd, "--thick-attribute", thick_attribute) + _add_optional_arg(cmd, "--block-attribute", block_attribute) + _add_optional_arg(cmd, "--track-line", track_line) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli bed failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_stats( + db: Path, + output: Optional[Path] = None, + feature_counts: bool = False, + attribute_counts: Optional[str] = None, +): + """ + Prints statistics about a gffutils database. + """ + if not db.exists(): + raise FileNotFoundError(f"Input database not found: {db}") + + # Default behavior is to print feature counts + if not feature_counts and not attribute_counts: + feature_counts = True + + cmd = ["gffutils-cli", "stats", str(db)] + _add_optional_arg(cmd, "--output", output) + _add_flag(cmd, "--feature-counts", feature_counts) + _add_optional_arg(cmd, "--attribute-counts", attribute_counts) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli stats failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_sort( + gff_file: Path, + output: Optional[Path] = None, + force: bool = False, + disable_infer_transcripts: bool = False, + disable_infer_genes: bool = False, + disable_infer_extents: bool = False, + disable_infer_cds_extent: bool = False, + disable_infer_exon_extent: bool = False, + disable_infer_transcript_extent: bool = False, + disable_infer_gene_extent: bool = False, + disable_create_introns: bool = False, + disable_fix_strand: bool = False, + disable_fix_parent_child: bool = False, + disable_fix_start_stop: bool = False, + disable_fix_attributes: bool = False, + disable_fix_gff3_dialect: bool = False, + disable_fix_gtf_dialect: bool = False, + disable_dialect_check: bool = False, + disable_pragma_check: bool = False, + disable_order_check: bool = False, + disable_id_check: bool = False, + disable_feature_check: bool = False, + disable_relationship_check: bool = False, + disable_format_check: bool = False, + disable_all_fixes: bool = False, + disable_all_checks: bool = False, +): + """ + Sorts a GFF/GTF file. + """ + if str(gff_file) != "-" and not gff_file.exists(): + raise FileNotFoundError(f"Input GFF/GTF file not found: {gff_file}") + + cmd = ["gffutils-cli", "sort", str(gff_file)] + _add_optional_arg(cmd, "--output", output) + _add_flag(cmd, "--force", force) + + disable_flags = { + "--disable-infer-transcripts": disable_infer_transcripts, "--disable-infer-genes": disable_infer_genes, + "--disable-infer-extents": disable_infer_extents, "--disable-infer-cds-extent": disable_infer_cds_extent, + "--disable-infer-exon-extent": disable_infer_exon_extent, "--disable-infer-transcript-extent": disable_infer_transcript_extent, + "--disable-infer-gene-extent": disable_infer_gene_extent, "--disable-create-introns": disable_create_introns, + "--disable-fix-strand": disable_fix_strand, "--disable-fix-parent-child": disable_fix_parent_child, + "--disable-fix-start-stop": disable_fix_start_stop, "--disable-fix-attributes": disable_fix_attributes, + "--disable-fix-gff3-dialect": disable_fix_gff3_dialect, "--disable-fix-gtf-dialect": disable_fix_gtf_dialect, + "--disable-dialect-check": disable_dialect_check, "--disable-pragma-check": disable_pragma_check, + "--disable-order-check": disable_order_check, "--disable-id-check": disable_id_check, + "--disable-feature-check": disable_feature_check, "--disable-relationship-check": disable_relationship_check, + "--disable-format-check": disable_format_check, "--disable-all-fixes": disable_all_fixes, + "--disable-all-checks": disable_all_checks, + } + for flag, value in disable_flags.items(): + _add_flag(cmd, flag, value) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + output_files = [str(output)] if output else [] + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + raise RuntimeError( + f"gffutils-cli sort failed with exit code {e.returncode}\n" + f"Stderr: {e.stderr}\n" + f"Stdout: {e.stdout}" + ) + +@mcp.tool() +def gffutils_validate( + gff_file: Path, + limit: Optional[int] = None, +): + """ + Validates a GFF/GTF file, reporting any errors found. + """ + if str(gff_file) != "-" and not gff_file.exists(): + raise FileNotFoundError(f"Input GFF/GTF file not found: {gff_file}") + + cmd = ["gffutils-cli", "validate", str(gff_file)] + _add_optional_arg(cmd, "--limit", limit) + + # The 'validate' command returns a non-zero exit code upon finding validation errors. + # This is expected behavior, so we do not use check=True. + result = subprocess.run(cmd, capture_output=True, text=True) + + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "exit_code": result.returncode, + "output_files": [], + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..c6e6a481eb54c8c145ded9a8647b71310165983b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/gffutils_server.py') +SERVER_NAME = 'biosci_gffutils' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..67ae2cd8b332e0d6da26f913571041928167367a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-gffutils: + build: . + image: mcp-gffutils:latest + container_name: mcp-gffutils + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=gffutils + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..64b0b539cc71a8a18f8df34cb34b9ffd952c76ac --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - gffutils + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gffutils/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a270776cfc98857abc53afe0c5f9975e28426f22 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install gmap via conda (e.g., from bioconda) +RUN conda install -c bioconda gmap -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/gmap_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/gmap_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/gmap_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_server.py new file mode 100644 index 0000000000000000000000000000000000000000..3be95996dfd46ec7ed10955b6147dd449737d45d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_server.py @@ -0,0 +1,309 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Union + +@mcp.tool() +def gmap_build( + db_name: str, + fasta_files: List[str], + dest_dir: Optional[str] = None, + kmer: int = 15, + sampling: int = 3, +): + """ + Builds a genome database for GMAP and GSNAP. + + Args: + db_name: Name of the genome database to create. + fasta_files: List of paths to FASTA files containing the genome sequences. + dest_dir: Destination directory for the genome database. If not provided, uses default. + kmer: K-mer size for the genomic index (default 15). + sampling: Sampling interval for the genomic index (default 3). + """ + # Input validation + if not fasta_files: + return {"error": "At least one FASTA file must be provided."} + + for f in fasta_files: + if not Path(f).exists(): + return {"error": f"FASTA file not found: {f}"} + + cmd = ["gmap_build", "-d", db_name] + + if dest_dir: + dest_path = Path(dest_dir) + dest_path.mkdir(parents=True, exist_ok=True) + cmd.extend(["-D", str(dest_path)]) + + cmd.extend(["-k", str(kmer)]) + cmd.extend(["-s", str(sampling)]) + cmd.extend(fasta_files) + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def gmap( + db_name: str, + query_file: str, + genome_dir: Optional[str] = None, + nthreads: int = 1, + output_format: str = "samse", + align_fraction: float = 1.0, + npaths: int = 5, + min_intronlength: int = 20, + max_intronlength_middle: int = 500000, + max_intronlength_ends: int = 10000, +): + """ + Genomic mapping and alignment program for mRNA and EST sequences. + + Args: + db_name: Genome database name. + query_file: Path to the mRNA/EST sequence file (FASTA/FASTQ). + genome_dir: Directory where the genome database is located. + nthreads: Number of worker threads (default 1). + output_format: Output format (samse, sampe, gff3_gene, gff3_match_cdna, gff3_match_est, etc.). + align_fraction: Align only a fraction of the given reads, selected randomly (0.0 to 1.0). + npaths: Maximum number of paths to show (default 5). + min_intronlength: Minimum intron length (default 20). + max_intronlength_middle: Max intron length for internal introns (default 500000). + max_intronlength_ends: Max intron length for end introns (default 10000). + """ + if not Path(query_file).exists(): + return {"error": f"Query file not found: {query_file}"} + + if not (0.0 <= align_fraction <= 1.0): + return {"error": "align_fraction must be between 0.0 and 1.0"} + + cmd = ["gmap", "-d", db_name, "-t", str(nthreads), "-f", output_format] + + if genome_dir: + cmd.extend(["-D", genome_dir]) + + cmd.extend(["--align-fraction", str(align_fraction)]) + cmd.extend(["-n", str(npaths)]) + cmd.extend(["--min-intronlength", str(min_intronlength)]) + cmd.extend(["--max-intronlength-middle", str(max_intronlength_middle)]) + cmd.extend(["--max-intronlength-ends", str(max_intronlength_ends)]) + cmd.append(query_file) + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def gsnap( + db_name: str, + query_file1: str, + query_file2: Optional[str] = None, + genome_dir: Optional[str] = None, + nthreads: int = 1, + output_format: str = "sam", + two_pass: bool = False, + max_insertions: int = 3, + max_deletions: int = 3, + min_coverage: float = 0.5, + align_fraction: float = 1.0, + batch: int = 2, +): + """ + Genomic Short-read Nucleotide Alignment Program (GSNAP). + + Args: + db_name: Genome database name. + query_file1: Path to the first FASTQ/FASTA file (or single-end file). + query_file2: Path to the second FASTQ/FASTA file for paired-end reads. + genome_dir: Directory where the genome database is located. + nthreads: Number of worker threads (default 1). + output_format: Output format (sam, etc.). + two_pass: Use two-pass mode to learn splice sites and indels (default False). + max_insertions: Maximum number of insertions allowed (default 3). + max_deletions: Maximum number of deletions allowed (default 3). + min_coverage: Minimum coverage required for an alignment (default 0.5). + align_fraction: Align only a fraction of the given reads (0.0 to 1.0). + batch: Batch mode (0=offsets, 1=offsets+positions, 2=offsets+positions+genome, default 2). + """ + if not Path(query_file1).exists(): + return {"error": f"Query file 1 not found: {query_file1}"} + + cmd = ["gsnap", "-d", db_name, "-t", str(nthreads), "-A", output_format] + + if genome_dir: + cmd.extend(["-D", genome_dir]) + + if two_pass: + cmd.append("--two-pass") + + cmd.extend(["--max-insertions", str(max_insertions)]) + cmd.extend(["--max-deletions", str(max_deletions)]) + cmd.extend(["--min-coverage", str(min_coverage)]) + cmd.extend(["--align-fraction", str(align_fraction)]) + cmd.extend(["-B", str(batch)]) + + cmd.append(query_file1) + if query_file2: + if not Path(query_file2).exists(): + return {"error": f"Query file 2 not found: {query_file2}"} + cmd.append(query_file2) + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def gtf_exons(gtf_file: str): + """ + Extracts exons from a GTF file for use with GMAP/GSNAP. + + Args: + gtf_file: Path to the input GTF file. + """ + if not Path(gtf_file).exists(): + return {"error": f"GTF file not found: {gtf_file}"} + + cmd = ["gtf_exons", gtf_file] + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def gff3_exons(gff3_file: str): + """ + Extracts exons from a GFF3 file for use with GMAP/GSNAP. + + Args: + gff3_file: Path to the input GFF3 file. + """ + if not Path(gff3_file).exists(): + return {"error": f"GFF3 file not found: {gff3_file}"} + + cmd = ["gff3_exons", gff3_file] + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def gff3_genes(gff3_file: str): + """ + Extracts genes from a GFF3 file for use with GMAP/GSNAP. + Works on NCBI and Ensembl GFF3 files. + + Args: + gff3_file: Path to the input GFF3 file. + """ + if not Path(gff3_file).exists(): + return {"error": f"GFF3 file not found: {gff3_file}"} + + cmd = ["gff3_genes", gff3_file] + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } + +@mcp.tool() +def iit_store(input_file: str, output_file: str): + """ + Creates an Interval Index Tree (IIT) file from a text file. + Used for handling SNPs and splices in GMAP/GSNAP. + + Args: + input_file: Path to the input text file (e.g., splices or SNPs). + output_file: Path to the output .iit file. + """ + if not Path(input_file).exists(): + return {"error": f"Input file not found: {input_file}"} + + cmd = ["iit_store", "-o", output_file, input_file] + + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": [output_file], + "status": "success" + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e) + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..71a106a1ccc76e1d3f24d9b7e01d268fac46213f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/gmap_server.py') +SERVER_NAME = 'biosci_gmap' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..cd781380c776408bd37ea85418ca5c691f5f2fd8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-gmap: + build: . + image: mcp-gmap:latest + container_name: mcp-gmap + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=gmap + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e3b797d385792b1faf5aa43915e9e7a5352a681f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - gmap + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_gmap/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..76504dd697e87d664d18ea4e70920c52edf579b3 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install munkres via conda (e.g., from bioconda) +RUN conda install -c bioconda munkres -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/munkres_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/munkres_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/munkres_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_server.py new file mode 100644 index 0000000000000000000000000000000000000000..45ef3928cde91e5b26297772263e52963448cd4a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_server.py @@ -0,0 +1,134 @@ +import subprocess +import tempfile +import ast +from pathlib import Path +from typing import Optional + +# @mcp.tool() +def munkres( + cost_matrix: str +): + """ + Solves the assignment problem for a given cost matrix using the Munkres algorithm. + + This tool takes a cost matrix, writes it to a temporary Python script, + and executes the script to find the assignment with the lowest cost. + The underlying 'munkres' tool is a Python library, and its command-line + interface is only a demo. This wrapper enables its use as a command-line tool + by generating and running a script on the fly. + + Args: + cost_matrix: A string representation of a list of lists (matrix) of numbers + (integers or floats). Example: "[[10, 10, 8], [9, 8, 1], [9, 7, 4]]" + """ + # 1. Input Validation + try: + parsed_matrix = ast.literal_eval(cost_matrix) + except (ValueError, SyntaxError) as e: + raise ValueError(f"Invalid format for cost_matrix. Must be a string representation of a list of lists. Error: {e}") + + if not isinstance(parsed_matrix, list): + raise TypeError("cost_matrix must evaluate to a list.") + + if not parsed_matrix: + # Handle empty matrix case + return { + "command_executed": "N/A (empty matrix)", + "stdout": "lowest cost=0", + "stderr": "", + "output_files": [] + } + + if not all(isinstance(row, list) for row in parsed_matrix): + raise TypeError("cost_matrix must evaluate to a list of lists.") + + if parsed_matrix: + first_row_len = len(parsed_matrix[0]) + for i, row in enumerate(parsed_matrix): + if len(row) != first_row_len: + raise ValueError("All rows in the cost_matrix must have the same length.") + for j, val in enumerate(row): + if not isinstance(val, (int, float)): + raise TypeError(f"All elements in the cost_matrix must be numbers (int or float). Found type {type(val)} at [{i}][{j}].") + + # 2. Create Temporary Script + # The script uses the munkres library to perform the computation. + script_content = f""" +import sys +from munkres import Munkres + +# The user's matrix is safely injected here after validation +matrix = {parsed_matrix} + +try: + print('cost matrix') + for row in matrix: + # Format rows for clear output + print(str(row)) + + m = Munkres() + # The compute method can modify the matrix, so a copy is implicitly used + # by passing the literal value into the script. + indexes = m.compute(matrix) + + total_cost = 0 + original_matrix = {parsed_matrix} # Use original for value lookup + for row, column in indexes: + value = original_matrix[row][column] + total_cost += value + print(f'({{row}}, {{column}}) -> {{value}}') + + print(f'lowest cost={{total_cost}}') + +except ImportError: + print("Error: The 'munkres' library is not installed in the Python environment.", file=sys.stderr) + sys.exit(1) +except Exception as e: + print(f"An error occurred during munkres computation: {{e}}", file=sys.stderr) + sys.exit(1) +""" + + # 3. Subprocess Execution + command_executed = "" + temp_script_path = "" + try: + with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as temp_script: + temp_script.write(script_content) + temp_script_path = temp_script.name + + cmd = ["python", temp_script_path] + command_executed = " ".join(cmd) + + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True + ) + + except subprocess.CalledProcessError as e: + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": "python .py", + "stdout": "", + "stderr": "Error: 'python' executable not found. Please ensure Python is installed and in your PATH.", + "output_files": [] + } + finally: + # Clean up the temporary file + if temp_script_path and Path(temp_script_path).exists(): + Path(temp_script_path).unlink() + + # 4. Return Structured Output + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [] + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..1ee2bdab40a14647f71c9bb32b73cc4867014fb0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/munkres_server.py') +SERVER_NAME = 'biosci_munkres' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..d595826484b17acc1557b1d47533ed12aa3cca5b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-munkres: + build: . + image: mcp-munkres:latest + container_name: mcp-munkres + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=munkres + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..4b5a1d6838caa4145defbba15cef007c3a2415aa --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - munkres + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_munkres/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_muscle/app/muscle_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_muscle/app/muscle_server.py new file mode 100644 index 0000000000000000000000000000000000000000..82d25af8b5dc4b3d8ae1d48b2b7dd8dcd0887919 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_muscle/app/muscle_server.py @@ -0,0 +1,287 @@ +import subprocess +from pathlib import Path +from typing import Optional, Dict, Literal + +# This is a placeholder for the MCP decorator. +# In a real MCP environment, this would be provided by the framework. +class mcp: + def tool(func): + return func + +@mcp.tool +def muscle_align( + input_file: Path, + output_file: Path, + output_format: Optional[Literal["fasta", "clw", "clwstrict", "html", "msf", "phyi", "phys"]] = None, + max_iters: Optional[int] = None, + max_hours: Optional[float] = None, + stable: bool = False, + group: bool = False, + diags: bool = False, + refine: bool = False, + log_file: Optional[Path] = None, + log_append: bool = False, + quiet: bool = False, + verbose: bool = False, + matrix_file: Optional[Path] = None, + gap_open: Optional[float] = None, + gap_extend: Optional[float] = None, + center: Optional[float] = None, + hydro_factor: Optional[float] = None, + use_tree: Optional[Path] = None, + tree1_file: Optional[Path] = None, + tree2_file: Optional[Path] = None, + distance1: Optional[Literal["kmer6_6", "kmer20_3", "kmer20_4", "kbit20_3", "pctid_kimura", "pctid_log"]] = None, + cluster1: Optional[Literal["upgma", "upgmb", "neighborjoining"]] = None, + weight1: Optional[Literal["none", "henikoff", "henikoffpb", "gsc", "clustalw"]] = None, + root1: bool = False, + outgroup1: Optional[str] = None, + objscore: Optional[Literal["sp", "ps", "dp", "xp", "spf", "spm"]] = None, + max_mb: Optional[int] = None, + no_anchors: bool = False, +) -> Dict: + """ + Performs multiple sequence alignment on a set of sequences using MUSCLE. + + This function can align unaligned sequences or refine an existing alignment. + """ + # --- Input Validation --- + if not input_file.is_file(): + raise FileNotFoundError(f"Input file not found: {input_file}") + if matrix_file and not matrix_file.is_file(): + raise FileNotFoundError(f"Matrix file not found: {matrix_file}") + if use_tree and not use_tree.is_file(): + raise FileNotFoundError(f"User-provided tree file not found: {use_tree}") + if outgroup1 and not root1: + raise ValueError("The 'outgroup1' parameter requires 'root1' to be set to True.") + if log_append and not log_file: + raise ValueError("The 'log_append' parameter requires 'log_file' to be specified.") + if quiet and verbose: + raise ValueError("'quiet' and 'verbose' options are mutually exclusive.") + + # --- File Path Handling --- + output_file.parent.mkdir(parents=True, exist_ok=True) + if log_file: + log_file.parent.mkdir(parents=True, exist_ok=True) + if tree1_file: + tree1_file.parent.mkdir(parents=True, exist_ok=True) + if tree2_file: + tree2_file.parent.mkdir(parents=True, exist_ok=True) + + # --- Command Construction --- + cmd = [ + "muscle", + "-in", str(input_file), + "-out", str(output_file) + ] + + # Output options + if output_format: + cmd.append(f"-{output_format}") + if stable: + cmd.append("-stable") + if group: + cmd.append("-group") + + # Refinement and iteration options + if refine: + cmd.append("-refine") + if max_iters is not None: + cmd.extend(["-maxiters", str(max_iters)]) + if max_hours is not None: + cmd.extend(["-maxhours", str(max_hours)]) + + # Logging and verbosity + if log_file: + log_flag = "-loga" if log_append else "-log" + cmd.extend([log_flag, str(log_file)]) + if quiet: + cmd.append("-quiet") + if verbose: + cmd.append("-verbose") + + # Scoring options + if matrix_file: + cmd.extend(["-matrix", str(matrix_file)]) + if gap_open is not None: + cmd.extend(["-gapopen", str(gap_open)]) + if gap_extend is not None: + cmd.extend(["-gapextend", str(gap_extend)]) + if center is not None: + cmd.extend(["-center", str(center)]) + if hydro_factor is not None: + cmd.extend(["-hydrofactor", str(hydro_factor)]) + if objscore: + cmd.extend(["-objscore", objscore]) + + # Tree-making options + if use_tree: + cmd.extend(["-usetree", str(use_tree)]) + if tree1_file: + cmd.extend(["-tree1", str(tree1_file)]) + if tree2_file: + cmd.extend(["-tree2", str(tree2_file)]) + if distance1: + cmd.extend(["-distance1", distance1]) + if cluster1: + cmd.extend(["-cluster1", cluster1]) + if weight1: + cmd.extend(["-weight1", weight1]) + if root1: + cmd.append("-root1") + if outgroup1: + cmd.extend(["-outgroup1", outgroup1]) + + # Speed and memory options + if diags: + cmd.append("-diags") + if max_mb is not None: + cmd.extend(["-maxmb", str(max_mb)]) + if no_anchors: + cmd.append("-noanchors") + + # --- Subprocess Execution --- + try: + process = subprocess.run( + cmd, + check=True, + capture_output=True, + text=True, + ) + + output_files = {"alignment_file": str(output_file)} + if tree1_file: + output_files["tree1_file"] = str(tree1_file) + if tree2_file: + output_files["tree2_file"] = str(tree2_file) + if log_file: + output_files["log_file"] = str(log_file) + + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": "MUSCLE execution failed.", + "stdout": e.stdout, + "stderr": e.stderr, + "return_code": e.returncode, + } + +@mcp.tool +def muscle_profile_align( + input1_file: Path, + input2_file: Path, + output_file: Path, + stable: bool = False, + max_iters: Optional[int] = None, + max_hours: Optional[float] = None, + log_file: Optional[Path] = None, + log_append: bool = False, + quiet: bool = False, + verbose: bool = False, + matrix_file: Optional[Path] = None, + gap_open: Optional[float] = None, + gap_extend: Optional[float] = None, + center: Optional[float] = None, + core: bool = False, + term_gaps: Optional[Literal["full", "half", "halflonger"]] = None, + use_tree: Optional[Path] = None, +) -> Dict: + """ + Performs profile-profile alignment of two existing alignments using MUSCLE. + """ + # --- Input Validation --- + if not input1_file.is_file(): + raise FileNotFoundError(f"Input file 1 not found: {input1_file}") + if not input2_file.is_file(): + raise FileNotFoundError(f"Input file 2 not found: {input2_file}") + if matrix_file and not matrix_file.is_file(): + raise FileNotFoundError(f"Matrix file not found: {matrix_file}") + if use_tree and not use_tree.is_file(): + raise FileNotFoundError(f"User-provided tree file not found: {use_tree}") + if log_append and not log_file: + raise ValueError("The 'log_append' parameter requires 'log_file' to be specified.") + if quiet and verbose: + raise ValueError("'quiet' and 'verbose' options are mutually exclusive.") + + # --- File Path Handling --- + output_file.parent.mkdir(parents=True, exist_ok=True) + if log_file: + log_file.parent.mkdir(parents=True, exist_ok=True) + + # --- Command Construction --- + cmd = [ + "muscle", + "-profile", + "-in1", str(input1_file), + "-in2", str(input2_file), + "-out", str(output_file) + ] + + # General options + if stable: + cmd.append("-stable") + if max_iters is not None: + cmd.extend(["-maxiters", str(max_iters)]) + if max_hours is not None: + cmd.extend(["-maxhours", str(max_hours)]) + + # Logging and verbosity + if log_file: + log_flag = "-loga" if log_append else "-log" + cmd.extend([log_flag, str(log_file)]) + if quiet: + cmd.append("-quiet") + if verbose: + cmd.append("-verbose") + + # Scoring options + if matrix_file: + cmd.extend(["-matrix", str(matrix_file)]) + if gap_open is not None: + cmd.extend(["-gapopen", str(gap_open)]) + if gap_extend is not None: + cmd.extend(["-gapextend", str(gap_extend)]) + if center is not None: + cmd.extend(["-center", str(center)]) + + # Profile-specific options + if core: + cmd.append("-core") + if term_gaps: + cmd.append(f"-termgaps{term_gaps}") + if use_tree: + cmd.extend(["-usetree", str(use_tree)]) + + # --- Subprocess Execution --- + try: + process = subprocess.run( + cmd, + check=True, + capture_output=True, + text=True, + ) + + output_files = {"alignment_file": str(output_file)} + if log_file: + output_files["log_file"] = str(log_file) + + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": "MUSCLE profile alignment failed.", + "stdout": e.stdout, + "stderr": e.stderr, + "return_code": e.returncode, + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..108210955e07a168ada96697893706684f14a350 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install ngmlr via conda (e.g., from bioconda) +RUN conda install -c bioconda ngmlr -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/ngmlr_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/ngmlr_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/ngmlr_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_server.py new file mode 100644 index 0000000000000000000000000000000000000000..9edd505b8bb11aeff1b19ffa76268af71f8a5fdf --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_server.py @@ -0,0 +1,206 @@ +import subprocess +import shutil +from pathlib import Path +from typing import Optional + +# Assume mcp is imported from the execution environment +# import mcp + +class mcp: + """A dummy class to mock the mcp.tool decorator for standalone execution.""" + @staticmethod + def tool(): + def decorator(f): + return f + return decorator + +@mcp.tool() +def ngmlr_map( + reference: Path, + query: Path, + output: Optional[Path] = None, + bam_fix: bool = False, + threads: int = 1, + presets: Optional[str] = None, + min_identity: float = 0.65, + min_residues: int = 250, + no_small_subreads: bool = False, + verbose: bool = False, + sensitivity: Optional[float] = None, + kmer_length: Optional[int] = None, + kmer_skip: Optional[int] = None, + bin_size: Optional[int] = None, + subread_length: int = 4500, + subread_corridor: int = 20, + max_segments: int = 16, + max_span: int = 200000, + no_low_quality_split: bool = False, + no_trimming: bool = False, + no_large_indels: bool = False, + no_progress: bool = False, + match_score: float = 2.0, + mismatch_score: float = -5.0, + gap_open_score: float = -5.0, + gap_extend_max_score: float = -5.0, + gap_extend_min_score: float = -1.0, +): + """ + Aligns long reads (e.g., PacBio or Oxford Nanopore) to a reference genome using ngmlr. + + ngmlr is a long-read mapper designed to align PacBio or Oxford Nanopore reads + and is optimized to find structural variations. + + Args: + reference: Path to the reference genome (FASTA format, can be gzipped). + query: Path to the read file (FASTQ or FASTA format, can be gzipped). + output: Path to the output file (SAM/BAM format). If not set, output is written to stdout (SAM) or 'ngmlr-output.bam' (if bam_fix is True). + bam_fix: Writes BAM instead of SAM. Requires samtools in the system's PATH. + threads: Number of threads to use. + presets: Set options for a specific sequencing technology ('pacbio' or 'ont'). + min_identity: Alignments with an identity below this threshold will be discarded. + min_residues: Alignments containing less than this number of residues will be discarded. + no_small_subreads: Do not align reads < 500bp (PacBio only). + verbose: Print debug information. + sensitivity: An increased sensitivity improves alignment accuracy at the cost of runtime. + kmer_length: K-mer length in bases (max. 15). + kmer_skip: Number of k-mers to skip when building the lookup table. + bin_size: The reference is divided into bins of this size to speed up the lookup. + subread_length: The average subread length. + subread_corridor: The number of bases searched around the position of the next k-mer. + max_segments: Max number of segments per read to align. + max_span: Max distance between first and last segment on the reference. + no_low_quality_split: Don't split alignments based on the quality values of the read. + no_trimming: Don't trim alignments at the start/end to remove poor alignments. + no_large_indels: Don't search for large indels. + no_progress: Don't print progress info to stderr. + match_score: Score for a match. + mismatch_score: Score for a mismatch. + gap_open_score: Score for opening a gap. + gap_extend_max_score: Maximum score for extending a gap. + gap_extend_min_score: Minimum score for extending a gap. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output files. + """ + # --- Input Validation --- + if not shutil.which("ngmlr"): + raise RuntimeError("ngmlr executable not found in PATH.") + if bam_fix and not shutil.which("samtools"): + raise RuntimeError("samtools executable not found in PATH, but is required for --bam-fix.") + + if not reference.is_file(): + raise FileNotFoundError(f"Reference file not found: {reference}") + if not query.is_file(): + raise FileNotFoundError(f"Query file not found: {query}") + + if threads <= 0: + raise ValueError("Number of threads must be a positive integer.") + if presets and presets not in ["pacbio", "ont"]: + raise ValueError("Presets must be either 'pacbio' or 'ont'.") + if not (0.0 <= min_identity <= 1.0): + raise ValueError("min_identity must be between 0.0 and 1.0.") + if min_residues < 0: + raise ValueError("min_residues must be a non-negative integer.") + if sensitivity is not None and not (0.0 <= sensitivity <= 1.0): + raise ValueError("sensitivity must be between 0.0 and 1.0.") + if kmer_length is not None and (kmer_length <= 0 or kmer_length > 15): + raise ValueError("kmer_length must be between 1 and 15.") + + # --- Command Construction --- + cmd = [ + "ngmlr", + "-r", str(reference), + "-q", str(query), + ] + + output_files = [] + # Handle output file logic + if output: + cmd.extend(["-o", str(output)]) + output_files.append(str(output)) + elif bam_fix: + # As per docs, if -o is not set and --bam-fix is used, it creates 'ngmlr-output.bam' + default_bam_output = Path("ngmlr-output.bam") + cmd.extend(["-o", str(default_bam_output)]) + output_files.append(str(default_bam_output)) + + if bam_fix: + cmd.append("--bam-fix") + + # General options + if threads != 1: + cmd.extend(["-t", str(threads)]) + if presets: + cmd.extend(["-x", presets]) + if min_identity != 0.65: + cmd.extend(["-i", str(min_identity)]) + if min_residues != 250: + cmd.extend(["-R", str(min_residues)]) + if no_small_subreads: + cmd.append("--no-small-subreads") + if verbose: + cmd.append("--verbose") + + # Advanced options + if sensitivity is not None: + cmd.extend(["-s", str(sensitivity)]) + if kmer_length is not None: + cmd.extend(["-k", str(kmer_length)]) + if kmer_skip is not None: + cmd.extend(["--kmer-skip", str(kmer_skip)]) + if bin_size is not None: + cmd.extend(["--bin-size", str(bin_size)]) + if subread_length != 4500: + cmd.extend(["--subread-length", str(subread_length)]) + if subread_corridor != 20: + cmd.extend(["--subread-corridor", str(subread_corridor)]) + if max_segments != 16: + cmd.extend(["--max-segments", str(max_segments)]) + if max_span != 200000: + cmd.extend(["--max-span", str(max_span)]) + if no_low_quality_split: + cmd.append("--no-low-quality-split") + if no_trimming: + cmd.append("--no-trimming") + if no_large_indels: + cmd.append("--no-large-indels") + if no_progress: + cmd.append("--no-progress") + + # Scoring options + if match_score != 2.0: + cmd.extend(["--match", str(match_score)]) + if mismatch_score != -5.0: + cmd.extend(["--mismatch", str(mismatch_score)]) + if gap_open_score != -5.0: + cmd.extend(["--gap-open", str(gap_open_score)]) + if gap_extend_max_score != -5.0: + cmd.extend(["--gap-extend-max", str(gap_extend_max_score)]) + if gap_extend_min_score != -1.0: + cmd.extend(["--gap-extend-min", str(gap_extend_min_score)]) + + command_str = " ".join(cmd) + + # --- Subprocess Execution --- + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True, + ) + return { + "command_executed": command_str, + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + # Return a structured error response + return { + "command_executed": command_str, + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "error": f"ngmlr failed with exit code {e.returncode}", + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e19c8d7c025dd64602af8dde71ad14f57f431e72 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/ngmlr_server.py') +SERVER_NAME = 'biosci_ngmlr' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..1104a8ab4c8cda759960497560d6aa47e5b5375c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-ngmlr: + build: . + image: mcp-ngmlr:latest + container_name: mcp-ngmlr + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=ngmlr + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..55d2c98d2f67182ac3d3da0b67690e241418bd7b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - ngmlr + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ngmlr/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-bioperl-run/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-bioperl-run/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-bioperl-run/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2fb2b024e75dd457b12766e3717990f30d71d739 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-date-format via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-date-format -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-date-format_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-date-format_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-date-format_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_server.py new file mode 100644 index 0000000000000000000000000000000000000000..768e2ed179ecf70fb0c1a0822f85199f3a8d6335 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_server.py @@ -0,0 +1,232 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any + +# In a real MCP environment, the 'mcp' object with the '.tool' decorator +# would be provided by the framework. +# from mcp import mcp + +# This is a placeholder for demonstration purposes. +class _MCP: + def tool(self): + def decorator(func): + return func + return decorator +mcp = _MCP() + + +@mcp.tool() +def perl_interpreter( + programfile: Optional[Path] = None, + arguments: Optional[List[str]] = None, + program: Optional[str] = None, + program_with_features: Optional[str] = None, + check_syntax_only: bool = False, + print_version: bool = False, + print_config: Optional[str] = None, + record_separator: Optional[str] = None, + autosplit: bool = False, + unicode_features: Optional[str] = None, + debugger: Optional[str] = None, + debugging_flags: Optional[str] = None, + no_sitecustomize: bool = False, + split_pattern: Optional[str] = None, + in_place_edit: Optional[str] = None, + include_directories: Optional[List[Path]] = None, + line_ending_processing: Optional[str] = None, + use_modules: Optional[List[str]] = None, + no_modules: Optional[List[str]] = None, + loop_around_program: bool = False, + loop_and_print: bool = False, + parse_switches: bool = False, + search_path: bool = False, + tainting_warnings: bool = False, + tainting_checks: bool = False, + dump_core: bool = False, + unsafe_operations: bool = False, + enable_warnings: bool = False, + enable_all_warnings: bool = False, + disable_all_warnings: bool = False, + ignore_text_before_shebang: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Executes a Perl script or a one-liner program using the Perl interpreter. + + This tool is a wrapper around the `perl` command-line executable, providing access + to its various switches for script execution, syntax checking, debugging, and more. + The tool name 'perl-date-format' refers to the Conda package that provides the + Perl interpreter and associated modules, but this function directly calls `perl`. + + Args: + programfile: Path to the Perl program file to execute. + arguments: List of arguments to pass to the program file. + program: A one-line Perl program to execute (corresponds to the -e switch). + program_with_features: Like 'program', but enables all optional features (-E). + check_syntax_only: Check syntax only; does not execute the program (-c). + print_version: Print the version, patchlevel, and license of Perl (-v). + print_config: Print configuration summary or a single variable (-V[:variable]). + record_separator: Specify the record separator character (-0[octal]). + autosplit: Enable autosplit mode with -n or -p, splitting $_ into @F (-a). + unicode_features: Enable listed Unicode features (-C[number/list]). + debugger: Run the program under the specified debugger (-d[:debugger]). + debugging_flags: Set debugging flags (-D[number/list]). + no_sitecustomize: Don't run $sitelib/sitecustomize.pl at startup (-f). + split_pattern: Specify the split() pattern for the -a switch (-F/pattern/). + in_place_edit: Edit files in place, with an optional backup extension (-i[extension]). + include_directories: List of directories to add to @INC (-I). + line_ending_processing: Enable line ending processing (-l[octal]). + use_modules: List of modules to 'use' before executing the program (-M). + no_modules: List of modules to 'no' before executing the program (-m). + loop_around_program: Assume a "while (<>) { ... }" loop around the program (-n). + loop_and_print: Like -n, but also prints the line, similar to sed (-p). + parse_switches: Enable rudimentary parsing for switches after the program file (-s). + search_path: Look for the program file using the PATH environment variable (-S). + tainting_warnings: Enable tainting warnings (-t). + tainting_checks: Enable tainting checks (-T). + dump_core: Dump core after parsing the program (-u). + unsafe_operations: Allow unsafe operations (-U). + enable_warnings: Enable many useful warnings (-w). + enable_all_warnings: Enable all warnings (-W). + disable_all_warnings: Disable all warnings (-X). + ignore_text_before_shebang: Ignore text before #!perl line, optionally cd to a directory (-x[directory]). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any error information. + """ + # --- Input Validation --- + primary_action_count = sum([ + program is not None, + program_with_features is not None, + programfile is not None, + print_version, + print_config is not None + ]) + + if primary_action_count == 0 and not check_syntax_only: + raise ValueError("An action is required. Please specify 'programfile', 'program', 'program_with_features', 'print_version', 'print_config', or set 'check_syntax_only' to True with a program source.") + + if primary_action_count > 1: + raise ValueError("Only one of 'programfile', 'program', 'program_with_features', 'print_version', or 'print_config' can be specified at a time.") + + if check_syntax_only and not any([program is not None, program_with_features is not None, programfile is not None]): + raise ValueError("'check_syntax_only' requires a program source ('programfile', 'program', or 'program_with_features').") + + if programfile and not programfile.is_file(): + raise FileNotFoundError(f"The specified program file does not exist: {programfile}") + + if loop_around_program and loop_and_print: + raise ValueError("Cannot specify both 'loop_around_program' (-n) and 'loop_and_print' (-p).") + + if sum([enable_warnings, enable_all_warnings, disable_all_warnings]) > 1: + raise ValueError("Only one of 'enable_warnings' (-w), 'enable_all_warnings' (-W), or 'disable_all_warnings' (-X) can be specified.") + + # --- Command Construction --- + cmd = ["perl"] + + if record_separator is not None: + cmd.append(f"-0{record_separator}") + if autosplit: + cmd.append("-a") + if unicode_features is not None: + cmd.append(f"-C{unicode_features}") + if check_syntax_only: + cmd.append("-c") + if debugger is not None: + cmd.append(f"-d:{debugger}" if debugger else "-d") + if debugging_flags is not None: + cmd.append(f"-D{debugging_flags}") + if program is not None: + cmd.extend(["-e", program]) + if program_with_features is not None: + cmd.extend(["-E", program_with_features]) + if no_sitecustomize: + cmd.append("-f") + if split_pattern is not None: + cmd.append(f"-F{split_pattern}") + if in_place_edit is not None: + cmd.append(f"-i{in_place_edit}") + if include_directories: + for directory in include_directories: + cmd.extend(["-I", str(directory)]) + if line_ending_processing is not None: + cmd.append(f"-l{line_ending_processing}") + if use_modules: + for module in use_modules: + cmd.extend(["-M", module]) + if no_modules: + for module in no_modules: + cmd.extend(["-m", module]) + if loop_around_program: + cmd.append("-n") + if loop_and_print: + cmd.append("-p") + if parse_switches: + cmd.append("-s") + if search_path: + cmd.append("-S") + if tainting_warnings: + cmd.append("-t") + if tainting_checks: + cmd.append("-T") + if dump_core: + cmd.append("-u") + if unsafe_operations: + cmd.append("-U") + if print_version: + cmd.append("-v") + if print_config is not None: + cmd.append(f"-V:{print_config}" if print_config else "-V") + if enable_warnings: + cmd.append("-w") + if enable_all_warnings: + cmd.append("-W") + if disable_all_warnings: + cmd.append("-X") + if ignore_text_before_shebang is not None: + cmd.append(f"-x{ignore_text_before_shebang}" if ignore_text_before_shebang.name else "-x") + + if programfile: + cmd.append(str(programfile)) + if arguments: + cmd.extend(arguments) + + # --- Subprocess Execution --- + command_executed = " ".join(map(str, cmd)) + try: + result = subprocess.run( + cmd, + capture_output=True, + text=True, + check=False # We check the return code manually to provide better error context + ) + + if result.returncode != 0: + return { + "error": "Perl execution failed with a non-zero exit code.", + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + "return_code": result.returncode, + } + + except FileNotFoundError: + return { + "error": "Perl executable not found. Please ensure 'perl' is in your system's PATH.", + "command_executed": command_executed, + "stdout": "", + "stderr": "FileNotFoundError: 'perl' not found.", + } + except Exception as e: + return { + "error": f"An unexpected error occurred: {str(e)}", + "command_executed": command_executed, + "stdout": "", + "stderr": str(e), + } + + # --- Structured Result Return --- + return { + "command_executed": command_executed, + "stdout": result.stdout, + "stderr": result.stderr, + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..329433a8e5ed62162d1617bfadbe0b0ef426a3cc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/perl-date-format_server.py') +SERVER_NAME = 'biosci_perl_date_format' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..bae27f7a8df6ca7238aba222ce01fc93252287a4 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-date-format: + build: . + image: mcp-perl-date-format:latest + container_name: mcp-perl-date-format + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-date-format + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bb89efb4faf2c5c50b2ebc44b9a898e77582f24e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-date-format + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-date-format/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e61d4aa9368865cf804228cd6424a174f3730800 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-html-tableextract via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-html-tableextract -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-html-tableextract_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-html-tableextract_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-html-tableextract_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_server.py new file mode 100644 index 0000000000000000000000000000000000000000..96e41d0ebd5bd430499a807e09d43079913e0448 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_server.py @@ -0,0 +1,245 @@ +from pathlib import Path +import subprocess +import tempfile +from typing import Optional, List, Dict + +@mcp.tool() +def extract_tables( + input_file: str, + headers: Optional[List[str]] = None, + depth: Optional[int] = None, + count: Optional[int] = None, + attribs: Optional[Dict[str, str]] = None, + automap: bool = True, + slice_columns: bool = True, + keep_headers: bool = False, + gridmap: bool = True, + subtables: bool = False, + decode: bool = True, + br_translate: bool = True, + keep_html: bool = False, + strip_html_on_match: bool = True, + tree_mode: bool = False, +): + """ + Extracts table content from an HTML document using Perl's HTML::TableExtract. + + Args: + input_file: Path to the HTML file to parse. + headers: List of column headers to match. Only columns under these headers will be extracted. + depth: Specify how deeply nested the table is (0 for top-level). + count: Specify the n-th table at a particular depth (starting from 0). + attribs: Dictionary of HTML attributes the tag must have (e.g., {"border": "1"}). + automap: If True, rearranges columns to match the order of 'headers' provided. + slice_columns: If True, only returns columns that matched a header. + keep_headers: If True, includes the header row in the output data. + gridmap: If True, compensates for ROWSPAN and COLSPAN to maintain a grid structure. + subtables: If True, extracts tables nested within matched tables. + decode: If True, decodes HTML entities in the extracted text. + br_translate: If True, translates
tags into newlines. + keep_html: If True, returns raw HTML from cells instead of plain text. + strip_html_on_match: If True, strips HTML from headers before attempting to match. + tree_mode: If True, uses tree extraction mode (HTML::TreeBuilder based). + """ + # Input validation + input_path = Path(input_file) + if not input_path.exists(): + return {"error": f"Input file not found: {input_file}"} + + if depth is not None and depth < 0: + return {"error": "Depth must be a non-negative integer."} + if count is not None and count < 0: + return {"error": "Count must be a non-negative integer."} + + # Construct Perl script + perl_import = "use HTML::TableExtract qw(tree);" if tree_mode else "use HTML::TableExtract;" + + # Build constructor options + opts = [] + if headers: + h_str = ", ".join([f"'{h}'" for h in headers]) + opts.append(f"headers => [{h_str}]") + if depth is not None: + opts.append(f"depth => {depth}") + if count is not None: + opts.append(f"count => {count}") + if attribs: + attr_str = ", ".join([f"'{k}' => '{v}'" for k, v in attribs.items()]) + opts.append(f"attribs => {{ {attr_str} }}") + + opts.append(f"automap => {1 if automap else 0}") + opts.append(f"slice_columns => {1 if slice_columns else 0}") + opts.append(f"keep_headers => {1 if keep_headers else 0}") + opts.append(f"gridmap => {1 if gridmap else 0}") + opts.append(f"subtables => {1 if subtables else 0}") + opts.append(f"decode => {1 if decode else 0}") + opts.append(f"br_translate => {1 if br_translate else 0}") + opts.append(f"keep_html => {1 if keep_html else 0}") + opts.append(f"strip_html_on_match => {1 if strip_html_on_match else 0}") + + opts_joined = ", ".join(opts) + + perl_script = f""" +{perl_import} +my $te = HTML::TableExtract->new({opts_joined}); +$te->parse_file('{input_path.absolute()}'); + +foreach my $ts ($te->tables) {{ + print "---TABLE_START--- Coords: ", join(',', $ts->coords), "\\n"; + foreach my $row ($ts->rows) {{ + print join("\\t", map {{ defined $_ ? $_ : '' }} @$row), "\\n"; + }} +}} +""" + + try: + with tempfile.NamedTemporaryFile(mode='w', suffix='.pl', delete=False) as tmp: + tmp.write(perl_script) + tmp_path = tmp.name + + cmd = ["perl", tmp_path] + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + + # Cleanup + Path(tmp_path).unlink() + + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "description": "Tables extracted successfully. Tables are delimited by '---TABLE_START---' and columns by tabs." + } + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": "Perl execution failed." + } + except Exception as e: + return {"error": str(e)} + +@mcp.tool() +def extract_tables_report( + input_file: str, + show_content: bool = False, + col_sep: str = ":", + headers: Optional[List[str]] = None, + depth: Optional[int] = None, + count: Optional[int] = None, + attribs: Optional[Dict[str, str]] = None, +): + """ + Generates a summary report of tables found in an HTML document. + + Args: + input_file: Path to the HTML file to parse. + show_content: If True, includes the extracted content of each table in the report. + col_sep: Column separator to use if show_content is True. + headers: List of column headers to match. + depth: Specify table depth. + count: Specify table count at depth. + attribs: Dictionary of HTML attributes for the table tag. + """ + input_path = Path(input_file) + if not input_path.exists(): + return {"error": f"Input file not found: {input_file}"} + + # Build constructor options + opts = [] + if headers: + h_str = ", ".join([f"'{h}'" for h in headers]) + opts.append(f"headers => [{h_str}]") + if depth is not None: + opts.append(f"depth => {depth}") + if count is not None: + opts.append(f"count => {count}") + if attribs: + attr_str = ", ".join([f"'{k}' => '{v}'" for k, v in attribs.items()]) + opts.append(f"attribs => {{ {attr_str} }}") + + opts_joined = ", ".join(opts) + show_content_val = 1 if show_content else 0 + + perl_script = f""" +use HTML::TableExtract; +my $te = HTML::TableExtract->new({opts_joined}); +$te->parse_file('{input_path.absolute()}'); +print $te->tables_report({show_content_val}, '{col_sep}'); +""" + + try: + with tempfile.NamedTemporaryFile(mode='w', suffix='.pl', delete=False) as tmp: + tmp.write(perl_script) + tmp_path = tmp.name + + cmd = ["perl", tmp_path] + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + + Path(tmp_path).unlink() + + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr + } + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": "Perl execution failed." + } + except Exception as e: + return {"error": str(e)} + +@mcp.tool() +def get_table_dimensions(input_file: str): + """ + Returns a list of all table coordinates (depth and count) found in the HTML document. + + Args: + input_file: Path to the HTML file. + """ + input_path = Path(input_file) + if not input_path.exists(): + return {"error": f"Input file not found: {input_file}"} + + perl_script = f""" +use HTML::TableExtract; +my $te = HTML::TableExtract->new(); +$te->parse_file('{input_path.absolute()}'); +foreach my $ts ($te->tables) {{ + print join(',', $ts->coords), "\\n"; +}} +""" + + try: + with tempfile.NamedTemporaryFile(mode='w', suffix='.pl', delete=False) as tmp: + tmp.write(perl_script) + tmp_path = tmp.name + + cmd = ["perl", tmp_path] + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + + Path(tmp_path).unlink() + + coords = [line.strip() for line in result.stdout.splitlines() if line.strip()] + + return { + "command_executed": " ".join(cmd), + "table_coordinates": coords, + "description": "Each coordinate is in the format 'depth,count'." + } + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": "Perl execution failed." + } + except Exception as e: + return {"error": str(e)} diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..8f33e8630049e3e20dd46bdf86279e36ecb53b36 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/perl-html-tableextract_server.py') +SERVER_NAME = 'biosci_perl_html_tableextract' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..a531c9fb1d32a4f3ca9be78e47323b6381d9e014 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-html-tableextract: + build: . + image: mcp-perl-html-tableextract:latest + container_name: mcp-perl-html-tableextract + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-html-tableextract + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b119beb2fc45b0251f11e7e704b4ed988a8d192f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-html-tableextract + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tableextract/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..8d95b3b821bc82e0b959696e7ace988aedaea6d0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-html-tagset via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-html-tagset -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-html-tagset_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-html-tagset_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-html-tagset_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/perl-html-tagset_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/perl-html-tagset_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..ecf39e39eae98426e9eb5bce85a256ebcca0165f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/perl-html-tagset_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/perl-html-tagset_server.py') +SERVER_NAME = 'biosci_perl_html_tagset' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..0f0e0bdbb2ecc594d6cada9070ecf2fd9e336a55 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-html-tagset: + build: . + image: mcp-perl-html-tagset:latest + container_name: mcp-perl-html-tagset + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-html-tagset + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..faa578d74d37f4de05348aecb6b14000984148c7 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-html-tagset + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-html-tagset/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..5bdca216be47b186b08ec6224d6ae0e0e377f84f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-http-date via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-http-date -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-http-date_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-http-date_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-http-date_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..e7959f3bed2e3def9a44804f7a4da596ea00eefb --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-http-date/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-http-date: + build: . + image: mcp-perl-http-date:latest + container_name: mcp-perl-http-date + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-http-date + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..579757d7023147b4e4c00eb8bb2ba13bf8d4e236 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-lwp-mediatypes via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-lwp-mediatypes -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-lwp-mediatypes_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-lwp-mediatypes_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-lwp-mediatypes_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_server.py new file mode 100644 index 0000000000000000000000000000000000000000..30466ef05f96e39d3426e913866f28d5f2b3dd19 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_server.py @@ -0,0 +1,248 @@ +import subprocess +import json +from pathlib import Path +from typing import List, Optional, Dict, Union, Any + +# Helper function to run Perl scripts +def _run_perl_script(script_content: str, args: List[str]) -> Dict[str, Any]: + """ + Executes a Perl script with given arguments and captures output. + """ + command = ["perl", "-MJSON", "-e", script_content, *args] + + try: + result = subprocess.run( + command, + capture_output=True, + text=True, + check=True + ) + + stdout_data = result.stdout.strip() + stderr_data = result.stderr.strip() + + # Attempt to parse JSON output if available + parsed_output = {} + if stdout_data: + try: + parsed_output = json.loads(stdout_data) + except json.JSONDecodeError: + # If stdout is not JSON, return it as raw_stdout + parsed_output = {"raw_stdout": stdout_data} + + return { + "command_executed": " ".join(command), + "stdout": parsed_output, + "stderr": stderr_data, + "output_files": [], + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout.strip(), + "stderr": e.stderr.strip(), + "error": str(e), + "returncode": e.returncode, + "output_files": [], + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "Error: 'perl' command not found. Ensure Perl is installed and in your PATH.", + "error": "Perl executable not found", + "returncode": 127, + "output_files": [], + } + + +@mcp.tool() +def guess_media_type_for_file_or_url( + file_or_url: str, +) -> Dict[str, Any]: + """ + Guesses the media type and encoding for a given file path or URL. + + This function uses the LWP::MediaTypes Perl module's guess_media_type function + to determine the content type and any associated content encodings. + + Args: + file_or_url: The path to a file or a URL string for which to guess the media type. + + Returns: + A dictionary containing the command executed, stdout (parsed JSON with + 'content_type' and 'content_encodings'), stderr, and any output files. + The 'content_type' will be a string like "text/html", and 'content_encodings' + will be a list of strings (e.g., ["gzip"]). If the type cannot be deduced, + it might return "text/plain" or "application/octet-stream". + """ + if not file_or_url: + raise ValueError("file_or_url cannot be empty.") + + perl_script = """ + use LWP::MediaTypes qw(guess_media_type); + use JSON; + my $input = shift @ARGV; + my ($type, @encodings) = guess_media_type($input); + my %result = ( + "content_type" => $type, + "content_encodings" => \\@encodings + ); + print encode_json(\\%result) . "\\n"; + """ + return _run_perl_script(perl_script, [file_or_url]) + + +@mcp.tool() +def get_media_suffixes( + media_types: List[str], +) -> Dict[str, Any]: + """ + Returns all file suffixes that can be used to denote the specified media type(s). + + Wildcard types (e.g., 'image/*') are supported. In a scalar context (which is + how the Perl script will effectively operate for a single type), it would return + the first suffix found. This tool returns all suffixes found for all provided types. + + Args: + media_types: A list of media type strings (e.g., ["image/*", "audio/basic", "text/html"]). + + Returns: + A dictionary containing the command executed, stdout (parsed JSON with + a 'suffixes' list), stderr, and any output files. + """ + if not media_types: + raise ValueError("media_types list cannot be empty.") + if not all(isinstance(mt, str) and mt for mt in media_types): + raise ValueError("All media_types must be non-empty strings.") + + perl_script = """ + use LWP::MediaTypes qw(media_suffix); + use JSON; + my @types = @ARGV; + my @suffixes = media_suffix(@types); + my %result = ( + "suffixes" => \\@suffixes + ); + print encode_json(\\%result) . "\\n"; + """ + return _run_perl_script(perl_script, media_types) + + +@mcp.tool() +def add_media_type_mapping( + media_type: str, + extensions: List[str], +) -> Dict[str, Any]: + """ + Associates a list of file extensions with a given media type. + + This mapping is temporary and only applies to the current Perl process execution. + Subsequent calls to other LWP::MediaTypes functions within the same process + might use this new mapping, but each MCP tool call runs in a new process. + + Args: + media_type: The media type string (e.g., "x-world/x-vrml"). + extensions: A list of file extensions (e.g., ["wrl", "vrml"]). + + Returns: + A dictionary confirming the operation, including the command executed, + stdout (parsed JSON with 'status' and 'message'), stderr, and output files. + """ + if not media_type: + raise ValueError("media_type cannot be empty.") + if not isinstance(media_type, str): + raise TypeError("media_type must be a string.") + if not extensions: + raise ValueError("extensions list cannot be empty.") + if not all(isinstance(ext, str) and ext for ext in extensions): + raise ValueError("All extensions must be non-empty strings.") + + perl_script = """ + use LWP::MediaTypes qw(add_type); + use JSON; + my $type = shift @ARGV; + my @exts = @ARGV; + add_type($type => @exts); + print encode_json({"status" => "success", "message" => "Type added: $type with extensions " . join(", ", @exts)}) . "\\n"; + """ + return _run_perl_script(perl_script, [media_type, *extensions]) + + +@mcp.tool() +def add_encoding_mapping( + encoding_type: str, + extensions: List[str], +) -> Dict[str, Any]: + """ + Associates a list of file extensions with an encoding type. + + This mapping is temporary and only applies to the current Perl process execution. + Subsequent calls to other LWP::MediaTypes functions within the same process + might use this new mapping, but each MCP tool call runs in a new process. + + Args: + encoding_type: The encoding type string (e.g., "x-gzip"). + extensions: A list of file extensions (e.g., ["gz"]). + + Returns: + A dictionary confirming the operation, including the command executed, + stdout (parsed JSON with 'status' and 'message'), stderr, and output files. + """ + if not encoding_type: + raise ValueError("encoding_type cannot be empty.") + if not isinstance(encoding_type, str): + raise TypeError("encoding_type must be a string.") + if not extensions: + raise ValueError("extensions list cannot be empty.") + if not all(isinstance(ext, str) and ext for ext in extensions): + raise ValueError("All extensions must be non-empty strings.") + + perl_script = """ + use LWP::MediaTypes qw(add_encoding); + use JSON; + my $type = shift @ARGV; + my @exts = @ARGV; + add_encoding($type => @exts); + print encode_json({"status" => "success", "message" => "Encoding added: $type with extensions " . join(", ", @exts)}) . "\\n"; + """ + return _run_perl_script(perl_script, [encoding_type, *extensions]) + + +@mcp.tool() +def read_custom_media_types_files( + media_type_files: List[Path], +) -> Dict[str, Any]: + """ + Parses one or more media types definition files and adds the type mappings found there. + + This allows loading custom or additional media type definitions beyond the default + `media.types` or `~/.media.types` files. The effect is temporary for the current + Perl process execution. + + Args: + media_type_files: A list of Path objects pointing to media types definition files. + + Returns: + A dictionary confirming the operation, including the command executed, + stdout (parsed JSON with 'status' and 'message'), stderr, and output files. + """ + if not media_type_files: + raise ValueError("media_type_files list cannot be empty.") + + file_paths_str: List[str] = [] + for f_path in media_type_files: + if not isinstance(f_path, Path): + raise TypeError(f"Expected Path object, got {type(f_path)} for {f_path}") + if not f_path.is_file(): + raise FileNotFoundError(f"Media type file not found: {f_path}") + file_paths_str.append(str(f_path)) + + perl_script = """ + use LWP::MediaTypes qw(read_media_types); + use JSON; + my @files = @ARGV; + read_media_types(@files); + print encode_json({"status" => "success", "message" => "Read media types from files: " . join(", ", @files)}) . "\\n"; + """ + return _run_perl_script(perl_script, file_paths_str) \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..f5f0a5f633a2e6e89f222ca7ea43fd1db8de053b --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/perl-lwp-mediatypes_server.py') +SERVER_NAME = 'biosci_perl_lwp_mediatypes' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..0a9e7c60dcd8146399c76ecff94eb39255914a6d --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-lwp-mediatypes: + build: . + image: mcp-perl-lwp-mediatypes:latest + container_name: mcp-perl-lwp-mediatypes + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-lwp-mediatypes + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..be8064aa5baa3cef92236097504a1e81db09e832 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-lwp-mediatypes + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-lwp-mediatypes/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7ad644bd6a34be129a6c4253b75f5fa224205512 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-pod-escapes via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-pod-escapes -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-pod-escapes_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-pod-escapes_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-pod-escapes_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_server.py new file mode 100644 index 0000000000000000000000000000000000000000..2dbf356377a38cb8d6372b69ddbffec1c5818751 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_server.py @@ -0,0 +1,240 @@ +import subprocess +from pathlib import Path +from typing import List, Optional, Dict, Any + +# No need to import mcp, as per instructions. + +@mcp.tool() +def perl_pod_escapes( + program_file: Optional[Path] = None, + program_arguments: Optional[List[str]] = None, + record_separator_octal: Optional[str] = None, + autosplit: bool = False, + unicode_features: Optional[str] = None, + check_syntax_only: bool = False, + debug_mode: Optional[str] = None, + debugging_flags: Optional[str] = None, + execute_program_string: Optional[List[str]] = None, + execute_program_string_extended: Optional[List[str]] = None, + no_sitecustomize: bool = False, + split_pattern: Optional[str] = None, + edit_in_place_extension: Optional[str] = None, + include_directories: Optional[List[Path]] = None, + line_ending_processing: Optional[str] = None, + module_operations: Optional[List[str]] = None, + loop_around_program: bool = False, + loop_and_print: bool = False, + rudimentary_switch_parsing: bool = False, + search_path_for_program: bool = False, + tainting_warnings: bool = False, + tainting_checks: bool = False, + dump_core_on_parse: bool = False, + allow_unsafe_operations: bool = False, + print_version: bool = False, + print_config_summary: Optional[str] = None, + enable_warnings: bool = False, + enable_all_warnings: bool = False, + ignore_text_before_shebang: Optional[str] = None, + disable_all_warnings: bool = False, +) -> Dict[str, Any]: + """ + Executes the Perl interpreter with specified options, running a Perl script + or one-liner. + + This tool provides access to the command-line switches of the 'perl' + interpreter, allowing for flexible execution of Perl programs. + Note: The tool name 'perl_pod_escapes' is used as per the prompt, + but this function actually wraps the 'perl' interpreter. + + Args: + program_file: Path to the Perl script to execute. Required if no + `execute_program_string` or `execute_program_string_extended` + is provided. + program_arguments: Arguments to pass to the Perl script. + record_separator_octal: Specify record separator (e.g., '0' for NUL, '0777' for paragraph mode). + Pass an empty string ('') for just '-0'. + autosplit: Enable autosplit mode with -n or -p (splits $_ into @F). + unicode_features: Enables listed Unicode features (e.g., 'io' for UTF-8 I/O). + check_syntax_only: Check syntax only (runs BEGIN and CHECK blocks). + debug_mode: Run program under debugger. Optionally specify debugger (e.g., ':MyDebugger'). + debugging_flags: Set debugging flags (argument is a bit mask or alphabets). + execute_program_string: One line of program (can be specified multiple times). + execute_program_string_extended: Like -e, but enables all optional features (can be specified multiple times). + no_sitecustomize: Don't do $sitelib/sitecustomize.pl at startup. + split_pattern: split() pattern for -a switch (e.g., '/\\t/'). + edit_in_place_extension: Edit <> files in place. Makes backup if extension supplied (e.g., '.bak'). + Pass an empty string ('') for just '-i'. + include_directories: Specify @INC/#include directory (can be specified multiple times). + line_ending_processing: Enable line ending processing, specifies line terminator (e.g., '0' for chomp). + Pass an empty string ('') for just '-l'. + module_operations: Execute "use/no module..." before executing program (e.g., 'strict', '-warnings'). + Can be specified multiple times. If a module name is provided without '-M' or '-m' prefix, + '-M' will be prepended by default. + loop_around_program: Assume "while (<>) { ... }" loop around program. + loop_and_print: Assume loop like -n but print line also, like sed. + rudimentary_switch_parsing: Enable rudimentary parsing for switches after programfile. + search_path_for_program: Look for programfile using PATH environment variable. + tainting_warnings: Enable tainting warnings. + tainting_checks: Enable tainting checks. + dump_core_on_parse: Dump core after parsing program. + allow_unsafe_operations: Allow unsafe operations. + print_version: Print version, patchlevel and license. + print_config_summary: Print configuration summary (or a single Config.pm variable, e.g., 'archname'). + Pass an empty string ('') for just '-V'. + enable_warnings: Enable many useful warnings. + enable_all_warnings: Enable all warnings. + ignore_text_before_shebang: Ignore text before #!perl line (optionally cd to directory). + Pass an empty string ('') for just '-x'. If a directory is provided, + Perl will cd to that directory before running the script. + disable_all_warnings: Disable all warnings. + """ + command = ["perl"] + output_files: List[Path] = [] + + # Input validation + if not program_file and not execute_program_string and not execute_program_string_extended: + raise ValueError("Either 'program_file' or at least one of " + "'execute_program_string' or 'execute_program_string_extended' must be provided.") + + if program_file and not program_file.is_file(): + raise FileNotFoundError(f"Program file not found: {program_file}") + + if loop_around_program and loop_and_print: + raise ValueError("Options '-n' (loop_around_program) and '-p' (loop_and_print) are mutually exclusive.") + + warning_flags_set = sum([enable_warnings, enable_all_warnings, disable_all_warnings]) + if warning_flags_set > 1: + raise ValueError("Only one of '-w' (enable_warnings), '-W' (enable_all_warnings), " + "or '-X' (disable_all_warnings) can be set.") + + if include_directories: + for d in include_directories: + if not d.is_dir(): + raise NotADirectoryError(f"Include directory not found: {d}") + + if ignore_text_before_shebang is not None and ignore_text_before_shebang != "": + dir_path = Path(ignore_text_before_shebang) + if not dir_path.is_dir(): + raise NotADirectoryError(f"Directory for -x option not found: {dir_path}") + + # Build command + if record_separator_octal is not None: + command.append(f"-0{record_separator_octal}") + if autosplit: + command.append("-a") + if unicode_features is not None: + command.append(f"-C{unicode_features}") + if check_syntax_only: + command.append("-c") + if debug_mode is not None: + command.append(f"-d{debug_mode}") + if debugging_flags is not None: + command.append(f"-D{debugging_flags}") + if execute_program_string: + for prog_str in execute_program_string: + command.extend(["-e", prog_str]) + if execute_program_string_extended: + for prog_str in execute_program_string_extended: + command.extend(["-E", prog_str]) + if no_sitecustomize: + command.append("-f") + if split_pattern is not None: + command.append(f"-F{split_pattern}") + if edit_in_place_extension is not None: + command.append(f"-i{edit_in_place_extension}") + # If -i is used and program_arguments are files, they are modified. + if program_arguments: + for arg in program_arguments: + arg_path = Path(arg) + # Only add existing files to output_files, as non-existent files + # would typically be created by the script, not modified in-place. + if arg_path.is_file(): + output_files.append(arg_path) + if include_directories: + for d in include_directories: + command.extend(["-I", str(d)]) + if line_ending_processing is not None: + command.append(f"-l{line_ending_processing}") + if module_operations: + for mod_op in module_operations: + # If the user provides the full flag (e.g., '-Mstrict'), use it directly. + # Otherwise, default to '-M'. + if mod_op.startswith('-M') or mod_op.startswith('-m'): + command.append(mod_op) + else: + command.append(f"-M{mod_op}") + if loop_around_program: + command.append("-n") + if loop_and_print: + command.append("-p") + if rudimentary_switch_parsing: + command.append("-s") + if search_path_for_program: + command.append("-S") + if tainting_warnings: + command.append("-t") + if tainting_checks: + command.append("-T") + if dump_core_on_parse: + command.append("-u") + if allow_unsafe_operations: + command.append("-U") + if print_version: + command.append("-v") + if print_config_summary is not None: + command.append(f"-V{print_config_summary}") + if enable_warnings: + command.append("-w") + if enable_all_warnings: + command.append("-W") + if ignore_text_before_shebang is not None: + command.append(f"-x{ignore_text_before_shebang}") + if disable_all_warnings: + command.append("-X") + + # Add program file and arguments + if program_file: + # Add '--' if there are program arguments to prevent misinterpretation of arguments as perl switches + if program_arguments: + command.append("--") + command.append(str(program_file)) + + if program_arguments: + command.extend(program_arguments) + + # Execute command + command_executed = " ".join(map(str, command)) + try: + result = subprocess.run( + command, + capture_output=True, + text=True, + check=True + ) + stdout = result.stdout + stderr = result.stderr + except subprocess.CalledProcessError as e: + return { + "command_executed": command_executed, + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e), + "returncode": e.returncode, + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": command_executed, + "stdout": "", + "stderr": "Error: 'perl' command not found. Please ensure Perl is installed and in your PATH.", + "error": "Perl executable not found", + "returncode": 127, + "output_files": [] + } + + return { + "command_executed": command_executed, + "stdout": stdout, + "stderr": stderr, + "output_files": output_files + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..d153ffe73deeb4b4afcb142217c689aa300b8960 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/perl-pod-escapes_server.py') +SERVER_NAME = 'biosci_perl_pod_escapes' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..9f2efc1a4a764c8a94133d66afad60897554bdab --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-pod-escapes: + build: . + image: mcp-perl-pod-escapes:latest + container_name: mcp-perl-pod-escapes + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-pod-escapes + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f567f0c5a2c9e1a479b18d7bcf1abe981a9f3766 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-pod-escapes + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-pod-escapes/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..7f4cb95d79eb70a08a3b354d161e2040f947bf29 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-uri via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-uri -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-uri_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-uri_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-uri_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_server.py new file mode 100644 index 0000000000000000000000000000000000000000..eccea1886a87ba5a9a5555b6f2c9fe1fe1bd6954 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_server.py @@ -0,0 +1,322 @@ +import subprocess +import json +from typing import Optional, List, Dict, Any, Union +from pathlib import Path + +def _run_perl_uri(script: str, args: List[str]) -> Dict[str, Any]: + """ + Helper to execute Perl code using the URI module and return structured results. + """ + full_script = f"use URI; use URI::file; use URI::QueryParam; use JSON::PP; {script}" + cmd = ["perl", "-e", full_script, "--"] + args + + try: + process = subprocess.run( + cmd, + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": " ".join(cmd), + "stdout": process.stdout.strip(), + "stderr": process.stderr.strip(), + "success": True + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout.strip(), + "stderr": e.stderr.strip(), + "success": False, + "error": str(e) + } + +@mcp.tool() +def uri_new( + uri_str: str, + scheme: Optional[str] = None +) -> Dict[str, Any]: + """ + Constructs a new URI object and returns its basic components (scheme, opaque, path, fragment). + + :param uri_str: The URI string to parse. + :param scheme: Optional scheme specification (used if uri_str is relative). + """ + perl_code = """ + my $u = URI->new($ARGV[0], $ARGV[1]); + my %res = ( + scheme => $u->scheme, + opaque => $u->opaque, + path => $u->path, + fragment => $u->fragment, + as_string => $u->as_string, + as_iri => $u->as_iri, + is_secure => $u->secure ? JSON::PP::true : JSON::PP::false, + has_recognized_scheme => $u->has_recognized_scheme ? JSON::PP::true : JSON::PP::false + ); + print encode_json(\%res); + """ + args = [uri_str, scheme if scheme else ""] + result = _run_perl_uri(perl_code, args) + + if result["success"] and result["stdout"]: + result["parsed"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_new_abs( + uri_str: str, + base_uri: str +) -> Dict[str, Any]: + """ + Constructs a new absolute URI object by resolving a relative URI against a base URI. + + :param uri_str: The relative or absolute URI string. + :param base_uri: The absolute base URI. + """ + perl_code = """ + my $u = URI->new_abs($ARGV[0], $ARGV[1]); + print encode_json({ absolute_uri => $u->as_string }); + """ + result = _run_perl_uri(perl_code, [uri_str, base_uri]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_canonical( + uri_str: str +) -> Dict[str, Any]: + """ + Returns a normalized (canonical) version of the URI. + + :param uri_str: The URI string to normalize. + """ + perl_code = """ + my $u = URI->new($ARGV[0])->canonical; + print encode_json({ canonical_uri => $u->as_string }); + """ + result = _run_perl_uri(perl_code, [uri_str]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_abs_rel( + uri_str: str, + base_uri: str, + mode: str = "abs" +) -> Dict[str, Any]: + """ + Returns an absolute or relative URI reference relative to a base URI. + + :param uri_str: The URI to transform. + :param base_uri: The base URI for resolution or relativization. + :param mode: Either 'abs' to get absolute URI or 'rel' to get relative URI. + """ + if mode not in ["abs", "rel"]: + return {"error": "mode must be 'abs' or 'rel'"} + + perl_code = """ + my $u = URI->new($ARGV[0]); + my $base = URI->new($ARGV[1]); + my $res = ($ARGV[2] eq 'abs') ? $u->abs($base) : $u->rel($base); + print encode_json({ result => $res->as_string }); + """ + result = _run_perl_uri(perl_code, [uri_str, base_uri, mode]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_file_conversion( + path_or_uri: str, + to_uri: bool = True, + os: Optional[str] = None, + make_absolute: bool = False +) -> Dict[str, Any]: + """ + Converts between file system paths and file:// URIs. + + :param path_or_uri: The file path (if to_uri is True) or the file URI (if to_uri is False). + :param to_uri: If True, converts path to URI. If False, converts URI to path. + :param os: Optional OS type (e.g., 'Unix', 'Win32', 'Mac'). + :param make_absolute: If True and to_uri is True, creates an absolute file URI. + """ + if to_uri: + # Path to URI + perl_code = """ + my $u; + if ($ARGV[2] eq '1') { + $u = URI::file->new_abs($ARGV[0], $ARGV[1]); + } else { + $u = URI::file->new($ARGV[0], $ARGV[1]); + } + print encode_json({ uri => $u->as_string }); + """ + args = [path_or_uri, os if os else "", "1" if make_absolute else "0"] + else: + # URI to Path + perl_code = """ + my $u = URI->new($ARGV[0]); + my $path = $u->file($ARGV[1]); + print encode_json({ path => $path }); + """ + args = [path_or_uri, os if os else ""] + + result = _run_perl_uri(perl_code, args) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_query_params( + uri_str: str, + action: str = "get", + key: Optional[str] = None, + values: Optional[List[str]] = None +) -> Dict[str, Any]: + """ + Manages individual query parameters of a URI using URI::QueryParam. + + :param uri_str: The URI string. + :param action: 'get' (return values for key), 'set' (replace values for key), + 'append' (add values for key), 'delete' (remove key), + 'list_keys' (return all keys). + :param key: The parameter key to operate on. + :param values: List of values for 'set' or 'append' actions. + """ + perl_code = """ + my $u = URI->new($ARGV[0]); + my $action = $ARGV[1]; + my $key = $ARGV[2]; + my @vals = split('\\0', $ARGV[3] // ''); + + my %res; + if ($action eq 'get') { + my @v = $u->query_param($key); + $res{values} = \@v; + } elsif ($action eq 'set') { + $u->query_param($key, @vals); + $res{new_uri} = $u->as_string; + } elsif ($action eq 'append') { + $u->query_param_append($key, @vals); + $res{new_uri} = $u->as_string; + } elsif ($action eq 'delete') { + my @old = $u->query_param_delete($key); + $res{deleted_values} = \@old; + $res{new_uri} = $u->as_string; + } elsif ($action eq 'list_keys') { + my @keys = $u->query_param; + $res{keys} = \@keys; + } + print encode_json(\%res); + """ + val_str = "\0".join(values) if values else "" + args = [uri_str, action, key if key else "", val_str] + + result = _run_perl_uri(perl_code, args) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_query_form( + uri_str: str, + new_form: Optional[Dict[str, Union[str, List[str]]]] = None, + delimiter: str = "&" +) -> Dict[str, Any]: + """ + Sets or gets the entire query component as a form (application/x-www-form-urlencoded). + + :param uri_str: The URI string. + :param new_form: Optional dictionary to set as the new query form. + :param delimiter: Delimiter for the query string (usually '&' or ';'). + """ + perl_code = """ + my $u = URI->new($ARGV[0]); + my $json_form = $ARGV[1]; + my $delim = $ARGV[2] || '&'; + + my @old_form = $u->query_form; + + if ($json_form) { + my $hash = decode_json($json_form); + $u->query_form($hash, $delim); + } + + print encode_json({ + old_form => \@old_form, + current_uri => $u->as_string, + query_string => $u->query + }); + """ + form_json = json.dumps(new_form) if new_form else "" + result = _run_perl_uri(perl_code, [uri_str, form_json, delimiter]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_server_info( + uri_str: str +) -> Dict[str, Any]: + """ + Extracts server-related components from the URI (authority, userinfo, host, port). + + :param uri_str: The URI string. + """ + perl_code = """ + my $u = URI->new($ARGV[0]); + my %res; + eval { + $res{authority} = $u->authority; + $res{userinfo} = $u->userinfo; + $res{host} = $u->host; + $res{ihost} = $u->ihost; + $res{port} = $u->port; + $res{host_port} = $u->host_port; + }; + if ($@) { + $res{error} = "Scheme does not support server methods: $@"; + } + print encode_json(\%res); + """ + result = _run_perl_uri(perl_code, [uri_str]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result + +@mcp.tool() +def uri_path_segments( + uri_str: str, + new_segments: Optional[List[str]] = None +) -> Dict[str, Any]: + """ + Gets or sets the path segments of a hierarchical URI. + + :param uri_str: The URI string. + :param new_segments: Optional list of segments to set. + """ + perl_code = """ + my $u = URI->new($ARGV[0]); + my $json_segs = $ARGV[1]; + + if ($json_segs) { + my $segs = decode_json($json_segs); + $u->path_segments(@$segs); + } + + my @current = $u->path_segments; + print encode_json({ + segments => \@current, + path => $u->path, + uri => $u->as_string + }); + """ + segs_json = json.dumps(new_segments) if new_segments else "" + result = _run_perl_uri(perl_code, [uri_str, segs_json]) + if result["success"] and result["stdout"]: + result["data"] = json.loads(result["stdout"]) + return result \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..6dc98dd02df74e611be035185568e18e1d521ec5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/perl-uri_server.py') +SERVER_NAME = 'biosci_perl_uri' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..96c8b30739f5a06fae2111e4baff5261c386c608 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-uri: + build: . + image: mcp-perl-uri:latest + container_name: mcp-perl-uri + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-uri + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c03c680d489684cca387a6ab52f48a0316e246a7 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-uri + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-uri/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a254626fd7a64b2d9ec5568dbc273a2652a30ffa --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install perl-xml-xpath via conda (e.g., from bioconda) +RUN conda install -c bioconda perl-xml-xpath -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/perl-xml-xpath_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/perl-xml-xpath_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/perl-xml-xpath_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_server.py new file mode 100644 index 0000000000000000000000000000000000000000..fc608778f428d86970c2df03bd3de44ad1e59696 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_server.py @@ -0,0 +1,382 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Optional, Dict, Union + +# Helper function to execute Perl scripts using XML::XPath +def _execute_perl_xpath_script( + perl_script_logic: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + xpath_expression: str = "", + context_node_xpath: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, + output_modified_xml: bool = False, +) -> Dict[str, Union[str, List[str]]]: + """ + Constructs and executes a Perl script using the XML::XPath module. + + Args: + perl_script_logic: The core Perl code snippet to perform the XPath operation. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + xpath_expression: The XPath expression to be used in the perl_script_logic. + context_node_xpath: An optional XPath expression to define the context node + for the main XPath query. If not found, the document root + will be used as context. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + output_modified_xml: If True, the entire modified XML document will be printed to stdout. + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + if (xml_input_file is None and xml_input_string is None) or \ + (xml_input_file is not None and xml_input_string is not None): + raise ValueError("Exactly one of 'xml_input_file' or 'xml_input_string' must be provided.") + + if xml_input_file and not xml_input_file.is_file(): + raise FileNotFoundError(f"Input XML file not found: {xml_input_file}") + + if namespaces is None: + namespaces = [] + if additional_perl_flags is None: + additional_perl_flags = [] + + perl_script_lines = [ + "use strict;", + "use warnings;", + "use XML::XPath;", + "use XML::XPath::XMLParser;", # Needed for as_string and document root access + "my $xp;", + ] + + if xml_input_file: + perl_script_lines.append(f"my $filename = '{xml_input_file.resolve()}';") + perl_script_lines.append("$xp = XML::XPath->new(filename => $filename);") + elif xml_input_string: + # Escape single quotes in the XML string for Perl + escaped_xml_string = xml_input_string.replace("'", "'\\''") + perl_script_lines.append(f"my $xml_string = '{escaped_xml_string}';") + perl_script_lines.append("$xp = XML::XPath->new(xml => $xml_string);") + + # Add namespace declarations + for ns_pair in namespaces: + if '=' not in ns_pair: + raise ValueError(f"Invalid namespace format: '{ns_pair}'. Expected 'prefix=uri'.") + prefix, uri = ns_pair.split('=', 1) + # Escape single quotes in prefix and uri + prefix = prefix.replace("'", "'\\''") + uri = uri.replace("'", "'\\''") + perl_script_lines.append(f"$xp->set_namespace('{prefix}', '{uri}');") + + # Handle context node if specified + if context_node_xpath: + escaped_context_xpath = context_node_xpath.replace("'", "'\\''") + perl_script_lines.append(f"my $context_nodeset = $xp->find('{escaped_context_xpath}');") + perl_script_lines.append("my $context_node;") + perl_script_lines.append("if ($context_nodeset->size > 0) {") + perl_script_lines.append(" $context_node = $context_nodeset->get_node(1); # Use the first matching node as context") + perl_script_lines.append("} else {") + perl_script_lines.append(" # If context_node_xpath doesn't match, use document root as context for main query") + perl_script_lines.append(" $context_node = $xp->{_root};") + perl_script_lines.append("}") + else: + perl_script_lines.append("my $context_node = $xp->{_root};") # Default context is document root + + # Add the specific logic for the XPath operation + escaped_xpath_expression = xpath_expression.replace("'", "'\\''") + perl_script_lines.append(f"my $xpath_expr = '{escaped_xpath_expression}';") + perl_script_lines.append(perl_script_logic) + + # If output_modified_xml is true, we need to print the modified XML + if output_modified_xml: + perl_script_lines.append("print XML::XPath::XMLParser::as_string($xp->{_root});") + + full_perl_script = "\n".join(perl_script_lines) + + with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".pl") as tmp_script: + tmp_script.write(full_perl_script) + tmp_script_path = Path(tmp_script.name) + + command = ["perl"] + additional_perl_flags + [str(tmp_script_path)] + + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True, + encoding="utf-8" + ) + stdout = process.stdout + stderr = process.stderr + return { + "command_executed": " ".join(command), + "stdout": stdout, + "stderr": stderr, + "output_files": [], + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(e.cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "error": f"Perl script execution failed with exit code {e.returncode}", + } + finally: + if tmp_script_path.exists(): + tmp_script_path.unlink() # Clean up the temporary script + + +@mcp.tool() +def xpath_find_nodes_as_string( + xpath_expression: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + context_node_xpath: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, +) -> Dict[str, Union[str, List[str]]]: + """ + Finds nodes matching an XPath expression and returns them as XML strings. + + This tool uses the XML::XPath Perl module to parse an XML document (from a file or string), + evaluate an XPath expression, and return the XML representation of all matching nodes. + + Args: + xpath_expression: The XPath expression to evaluate. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + context_node_xpath: An optional XPath expression to define the context node + for the main XPath query. If not found, the document root + will be used as context. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + + Returns: + A dictionary containing the command executed, stdout (XML strings of matched nodes, + each on a new line), stderr, and any output files. + """ + if not xpath_expression: + raise ValueError("xpath_expression cannot be empty.") + + perl_logic = """ +my $nodeset = $xp->findnodes($xpath_expr, $context_node); +foreach my $node ($nodeset->get_nodelist) { + print XML::XPath::XMLParser::as_string($node), "\\n"; +} +""" + return _execute_perl_xpath_script( + perl_script_logic=perl_logic, + xml_input_file=xml_input_file, + xml_input_string=xml_input_string, + xpath_expression=xpath_expression, + context_node_xpath=context_node_xpath, + namespaces=namespaces, + additional_perl_flags=additional_perl_flags, + ) + + +@mcp.tool() +def xpath_find_value( + xpath_expression: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + context_node_xpath: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, +) -> Dict[str, Union[str, List[str]]]: + """ + Evaluates an XPath expression and returns its string value. + + This tool uses the XML::XPath Perl module to parse an XML document (from a file or string) + and evaluate an XPath expression, returning the string value of the result. + If the XPath returns a NodeSet, its string value (as per XPath rules) is returned. + + Args: + xpath_expression: The XPath expression to evaluate. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + context_node_xpath: An optional XPath expression to define the context node + for the main XPath query. If not found, the document root + will be used as context. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + + Returns: + A dictionary containing the command executed, stdout (the string value), + stderr, and any output files. + """ + if not xpath_expression: + raise ValueError("xpath_expression cannot be empty.") + + perl_logic = """ +my $value = $xp->findvalue($xpath_expr, $context_node); +print $value, "\\n"; +""" + return _execute_perl_xpath_script( + perl_script_logic=perl_logic, + xml_input_file=xml_input_file, + xml_input_string=xml_input_string, + xpath_expression=xpath_expression, + context_node_xpath=context_node_xpath, + namespaces=namespaces, + additional_perl_flags=additional_perl_flags, + ) + + +@mcp.tool() +def xpath_exists( + xpath_expression: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + context_node_xpath: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, +) -> Dict[str, Union[str, List[str]]]: + """ + Checks if an XPath expression matches any nodes and returns a boolean result. + + This tool uses the XML::XPath Perl module to parse an XML document (from a file or string) + and check if the given XPath expression matches any nodes. + + Args: + xpath_expression: The XPath expression to check for existence. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + context_node_xpath: An optional XPath expression to define the context node + for the main XPath query. If not found, the document root + will be used as context. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + + Returns: + A dictionary containing the command executed, stdout ('1' for true, '0' for false), + stderr, and any output files. + """ + if not xpath_expression: + raise ValueError("xpath_expression cannot be empty.") + + perl_logic = """ +my $exists = $xp->exists($xpath_expr, $context_node) ? 1 : 0; +print $exists, "\\n"; +""" + return _execute_perl_xpath_script( + perl_script_logic=perl_logic, + xml_input_file=xml_input_file, + xml_input_string=xml_input_string, + xpath_expression=xpath_expression, + context_node_xpath=context_node_xpath, + namespaces=namespaces, + additional_perl_flags=additional_perl_flags, + ) + + +@mcp.tool() +def xpath_set_node_text( + xpath_expression: str, + new_text: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + context_node_xpath: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, +) -> Dict[str, Union[str, List[str]]]: + """ + Sets the text content for a node or attribute matching an XPath expression. + Returns the modified XML document. + + This tool uses the XML::XPath Perl module to modify an XML document by setting + the text content of nodes or attributes identified by an XPath expression. + The full modified XML document is returned in stdout. + + Args: + xpath_expression: The XPath expression identifying the node(s) or attribute to modify. + new_text: The new text content to set. Can be an empty string. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + context_node_xpath: An optional XPath expression to define the context node + for the main XPath query. If not found, the document root + will be used as context. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + + Returns: + A dictionary containing the command executed, stdout (the modified XML document), + stderr, and any output files. + """ + if not xpath_expression: + raise ValueError("xpath_expression cannot be empty.") + if new_text is None: + new_text = "" # Allow empty string, but not None + + escaped_new_text = new_text.replace("'", "'\\''") + + perl_logic = f""" +my $nodeset = $xp->findnodes($xpath_expr, $context_node); +foreach my $node ($nodeset->get_nodelist) {{ + $xp->setNodeText($node, '{escaped_new_text}'); +}} +""" + return _execute_perl_xpath_script( + perl_script_logic=perl_logic, + xml_input_file=xml_input_file, + xml_input_string=xml_input_string, + xpath_expression=xpath_expression, + context_node_xpath=context_node_xpath, + namespaces=namespaces, + additional_perl_flags=additional_perl_flags, + output_modified_xml=True, + ) + + +@mcp.tool() +def xpath_create_node( + xpath_expression: str, + xml_input_file: Optional[Path] = None, + xml_input_string: Optional[str] = None, + namespaces: Optional[List[str]] = None, + additional_perl_flags: Optional[List[str]] = None, +) -> Dict[str, Union[str, List[str]]]: + """ + Creates a node (or path of nodes) matching the given XPath expression. + Returns the modified XML document. + + This tool uses the XML::XPath Perl module to create new nodes in an XML document. + If parts of the path do not exist, they will be created automatically. + The full modified XML document is returned in stdout. + Note: The `context_node_xpath` parameter is not applicable for `createNode` as it + operates relative to the document root. + + Args: + xpath_expression: The XPath expression specifying the node(s) to create. + This should be an absolute path or a path relative to the + document root. + xml_input_file: Path to the input XML file. + xml_input_string: The input XML content as a string. + namespaces: A list of namespace mappings in "prefix=uri" format (e.g., ["foo=http://example.com/foo"]). + additional_perl_flags: Optional list of additional flags to pass to the perl interpreter (e.g., ['-w']). + + Returns: + A dictionary containing the command executed, stdout (the modified XML document), + stderr, and any output files. + """ + if not xpath_expression: + raise ValueError("xpath_expression cannot be empty.") + + perl_logic = """ +$xp->createNode($xpath_expr); +""" + return _execute_perl_xpath_script( + perl_script_logic=perl_logic, + xml_input_file=xml_input_file, + xml_input_string=xml_input_string, + xpath_expression=xpath_expression, + context_node_xpath=None, # createNode operates relative to the document root, not a specific context node object + namespaces=namespaces, + additional_perl_flags=additional_perl_flags, + output_modified_xml=True, + ) \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..1ea45c219532f9f79446a9afd8e4f9201c6ed1cd --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/perl-xml-xpath_server.py') +SERVER_NAME = 'biosci_perl_xml_xpath' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..7b7e2257ed46ad577ba6ca9cd3a71cd4a6642110 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-perl-xml-xpath: + build: . + image: mcp-perl-xml-xpath:latest + container_name: mcp-perl-xml-xpath + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=perl-xml-xpath + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d38c310a46dd60f7ebd677e30bdebd9a28b11ba2 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - perl-xml-xpath + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_perl-xml-xpath/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/rsem_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/rsem_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..63fdcc6701a2a1670bb240cb253209564d725499 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/rsem_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/app/rsem_server.py') +SERVER_NAME = 'biosci_rsem' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..cba1ba120f3372b8261a8f521d42dabf484cec50 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-rsem: + build: . + image: mcp-rsem:latest + container_name: mcp-rsem + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=rsem + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_rsem/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a66ddeedb152db99498e252fb2f4dbae9d8fb585 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install scvis_galaxy via conda (e.g., from bioconda) +RUN conda install -c bioconda scvis_galaxy -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/scvis_galaxy_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/scvis_galaxy_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/scvis_galaxy_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_server.py new file mode 100644 index 0000000000000000000000000000000000000000..a4f5669c760d89535192711d7ebcd6f54f2c7f5a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_server.py @@ -0,0 +1,234 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Optional, Dict, Any + +# This is a placeholder for the MCP decorator. +# In a real MCP environment, this would be provided by the MCP framework. +def tool(*args, **kwargs): + def decorator(func): + return func + return decorator + +mcp = type("mcp", (), {"tool": tool}) + + +@mcp.tool() +def scvis_train( + data_matrix_file: Path, + out_dir: Optional[Path] = None, + data_label_file: Optional[Path] = None, + config_file: Optional[Path] = None, + normalize: Optional[float] = None, + verbose: bool = False, + verbose_interval: int = 50, + show_plot: bool = False, +) -> Dict[str, Any]: + """ + Learns a probabilistic parametric mapping for dimension reduction using scvis. + + This function corresponds to the 'scvis train' command. It takes a high-dimensional + data matrix and learns a low-dimensional embedding. + + Args: + data_matrix_file: Path to a high-dimensional data matrix in tab-delimited format. + The first row should be column names. Each row represents a data point. + out_dir: Optional path for output files. If not provided, a temporary directory will be created. + data_label_file: Optional path to a one-column file (with header) providing cluster + information for each data point, used for coloring scatter plots. + config_file: Optional path to a custom YAML configuration file. If not provided, + scvis uses its default configuration. + normalize: Optional positive float number for normalization. If not set, scvis + normalizes by the maximum absolute value. + verbose: If True, the program will print progress information to the screen. + verbose_interval: The mini-batch interval to show running information. + show_plot: If True, plot intermediate embeddings during optimization. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output file paths. + """ + # --- Input Validation --- + if not data_matrix_file.is_file(): + raise FileNotFoundError(f"Input data matrix file not found: {data_matrix_file}") + if data_label_file and not data_label_file.is_file(): + raise FileNotFoundError(f"Data label file not found: {data_label_file}") + if config_file and not config_file.is_file(): + raise FileNotFoundError(f"Config file not found: {config_file}") + if normalize is not None and normalize <= 0: + raise ValueError("The 'normalize' value must be a positive float.") + if verbose_interval <= 0: + raise ValueError("'verbose_interval' must be a positive integer.") + + # --- Command Construction --- + work_dir_context = tempfile.TemporaryDirectory() if out_dir is None else nullcontext(out_dir) + + with work_dir_context as temp_dir: + output_directory = Path(temp_dir) + if out_dir: + output_directory.mkdir(parents=True, exist_ok=True) + + command = [ + "scvis", "train", + "--data_matrix_file", str(data_matrix_file), + "--out_dir", str(output_directory), + "--verbose_interval", str(verbose_interval), + ] + + if data_label_file: + command.extend(["--data_label_file", str(data_label_file)]) + if config_file: + command.extend(["--config_file", str(config_file)]) + if normalize is not None: + command.extend(["--normalize", str(normalize)]) + if verbose: + command.append("--verbose") + if show_plot: + command.append("--show_plot") + + # --- Subprocess Execution --- + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True, + ) + stdout = process.stdout + stderr = process.stderr + + # --- Collect Output Files --- + output_files = [str(f) for f in output_directory.glob('**/*') if f.is_file()] + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"scvis train failed with exit code {e.returncode}", + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "scvis command not found. Please ensure it is installed and in your PATH.", + "error": "Executable not found.", + "output_files": [] + } + + return { + "command_executed": " ".join(command), + "stdout": stdout, + "stderr": stderr, + "output_files": output_files, + } + + +@mcp.tool() +def scvis_map( + data_matrix_file: Path, + pretrained_model_file: Path, + out_dir: Optional[Path] = None, + config_file: Optional[Path] = None, + normalize: Optional[float] = None, +) -> Dict[str, Any]: + """ + Maps new data to an existing embedding using a pre-trained scvis model. + + This function corresponds to the 'scvis map' command. It requires a pre-trained + model from 'scvis train' to project new high-dimensional data into the + learned low-dimensional space. + + Args: + data_matrix_file: Path to a new high-dimensional data matrix to be mapped. + pretrained_model_file: Path to a pre-trained scvis model checkpoint file prefix + (e.g., /path/to/model/model.ckpt). + out_dir: Optional path for output files. If not provided, a temporary directory will be created. + config_file: Optional path to a custom YAML configuration file. This should be the + same configuration used for training the model. + normalize: Optional positive float number for normalization. This should be consistent + with the normalization used during the training step. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output file paths. + """ + # --- Input Validation --- + if not data_matrix_file.is_file(): + raise FileNotFoundError(f"Input data matrix file not found: {data_matrix_file}") + + # The tool expects a checkpoint prefix. We check if the directory exists. + # A full check would involve looking for .meta, .index, .data files. + if not pretrained_model_file.parent.is_dir(): + raise FileNotFoundError(f"Directory for pretrained model not found: {pretrained_model_file.parent}") + + if config_file and not config_file.is_file(): + raise FileNotFoundError(f"Config file not found: {config_file}") + if normalize is not None and normalize <= 0: + raise ValueError("The 'normalize' value must be a positive float.") + + # --- Command Construction --- + work_dir_context = tempfile.TemporaryDirectory() if out_dir is None else nullcontext(out_dir) + + with work_dir_context as temp_dir: + output_directory = Path(temp_dir) + if out_dir: + output_directory.mkdir(parents=True, exist_ok=True) + + command = [ + "scvis", "map", + "--data_matrix_file", str(data_matrix_file), + "--pretrained_model_file", str(pretrained_model_file), + "--out_dir", str(output_directory), + ] + + if config_file: + command.extend(["--config_file", str(config_file)]) + if normalize is not None: + command.extend(["--normalize", str(normalize)]) + + # --- Subprocess Execution --- + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True, + ) + stdout = process.stdout + stderr = process.stderr + + # --- Collect Output Files --- + output_files = [str(f) for f in output_directory.glob('**/*') if f.is_file()] + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"scvis map failed with exit code {e.returncode}", + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "scvis command not found. Please ensure it is installed and in your PATH.", + "error": "Executable not found.", + "output_files": [] + } + + return { + "command_executed": " ".join(command), + "stdout": stdout, + "stderr": stderr, + "output_files": output_files, + } + +# Helper for context management +class nullcontext: + def __init__(self, enter_result=None): + self.enter_result = enter_result + def __enter__(self): + return self.enter_result + def __exit__(self, *exc): + pass \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..514c01df2062df0cd00850ba22b3e12e728fefbe --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/app/scvis_galaxy_server.py') +SERVER_NAME = 'biosci_scvis_galaxy' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..a9bbb30336584dffbf8ce29bb8cb45fdd5b2bca7 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-scvis_galaxy: + build: . + image: mcp-scvis_galaxy:latest + container_name: mcp-scvis_galaxy + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=scvis_galaxy + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3367b37e8ad7e0826d2f3e06461d89ddea471c24 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - scvis_galaxy + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_scvis_galaxy/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c286972968f64ec6200f4b116e68db2f7e69f66c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install segemehl via conda (e.g., from bioconda) +RUN conda install -c bioconda segemehl -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/segemehl_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/segemehl_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/segemehl_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_server.py new file mode 100644 index 0000000000000000000000000000000000000000..5e35a0bea9f8409747bffbbe7204371731ba629f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_server.py @@ -0,0 +1,330 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import List, Optional, Union + +# Helper function to validate input files +def _validate_input_files(files: Union[Path, List[Path]]): + """ + Validates that all provided input file paths exist and are files. + Raises FileNotFoundError if any file is not found. + """ + if isinstance(files, Path): + files = [files] + for f in files: + if not f.is_file(): + raise FileNotFoundError(f"Input file not found: {f}") + +# Helper function to validate output file paths +def _validate_output_path(file_path: Path): + """ + Ensures the parent directory for an output file exists, creating it if necessary. + """ + if file_path.parent: + file_path.parent.mkdir(parents=True, exist_ok=True) + +@mcp.tool() +def segemehl_generate_index( + database_files: List[Path], + output_index_file: Path, + bisulfite_index: bool = False, + threads: int = 1, +) -> dict: + """ + Generates index structures for reference sequences using segemehl.x. + + This function builds the enhanced suffix array (ESA) index for one or more + reference FASTA files, which is required before mapping reads. It supports + both standard and bisulfite-specific index generation. + + Args: + database_files: A list of paths to reference genome FASTA files. + These files will be concatenated internally to build the index. + output_index_file: The path where the generated index file will be stored. + bisulfite_index: If True, generates a bisulfite-specific index using the '-y' option. + If False (default), generates a standard index using the '-x' option. + threads: The number of parallel threads to use for index generation (default: 1). + Must be a positive integer. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output files. + In case of an error, it includes an 'error' key with details. + """ + _validate_input_files(database_files) + _validate_output_path(output_index_file) + + if threads < 1: + raise ValueError("Number of threads must be at least 1.") + + command = ["segemehl.x"] + if bisulfite_index: + command.extend(["-y", str(output_index_file)]) + else: + command.extend(["-x", str(output_index_file)]) + + command.extend(["-d"]) + command.extend([str(f) for f in database_files]) + + if threads > 1: + command.extend(["-t", str(threads)]) + + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": " ".join(command), + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": [str(output_index_file)], + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "error": str(e), + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "segemehl.x command not found. Please ensure segemehl is installed and in your PATH.", + "output_files": [], + "error": "segemehl.x not found", + } + + +@mcp.tool() +def segemehl_map_reads( + index_file: Path, + database_files: List[Path], + query_file: Path, + mate_file: Optional[Path] = None, + max_insert_size: Optional[int] = None, + read_group_file: Optional[Path] = None, + read_group_id: Optional[str] = None, + threads: int = 1, + full_name_in_sam: bool = False, + max_occurrences: Optional[int] = None, + e_value: Optional[float] = None, + differences: Optional[int] = None, + accuracy: Optional[float] = None, + hit_strategy: int = 1, # 0: all, 1: best-only + bisulfite_mode: int = 0, # 0: off, 1: methylC-seq, 2: bs-seq + split_read_basename: Optional[str] = None, + output_bam: bool = False, + show_progress: bool = False, + output_file: Optional[Path] = None, + unmatched_reads_file: Optional[Path] = None, + brief_cigar: bool = False, + output_meop: bool = False, + file_bins_basename: Optional[str] = None, # Deprecated + sort_output: bool = False, # Deprecated + min_fragment_score: Optional[int] = None, + min_fragment_length: Optional[int] = None, + min_splice_cover: Optional[int] = None, +) -> dict: + """ + Aligns short reads to a reference genome using segemehl.x. + + This function provides comprehensive options for mapping single-end or paired-end + reads, including support for bisulfite converted DNA and split-read alignments. + Output can be in SAM or BAM format. + + Args: + index_file: Path to the pre-built database index file (e.g., generated by segemehl_generate_index). + database_files: A list of paths to reference genome FASTA files. + Crucially, these must be provided in the exact same order as they were + used during index generation to avoid MD5 key mismatches. + query_file: Path to the query sequences (FASTA or FASTQ format). For paired-end data, + this should be the first mate file. + mate_file: Optional path to the second mate sequences (FASTA or FASTQ) for paired-end mapping. + max_insert_size: Optional maximum insert size for paired-end mapping. This parameter + primarily influences the internal algorithmics and mapping time, not the output. + Must be non-negative. + read_group_file: Optional path to a file containing a SAM format @RG header. + read_group_id: Optional user-defined read group ID string to assign to all aligned reads. + threads: The number of parallel threads to use for mapping (default: 1). Must be at least 1. + full_name_in_sam: If True, writes the full fastq/fasta name to the SAM output instead of just the ID. + max_occurrences: Optional maximum number of occurrences for seeds. Seeds with more occurrences + than this value will be discarded. Must be non-negative. + e_value: Optional maximum score-based E-value for seeds. Increasing this value can lead + to higher sensitivity. Must be non-negative. + differences: Optional maximum number of differences (mismatches, insertions, deletions) + allowed within a single seed. Higher values increase sensitivity but impact runtime. + For reads >=100bp, -D 0 is often sufficient. Must be non-negative. + accuracy: Optional minimum alignment accuracy (in percent). Reads with a best alignment + below this threshold will be discarded. Must be between 0.0 and 100.0. + hit_strategy: Controls which alignments are reported (0: all alignments that pass -A criterion, + 1: only the best-scoring alignment for each read). Default is 1 (best-only). + bisulfite_mode: Enables alignment of bisulfite converted DNA sequences (0: off, 1: methylC-seq protocol, + 2: bs-seq protocol). Default is 0. + split_read_basename: Optional basename string to trigger split read alignment mode. If provided, + additional BED files (*.sngl.bed, *.mult.bed) and a custom text file (*.trns.txt) + will be generated with this basename. + output_bam: If True, the output will be in BAM format instead of SAM. Note that BAM output + might take slightly longer. + show_progress: If True, a progress bar will be displayed on stderr during the alignment run. + output_file: Optional path to write the SAM or BAM output. If not provided, output goes to stdout. + unmatched_reads_file: Optional path to a file where unmapped FASTA or FASTQ reads will be dumped. + brief_cigar: If True, uses a brief cigar string ('M' for matches/mismatches) instead of the + extended cigar string ('=' for matches, 'X' for mismatches). + output_meop: If True, attaches a multi edit operation string (XE:Z:) as a custom key/value pair + to each SAM alignment, which can be useful for variance calling. + file_bins_basename: (Deprecated) Optional basename for temporary file bins. This option is deprecated. + sort_output: (Deprecated) If True, the output will be sorted. This option is deprecated. + min_fragment_score: Optional minimum score required for an individual split fragment + (only applicable when `split_read_basename` is used). Must be non-negative. + min_fragment_length: Optional minimum length required for an individual split fragment + (only applicable when `split_read_basename` is used). Must be non-negative. + min_splice_cover: Optional minimum percentage of the original read that must be covered by + a split alignment for it to be accepted (only applicable when `split_read_basename` is used). + Must be between 0 and 100. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of output files. + In case of an error, it includes an 'error' key with details. + """ + # Input file validation + _validate_input_files([index_file, query_file] + database_files) + if mate_file: + _validate_input_files(mate_file) + if read_group_file: + _validate_input_files(read_group_file) + + # Output path validation (ensure parent directories exist) + if output_file: + _validate_output_path(output_file) + if unmatched_reads_file: + _validate_output_path(unmatched_reads_file) + if split_read_basename: + _validate_output_path(Path(split_read_basename).parent) + if file_bins_basename: # Deprecated, but still validate path if used + _validate_output_path(Path(file_bins_basename).parent) + + # Parameter value validation + if threads < 1: + raise ValueError("Number of threads must be at least 1.") + if max_insert_size is not None and max_insert_size < 0: + raise ValueError("Maximum insert size must be non-negative.") + if max_occurrences is not None and max_occurrences < 0: + raise ValueError("Maximum occurrences must be non-negative.") + if e_value is not None and e_value < 0.0: + raise ValueError("E-value must be non-negative.") + if differences is not None and differences < 0: + raise ValueError("Differences must be non-negative.") + if accuracy is not None and not (0.0 <= accuracy <= 100.0): + raise ValueError("Accuracy must be between 0.0 and 100.0.") + if hit_strategy not in [0, 1]: + raise ValueError("Hit strategy must be 0 (all) or 1 (best-only).") + if bisulfite_mode not in [0, 1, 2]: + raise ValueError("Bisulfite mode must be 0 (off), 1 (methylC-seq), or 2 (bs-seq).") + if min_fragment_score is not None and min_fragment_score < 0: + raise ValueError("Minimum fragment score must be non-negative.") + if min_fragment_length is not None and min_fragment_length < 0: + raise ValueError("Minimum fragment length must be non-negative.") + if min_splice_cover is not None and not (0 <= min_splice_cover <= 100): + raise ValueError("Minimum splice cover must be between 0 and 100.") + + command = ["segemehl.x"] + + command.extend(["-i", str(index_file)]) + command.extend(["-d"]) + command.extend([str(f) for f in database_files]) + command.extend(["-q", str(query_file)]) + + if mate_file: + command.extend(["-p", str(mate_file)]) + if max_insert_size is not None: + command.extend(["-I", str(max_insert_size)]) + if read_group_file: + command.extend(["-G", str(read_group_file)]) + if read_group_id: + command.extend(["-g", read_group_id]) + if threads > 1: + command.extend(["-t", str(threads)]) + if full_name_in_sam: + command.append("-f") + if max_occurrences is not None: + command.extend(["-M", str(max_occurrences)]) + if e_value is not None: + command.extend(["-E", str(e_value)]) + if differences is not None: + command.extend(["-D", str(differences)]) + if accuracy is not None: + command.extend(["-A", str(accuracy)]) + if hit_strategy == 0: # Default is 1 (best-only), so only add if 0 (all) + command.extend(["-H", str(hit_strategy)]) + if bisulfite_mode > 0: + command.extend(["-F", str(bisulfite_mode)]) + if split_read_basename: + command.extend(["-S", split_read_basename]) + if min_fragment_score is not None: + command.extend(["-U", str(min_fragment_score)]) + if min_fragment_length is not None: + command.extend(["-Z", str(min_fragment_length)]) + if min_splice_cover is not None: + command.extend(["-W", str(min_splice_cover)]) + if output_bam: + command.append("-b") + if show_progress: + command.append("-s") # Note: -s is also for --progressbar + if unmatched_reads_file: + command.extend(["-u", str(unmatched_reads_file)]) + if brief_cigar: + command.append("-e") + if output_meop: + command.append("-V") + if file_bins_basename: # Deprecated + command.extend(["-B", file_bins_basename]) + if sort_output: # Deprecated + command.append("-O") + + output_files = [] + if output_file: + command.extend(["-o", str(output_file)]) + output_files.append(str(output_file)) + + if unmatched_reads_file: + output_files.append(str(unmatched_reads_file)) + + if split_read_basename: + # These files are automatically generated by segemehl in split-read mode + output_files.append(str(Path(split_read_basename).with_suffix(".sngl.bed"))) + output_files.append(str(Path(split_read_basename).with_suffix(".mult.bed"))) + output_files.append(str(Path(split_read_basename).with_suffix(".trns.txt"))) + + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True + ) + return { + "command_executed": " ".join(command), + "stdout": process.stdout, + "stderr": process.stderr, + "output_files": output_files, + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(command), + "stdout": e.stdout, + "stderr": e.stderr, + "output_files": [], + "error": str(e), + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "segemehl.x command not found. Please ensure segemehl is installed and in your PATH.", + "output_files": [], + "error": "segemehl.x not found", + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..a4a34b84e11163352d517566353018df10c53bd4 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/app/segemehl_server.py') +SERVER_NAME = 'biosci_segemehl' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..e3a912571ee0f167ac6ddc04c5bc9a2ec8666f71 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-segemehl: + build: . + image: mcp-segemehl:latest + container_name: mcp-segemehl + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=segemehl + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2aa2084a5e0a0dfd48b004a229d2bee538650c09 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - segemehl + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_segemehl/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_subread/app/subread_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_subread/app/subread_server.py new file mode 100644 index 0000000000000000000000000000000000000000..dd21d052639f7682158078dca523d1455f9fe3d5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_subread/app/subread_server.py @@ -0,0 +1,428 @@ +from typing import Optional, List +import subprocess +from pathlib import Path + +@mcp.tool() +def subread_buildindex( + basename: str, + reference_fasta: str, + full_index: bool = False, + memory_limit: int = 8000, + index_split: bool = False, +): + """ + Build an index for the reference genome using subread-buildindex. + + :param basename: Base name of the index to be created. + :param reference_fasta: Path to the reference genome FASTA file. + :param full_index: If True, build a full index (larger but faster). Default is False (gapped index). + :param memory_limit: Memory usage limit in MB. Default is 8000. + :param index_split: If True, the index will be split into multiple chunks. + """ + fasta_path = Path(reference_fasta) + if not fasta_path.exists(): + return {"error": f"Reference FASTA file not found: {reference_fasta}"} + + cmd = ["subread-buildindex", "-o", basename] + if full_index: + cmd.append("-F") + if index_split: + cmd.append("-s") + cmd.extend(["-B", str(memory_limit)]) + cmd.append(str(fasta_path)) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [f"{basename}.{ext}" for ext in ["files"]] # Index creates multiple files + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def subread_align( + index: str, + read1: str, + output: str, + read2: Optional[str] = None, + is_rna: bool = False, + nthreads: int = 1, + n_best_locations: int = 1, + min_votes: int = 3, + max_indels: int = 5, + sort_by_coordinates: bool = False, + keep_read_order: bool = False, + unique_mapping: bool = False, +): + """ + Align reads to a reference genome using subread-align. + + :param index: Base name of the index. + :param read1: Path to the first read file (FASTQ/FASTA). + :param output: Path to the output file (SAM/BAM). + :param read2: Path to the second read file for paired-end data. + :param is_rna: Set to True for RNA-seq reads, False for genomic DNA-seq reads. + :param nthreads: Number of threads to use. + :param n_best_locations: Number of best mapping locations to report. + :param min_votes: Minimum number of subreads required for a reporting a hit. + :param max_indels: Maximum number of indels allowed in the alignment. + :param sort_by_coordinates: If True, output location-sorted BAM file. + :param keep_read_order: Keep the same order of reads in the output as in the input. + :param unique_mapping: If True, only uniquely mapped reads are reported. + """ + if not Path(read1).exists(): + return {"error": f"Read file 1 not found: {read1}"} + + cmd = ["subread-align", "-i", index, "-r", read1, "-o", output] + + if read2: + if not Path(read2).exists(): + return {"error": f"Read file 2 not found: {read2}"} + cmd.extend(["-R", read2]) + + cmd.extend(["-t", "1" if is_rna else "0"]) + cmd.extend(["-T", str(nthreads)]) + cmd.extend(["-n", str(n_best_locations)]) + cmd.extend(["-m", str(min_votes)]) + cmd.extend(["-I", str(max_indels)]) + + if sort_by_coordinates: + cmd.append("--sortReadsByCoordinates") + if keep_read_order: + cmd.append("--keepReadOrder") + if unique_mapping: + cmd.append("-u") + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def subjunc( + index: str, + read1: str, + output: str, + read2: Optional[str] = None, + nthreads: int = 1, + n_best_locations: int = 1, + sort_by_coordinates: bool = False, + keep_read_order: bool = False, + all_junctions: bool = False, +): + """ + Align RNA-seq reads and detect exon-exon junctions using subjunc. + + :param index: Base name of the index. + :param read1: Path to the first read file. + :param output: Path to the output file. + :param read2: Path to the second read file for paired-end data. + :param nthreads: Number of threads. + :param n_best_locations: Number of best mapping locations to report. + :param sort_by_coordinates: Output location-sorted BAM. + :param keep_read_order: Keep input read order. + :param all_junctions: If True, report all discovered junctions. + """ + if not Path(read1).exists(): + return {"error": f"Read file 1 not found: {read1}"} + + cmd = ["subjunc", "-i", index, "-r", read1, "-o", output] + + if read2: + if not Path(read2).exists(): + return {"error": f"Read file 2 not found: {read2}"} + cmd.extend(["-R", read2]) + + cmd.extend(["-T", str(nthreads)]) + cmd.extend(["-n", str(n_best_locations)]) + + if sort_by_coordinates: + cmd.append("--sortReadsByCoordinates") + if keep_read_order: + cmd.append("--keepReadOrder") + if all_junctions: + cmd.append("-J") + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def feature_counts( + input_files: List[str], + annotation: str, + output: str, + format: str = "GTF", + feature_type: str = "exon", + attribute_type: str = "gene_id", + is_paired_end: bool = False, + count_read_pairs: bool = False, + strand_specificity: int = 0, + nthreads: int = 1, + min_mapping_quality: int = 0, + allow_multi_overlap: bool = False, + fraction: bool = False, + extra_attributes: Optional[str] = None, +): + """ + Count reads to genomic features using featureCounts. + + :param input_files: List of input BAM/SAM files. + :param annotation: Path to the annotation file (GTF/GFF/SAF). + :param output: Path to the output count file. + :param format: Annotation format: 'GTF' or 'SAF'. Default is 'GTF'. + :param feature_type: Feature type in GTF annotation (e.g., 'exon', 'gene'). + :param attribute_type: Attribute type in GTF annotation (e.g., 'gene_id', 'transcript_id'). + :param is_paired_end: If True, input reads are paired-end. + :param count_read_pairs: If True, count read pairs instead of individual reads. + :param strand_specificity: 0 (unstranded), 1 (stranded), 2 (reversely stranded). + :param nthreads: Number of threads. + :param min_mapping_quality: Minimum mapping quality score. + :param allow_multi_overlap: If True, reads overlapping multiple features will be counted. + :param fraction: If True, use fractional counts for multi-overlapping reads. + :param extra_attributes: Extra attributes to be included in the output. + """ + if not Path(annotation).exists(): + return {"error": f"Annotation file not found: {annotation}"} + + valid_inputs = [] + for f in input_files: + if Path(f).exists(): + valid_inputs.append(f) + else: + return {"error": f"Input file not found: {f}"} + + cmd = ["featureCounts", "-a", annotation, "-o", output] + cmd.extend(["-F", format]) + cmd.extend(["-t", feature_type]) + cmd.extend(["-g", attribute_type]) + cmd.extend(["-s", str(strand_specificity)]) + cmd.extend(["-T", str(nthreads)]) + cmd.extend(["-Q", str(min_mapping_quality)]) + + if is_paired_end: + cmd.append("-p") + if count_read_pairs: + cmd.append("--countReadPairs") + if allow_multi_overlap: + cmd.append("-O") + if fraction: + cmd.append("--fraction") + if extra_attributes: + cmd.extend(["--extraAttributes", extra_attributes]) + + cmd.extend(valid_inputs) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output, f"{output}.summary"] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def sublong( + index: str, + read: str, + output: str, + nthreads: int = 1, + n_best_locations: int = 1, +): + """ + Align long reads (Nanopore/PacBio) using sublong. + + :param index: Base name of the index. + :param read: Path to the long-read file. + :param output: Path to the output file. + :param nthreads: Number of threads. + :param n_best_locations: Number of best mapping locations to report. + """ + if not Path(read).exists(): + return {"error": f"Read file not found: {read}"} + + cmd = ["sublong", "-i", index, "-r", read, "-o", output] + cmd.extend(["-T", str(nthreads)]) + cmd.extend(["-n", str(n_best_locations)]) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def exact_snp( + reference: str, + input_bam: str, + output_vcf: str, + annotation: Optional[str] = None, + min_base_quality: int = 13, + min_snp_fraction: float = 0.1, + min_coverage: int = 1, + nthreads: int = 1, +): + """ + Call SNPs using exactSNP. + + :param reference: Path to the reference genome FASTA file. + :param input_bam: Path to the input BAM/SAM file. + :param output_vcf: Path to the output VCF file. + :param annotation: Path to the gene annotation file (optional). + :param min_base_quality: Minimum base quality score. Default is 13. + :param min_snp_fraction: Minimum fraction of reads supporting a SNP. Default is 0.1. + :param min_coverage: Minimum coverage required for SNP calling. Default is 1. + :param nthreads: Number of threads. + """ + if not Path(reference).exists(): + return {"error": f"Reference file not found: {reference}"} + if not Path(input_bam).exists(): + return {"error": f"Input BAM file not found: {input_bam}"} + + cmd = ["exactSNP", "-g", reference, "-i", input_bam, "-o", output_vcf] + cmd.extend(["-Q", str(min_base_quality)]) + cmd.extend(["-f", str(min_snp_fraction)]) + cmd.extend(["-c", str(min_coverage)]) + cmd.extend(["-T", str(nthreads)]) + + if annotation: + if not Path(annotation).exists(): + return {"error": f"Annotation file not found: {annotation}"} + cmd.extend(["-a", annotation]) + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_vcf] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def flatten_gtf( + input_gtf: str, + output_saf: str, + combine_overlapping: bool = True, +): + """ + Flatten a GTF/GFF annotation into a SAF format annotation. + + :param input_gtf: Path to the input GTF/GFF file. + :param output_saf: Path to the output SAF file. + :param combine_overlapping: If True, combine overlapping exons. If False, chop into bins. + """ + if not Path(input_gtf).exists(): + return {"error": f"Input GTF file not found: {input_gtf}"} + + cmd = ["flattenGTF", "-i", input_gtf, "-o", output_saf] + if not combine_overlapping: + cmd.append("-C") # Chop into non-overlapping bins + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_saf] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } + +@mcp.tool() +def remove_dup( + input_file: str, + output_file: str, + remove_duplicates: bool = True, +): + """ + Remove or mark duplicate reads in a BAM/SAM file. + + :param input_file: Path to the input BAM/SAM file. + :param output_file: Path to the output BAM/SAM file. + :param remove_duplicates: If True, remove duplicates. If False, mark them. + """ + if not Path(input_file).exists(): + return {"error": f"Input file not found: {input_file}"} + + cmd = ["removeDup", "-i", input_file, "-o", output_file] + if remove_duplicates: + cmd.append("-r") + + try: + result = subprocess.run(cmd, capture_output=True, text=True, check=True) + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": [output_file] + } + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "error": str(e), + "stdout": e.stdout, + "stderr": e.stderr + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..31553605af62e11dbe07f5c70f9d7d5199ac120f --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install ucsc-gtftogenepred via conda (e.g., from bioconda) +RUN conda install -c bioconda ucsc-gtftogenepred -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/ucsc-gtftogenepred_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/ucsc-gtftogenepred_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/ucsc-gtftogenepred_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/app/ucsc-gtftogenepred_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/app/ucsc-gtftogenepred_server.py new file mode 100644 index 0000000000000000000000000000000000000000..94d241b9e106a42115e5d5e6644aa9328957ad6e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-gtftogenepred/app/ucsc-gtftogenepred_server.py @@ -0,0 +1,137 @@ +import subprocess +from pathlib import Path +from typing import Optional, List, Dict, Any + +@mcp.tool() +def ucsc_gtftogenepred( + input_gtf: str, + output_gp: str, + gene_db: bool = False, + all_errors: bool = False, + ignore_groups_without_exons: bool = False, + info_out: Optional[str] = None, + source_out: Optional[str] = None, + gene_name_as_name2: bool = False, + include_version: bool = False, + implied_stop: bool = False, + simple: bool = False, + prefix: Optional[str] = None, +) -> Dict[str, Any]: + """ + Convert a GTF file to a genePred file using UCSC gtfToGenePred. + + Args: + input_gtf: Path to the input GTF file. + output_gp: Path to the output genePred file. + gene_db: Use gene_id for name, transcript_id for name2. + all_errors: Process all errors, don't stop at first. + ignore_groups_without_exons: Skip transcripts with no exons. + info_out: Write info about each transcript to this file. + source_out: Write source of each transcript to this file. + gene_name_as_name2: Use gene_name for name2 field. + include_version: Include version number in transcript/gene IDs. + implied_stop: GTF doesn't include stop codon in CDS, add it. + simple: Simple GTF (no gene_id/transcript_id). + prefix: Prefix to add to transcript names. + """ + # Input validation + input_path = Path(input_gtf) + if not input_path.exists(): + return { + "command_executed": "", + "stdout": "", + "stderr": f"Error: Input GTF file '{input_gtf}' does not exist.", + "output_files": [] + } + + output_path = Path(output_gp) + if not output_path.parent.exists(): + try: + output_path.parent.mkdir(parents=True, exist_ok=True) + except Exception as e: + return { + "command_executed": "", + "stdout": "", + "stderr": f"Error: Could not create directory for output file '{output_gp}': {str(e)}", + "output_files": [] + } + + # Build command + # The binary name in the UCSC suite is gtfToGenePred + cmd = ["gtfToGenePred"] + + # Add boolean flags + if gene_db: + cmd.append("-geneDb") + if all_errors: + cmd.append("-allErrors") + if ignore_groups_without_exons: + cmd.append("-ignoreGroupsWithoutExons") + if gene_name_as_name2: + cmd.append("-geneNameAsName2") + if include_version: + cmd.append("-includeVersion") + if implied_stop: + cmd.append("-impliedStop") + if simple: + cmd.append("-simple") + + # Add options with values + if info_out: + info_out_path = Path(info_out) + if not info_out_path.parent.exists(): + info_out_path.parent.mkdir(parents=True, exist_ok=True) + cmd.append(f"-infoOut={info_out}") + + if source_out: + source_out_path = Path(source_out) + if not source_out_path.parent.exists(): + source_out_path.parent.mkdir(parents=True, exist_ok=True) + cmd.append(f"-sourceOut={source_out}") + + if prefix: + cmd.append(f"-prefix={prefix}") + + # Add positional arguments + cmd.append(str(input_path)) + cmd.append(str(output_path)) + + try: + # Execute the tool + result = subprocess.run(cmd, check=True, capture_output=True, text=True) + + # Collect output files + output_files = [str(output_path)] + if info_out: + output_files.append(str(info_out)) + if source_out: + output_files.append(str(source_out)) + + return { + "command_executed": " ".join(cmd), + "stdout": result.stdout, + "stderr": result.stderr, + "output_files": output_files + } + + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": f"Error during execution: {e.stderr}", + "output_files": [] + } + except FileNotFoundError: + return { + "command_executed": " ".join(cmd), + "stdout": "", + "stderr": "Error: 'gtfToGenePred' command not found. Please ensure UCSC tools are installed and in your PATH.", + "output_files": [] + } + except Exception as e: + return { + "command_executed": " ".join(cmd), + "stdout": "", + "stderr": f"An unexpected error occurred: {str(e)}", + "output_files": [] + } diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..013056b9064257a35574283fafeede2233423717 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install ucsc-nibfrag via conda (e.g., from bioconda) +RUN conda install -c bioconda ucsc-nibfrag -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/ucsc-nibfrag_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/ucsc-nibfrag_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/ucsc-nibfrag_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_server.py new file mode 100644 index 0000000000000000000000000000000000000000..5d574907c91a0d004526c4fcf70141d54ed23679 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_server.py @@ -0,0 +1,98 @@ +import subprocess +import tempfile +from pathlib import Path +from typing import Optional, Dict, Any, List + +@mcp.tool() +def nibfrag( + nib_file: Path, + start: int, + end: int, + output_file: Path, + chrom: Optional[str] = None, + upper_case: bool = False, + reverse_complement: bool = False, +) -> Dict[str, Any]: + """ + Extracts a fragment from a NIB file and outputs it as a FASTA file. + + By default, bases and gaps are output in lower case. + The coordinates `start` and `end` are 0-based, with `end` being exclusive. + + Args: + nib_file: Path to the input NIB file. + start: 0-based start coordinate of the fragment to extract. + end: 0-based exclusive end coordinate of the fragment to extract. + output_file: Path to the output FASTA file. + chrom: Optional chromosome name to include in the FASTA header. + If not provided, the FASTA header will be derived from the NIB file name. + upper_case: If True, output bases in upper case. Default is False (lower case). + reverse_complement: If True, output the reverse complement of the fragment. + Default is False. + + Returns: + A dictionary containing the command executed, stdout, stderr, and a list of + generated output files. + + Raises: + ValueError: If input parameters are invalid. + subprocess.CalledProcessError: If the ucsc-nibfrag command fails. + """ + # Input validation + if not nib_file.is_file(): + raise ValueError(f"Input NIB file not found: {nib_file}") + if start < 0: + raise ValueError(f"Start coordinate must be non-negative, but got {start}") + if end <= start: + raise ValueError(f"End coordinate ({end}) must be greater than start coordinate ({start})") + + # Ensure output directory exists + output_file.parent.mkdir(parents=True, exist_ok=True) + + command = [ + "ucsc-nibfrag", + str(nib_file), + str(start), + str(end), + str(output_file), + ] + + if chrom: + command.append(f"-chrom={chrom}") + if upper_case: + command.append("-upper") + if reverse_complement: + command.append("-rev") + + try: + process = subprocess.run( + command, + capture_output=True, + text=True, + check=True + ) + stdout = process.stdout + stderr = process.stderr + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(e.cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": f"ucsc-nibfrag failed with exit code {e.returncode}", + "output_files": [], + } + except FileNotFoundError: + return { + "command_executed": " ".join(command), + "stdout": "", + "stderr": "Error: ucsc-nibfrag command not found. Please ensure it is installed and in your PATH.", + "error": "Tool not found", + "output_files": [], + } + + return { + "command_executed": " ".join(command), + "stdout": stdout, + "stderr": stderr, + "output_files": [str(output_file)], + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..e9720e39279541591774211030dc6d9e5edb1641 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/app/ucsc-nibfrag_server.py') +SERVER_NAME = 'biosci_ucsc_nibfrag' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..1433426d4d86f1e8fdd88e0ab65b8f03aa102bf0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-ucsc-nibfrag: + build: . + image: mcp-ucsc-nibfrag:latest + container_name: mcp-ucsc-nibfrag + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=ucsc-nibfrag + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8255c3216a76fbd1bab974366dd82d903ea47d89 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - ucsc-nibfrag + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_ucsc-nibfrag/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..2c339b579f6f51774abcd20383d9654fbed5ae09 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install unifrac via conda (e.g., from bioconda) +RUN conda install -c bioconda unifrac -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/unifrac_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/unifrac_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/unifrac_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_server.py new file mode 100644 index 0000000000000000000000000000000000000000..18062ab4d4100eac1c2d20cc66953139965ac36c --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_server.py @@ -0,0 +1,354 @@ +import subprocess +import os +from pathlib import Path +from typing import Optional, List, Dict, Any + +# Define common environment variables for UniFrac tools +def _set_unifrac_env_vars( + omp_num_threads: Optional[int] = None, + unifrac_use_gpu: Optional[bool] = None, + acc_device_num: Optional[int] = None, +) -> Dict[str, str]: + """ + Helper function to set environment variables for UniFrac tools. + """ + env = os.environ.copy() + if omp_num_threads is not None: + if omp_num_threads < 1: + raise ValueError("OMP_NUM_THREADS must be a positive integer.") + env["OMP_NUM_THREADS"] = str(omp_num_threads) + if unifrac_use_gpu is not None: + env["UNIFRAC_USE_GPU"] = "Y" if unifrac_use_gpu else "N" + if acc_device_num is not None: + if acc_device_num < 0: + raise ValueError("ACC_DEVICE_NUM must be a non-negative integer.") + env["ACC_DEVICE_NUM"] = str(acc_device_num) + return env + +@mcp.tool() +def ssu( + input_biom_table: Path, + output_distance_matrix: Path, + method: str, + input_phylogeny_tree: Path, + generalized_unifrac_alpha: float = 1.0, + bypass_tips: bool = False, + variance_adjusted: bool = False, + mode: str = "one-off", + start_stripe: Optional[int] = None, + stop_stripe: Optional[int] = None, + partial_pattern: Optional[str] = None, + num_partitions: Optional[int] = None, + report_bare: bool = False, + output_format: str = "ascii", + num_substeps: int = 1, + pcoa_dimensions: int = 10, + disk_buffer_path: Optional[Path] = None, + omp_num_threads: Optional[int] = None, + unifrac_use_gpu: Optional[bool] = None, + acc_device_num: Optional[int] = None, +) -> Dict[str, Any]: + """ + Performs Strided State UniFrac (ssu) calculations to compute phylogenetic diversity. + + This tool supports various UniFrac methods, including unweighted, weighted, + generalized, and variance-adjusted UniFrac, with options for different + precision levels (fp32/fp64) and operational modes. + + Parameters + ---------- + input_biom_table : Path + A filepath to a BIOM-Format 2.1 file containing the feature table. + output_distance_matrix : Path + A filepath to the output distance matrix file. The format depends on `output_format`. + method : str + The UniFrac method to use. + Choices: "unweighted", "weighted_normalized", "weighted_unnormalized", + "generalized", "unweighted_fp32", "weighted_normalized_fp32", + "weighted_unnormalized_fp32", "generalized_fp32". + input_phylogeny_tree : Path + A filepath to a Newick formatted phylogenetic tree. + generalized_unifrac_alpha : float, default=1.0 + Generalized UniFrac alpha parameter. Only applicable if `method` is "generalized" + or "generalized_fp32". + bypass_tips : bool, default=False + If True, bypasses the tips of the tree in the computation, reducing compute + by about 50% (an approximation). + variance_adjusted : bool, default=False + If True, adjusts for variance in the UniFrac calculation. + mode : str, default="one-off" + Mode of operation for UniFrac computation. + Choices: "one-off" (compute UniFrac), "partial" (compute over a subset of stripes), + "partial-report" (start and stop suggestions for partial compute), + "merge-partial" (merge partial UniFrac results). + start_stripe : Optional[int], default=None + If `mode` is "partial", the starting stripe index. Required for "partial" mode. + stop_stripe : Optional[int], default=None + If `mode` is "partial", the stopping stripe index. Required for "partial" mode. + partial_pattern : Optional[str], default=None + If `mode` is "merge-partial", a glob pattern for partial output files to merge. + Required for "merge-partial" mode. + num_partitions : Optional[int], default=None + If `mode` is "partial-report", the number of partitions to compute. + Required for "partial-report" mode. + report_bare : bool, default=False + If `mode` is "partial-report", produces barebones output. + output_format : str, default="ascii" + Output format for the distance matrix. + Choices: "ascii", "hdf5", "hdf5_fp32", "hdf5_fp64". + num_substeps : int, default=1 + Internally splits the problem into `n` substeps for reduced memory footprint. + Must be a positive integer. + pcoa_dimensions : int, default=10 + Number of PCoA dimensions to compute. If set to 0, no PCoA is computed. + Must be a non-negative integer. + disk_buffer_path : Optional[Path], default=None + If set, specifies a directory path to use as a disk buffer to reduce memory footprint. + Ideally, this path should point to a fast partition (e.g., NVMe). + omp_num_threads : Optional[int], default=None + Number of CPU cores to use. If not defined, all detected cores will be used. + Sets the OMP_NUM_THREADS environment variable. + unifrac_use_gpu : Optional[bool], default=None + Enable or disable GPU offload. If not defined, UniFrac will autodetect and use + an NVIDIA GPU if found. Sets the UNIFRAC_USE_GPU environment variable. + acc_device_num : Optional[int], default=None + The GPU to use if multiple are present. If not defined, the first GPU will be used. + Sets the ACC_DEVICE_NUM environment variable. + + Returns + ------- + Dict[str, Any] + A dictionary containing: + - "command_executed": The full command string executed. + - "stdout": Standard output from the command. + - "stderr": Standard error from the command. + - "output_files": A list of paths to generated output files. + + Raises + ------ + FileNotFoundError + If `input_biom_table` or `input_phylogeny_tree` does not exist. + ValueError + If invalid parameters are provided (e.g., unsupported method, invalid mode + combinations, non-positive `num_substeps`, negative `pcoa_dimensions`). + subprocess.CalledProcessError + If the `ssu` command returns a non-zero exit code. + """ + # Input validation + if not input_biom_table.is_file(): + raise FileNotFoundError(f"Input BIOM table not found: {input_biom_table}") + if not input_phylogeny_tree.is_file(): + raise FileNotFoundError(f"Input phylogeny tree not found: {input_phylogeny_tree}") + + valid_methods = { + "unweighted", "weighted_normalized", "weighted_unnormalized", "generalized", + "unweighted_fp32", "weighted_normalized_fp32", "weighted_unnormalized_fp32", + "generalized_fp32" + } + if method not in valid_methods: + raise ValueError(f"Invalid method: '{method}'. Must be one of {valid_methods}") + + valid_modes = {"one-off", "partial", "partial-report", "merge-partial"} + if mode not in valid_modes: + raise ValueError(f"Invalid mode: '{mode}'. Must be one of {valid_modes}") + + if mode == "partial": + if start_stripe is None or stop_stripe is None: + raise ValueError("For 'partial' mode, --start and --stop must be provided.") + if not isinstance(start_stripe, int) or start_stripe < 0: + raise ValueError("start_stripe must be a non-negative integer.") + if not isinstance(stop_stripe, int) or stop_stripe < 0: + raise ValueError("stop_stripe must be a non-negative integer.") + if start_stripe > stop_stripe: + raise ValueError("start_stripe cannot be greater than stop_stripe.") + elif start_stripe is not None or stop_stripe is not None: + print("Warning: --start and --stop are only applicable in 'partial' mode and will be ignored.") + + if mode == "merge-partial": + if partial_pattern is None: + raise ValueError("For 'merge-partial' mode, --partial-pattern must be provided.") + elif partial_pattern is not None: + print("Warning: --partial-pattern is only applicable in 'merge-partial' mode and will be ignored.") + + if mode == "partial-report": + if num_partitions is None: + raise ValueError("For 'partial-report' mode, --n-partials must be provided.") + if not isinstance(num_partitions, int) or num_partitions < 1: + raise ValueError("num_partitions must be a positive integer.") + elif num_partitions is not None: + print("Warning: --n-partials is only applicable in 'partial-report' mode and will be ignored.") + if mode != "partial-report" and report_bare: + print("Warning: --report-bare is only applicable in 'partial-report' mode and will be ignored.") + + valid_formats = {"ascii", "hdf5", "hdf5_fp32", "hdf5_fp64"} + if output_format not in valid_formats: + raise ValueError(f"Invalid output format: '{output_format}'. Must be one of {valid_formats}") + + if not isinstance(num_substeps, int) or num_substeps < 1: + raise ValueError("num_substeps must be a positive integer.") + + if not isinstance(pcoa_dimensions, int) or pcoa_dimensions < 0: + raise ValueError("pcoa_dimensions must be a non-negative integer.") + + if disk_buffer_path is not None and not disk_buffer_path.is_dir(): + raise FileNotFoundError(f"Disk buffer path not found or is not a directory: {disk_buffer_path}") + + # Prepare command + cmd = [ + "ssu", + "-i", str(input_biom_table), + "-o", str(output_distance_matrix), + "-m", method, + "-t", str(input_phylogeny_tree), + ] + + if generalized_unifrac_alpha != 1.0: + if method not in {"generalized", "generalized_fp32"}: + print("Warning: generalized_unifrac_alpha is only applicable for 'generalized' methods and will be ignored.") + else: + cmd.extend(["-a", str(generalized_unifrac_alpha)]) + if bypass_tips: + cmd.append("-f") + if variance_adjusted: + cmd.append("--vaw") + + if mode != "one-off": + cmd.extend(["--mode", mode]) + if mode == "partial": + cmd.extend(["--start", str(start_stripe), "--stop", str(stop_stripe)]) + elif mode == "merge-partial": + cmd.extend(["--partial-pattern", partial_pattern]) + elif mode == "partial-report": + cmd.extend(["--n-partials", str(num_partitions)]) + if report_bare: + cmd.append("--report-bare") + + if num_substeps != 1: + cmd.extend(["--n-substeps", str(num_substeps)]) + + if output_format != "ascii": + cmd.extend(["--format", output_format]) + + if pcoa_dimensions != 10: # Default is 10, 0 means no PCoA + cmd.extend(["--pcoa", str(pcoa_dimensions)]) + + if disk_buffer_path: + cmd.extend(["--diskbuf", str(disk_buffer_path)]) + + # Set environment variables + env = _set_unifrac_env_vars(omp_num_threads, unifrac_use_gpu, acc_device_num) + + # Execute command + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True, env=env) + stdout = process.stdout + stderr = process.stderr + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e), + "output_files": [], + } + + output_files = [output_distance_matrix] if output_distance_matrix.exists() else [] + + return { + "command_executed": " ".join(cmd), + "stdout": stdout, + "stderr": stderr, + "output_files": [str(f) for f in output_files], + } + + +@mcp.tool() +def faithpd( + input_biom_table: Path, + input_phylogeny_tree: Path, + output_series_file: Path, + omp_num_threads: Optional[int] = None, + unifrac_use_gpu: Optional[bool] = None, + acc_device_num: Optional[int] = None, +) -> Dict[str, Any]: + """ + Calculates Faith's Phylogenetic Diversity (PD) for samples in a BIOM table. + + Faith's PD is an alpha diversity metric that quantifies the phylogenetic + diversity of a sample by summing the branch lengths of a phylogenetic tree + that are represented by the organisms in that sample. + + Parameters + ---------- + input_biom_table : Path + A filepath to a BIOM-Format 2.1 file containing the feature table. + input_phylogeny_tree : Path + A filepath to a Newick formatted phylogenetic tree. + output_series_file : Path + A filepath to the output file where the Faith's PD series will be written. + This is typically a plain text file. + omp_num_threads : Optional[int], default=None + Number of CPU cores to use. If not defined, all detected cores will be used. + Sets the OMP_NUM_THREADS environment variable. + unifrac_use_gpu : Optional[bool], default=None + Enable or disable GPU offload. If not defined, UniFrac will autodetect and use + an NVIDIA GPU if found. Sets the UNIFRAC_USE_GPU environment variable. + acc_device_num : Optional[int], default=None + The GPU to use if multiple are present. If not defined, the first GPU will be used. + Sets the ACC_DEVICE_NUM environment variable. + + Returns + ------- + Dict[str, Any] + A dictionary containing: + - "command_executed": The full command string executed. + - "stdout": Standard output from the command. + - "stderr": Standard error from the command. + - "output_files": A list of paths to generated output files. + + Raises + ------ + FileNotFoundError + If `input_biom_table` or `input_phylogeny_tree` does not exist. + subprocess.CalledProcessError + If the `faithpd` command returns a non-zero exit code. + """ + # Input validation + if not input_biom_table.is_file(): + raise FileNotFoundError(f"Input BIOM table not found: {input_biom_table}") + if not input_phylogeny_tree.is_file(): + raise FileNotFoundError(f"Input phylogeny tree not found: {input_phylogeny_tree}") + + # Prepare command + cmd = [ + "faithpd", + "-i", str(input_biom_table), + "-t", str(input_phylogeny_tree), + "-o", str(output_series_file), + ] + + # Set environment variables + env = _set_unifrac_env_vars(omp_num_threads, unifrac_use_gpu, acc_device_num) + + # Execute command + try: + process = subprocess.run(cmd, capture_output=True, text=True, check=True, env=env) + stdout = process.stdout + stderr = process.stderr + except subprocess.CalledProcessError as e: + return { + "command_executed": " ".join(cmd), + "stdout": e.stdout, + "stderr": e.stderr, + "error": str(e), + "output_files": [], + } + + output_files = [output_series_file] if output_series_file.exists() else [] + + return { + "command_executed": " ".join(cmd), + "stdout": stdout, + "stderr": stderr, + "output_files": [str(f) for f in output_files], + } \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..47f7b59dc4c6e8f74433e5d0a2484aec3812e18e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/app/unifrac_server.py') +SERVER_NAME = 'biosci_unifrac' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..be5d262b27932b23b083c9096b95981b3b193fc1 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-unifrac: + build: . + image: mcp-unifrac:latest + container_name: mcp-unifrac + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=unifrac + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3f66c8c3bf7b2510ba6bd8323a278fe9d395f52e --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - unifrac + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_unifrac/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/Dockerfile b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..474d8037e0cb9ea4316f91e2fa4e033ab9e6836a --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/Dockerfile @@ -0,0 +1,40 @@ + +FROM python:3.10-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y default-jre wget curl && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Miniconda +RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && bash /tmp/miniconda.sh -b -p /opt/conda && rm /tmp/miniconda.sh + +# Add conda to PATH +ENV PATH="/opt/conda/bin:$PATH" + +# Install zdb via conda (e.g., from bioconda) +RUN conda install -c bioconda zdb -y && conda clean -a + +# Install Python dependencies +RUN pip install uv +RUN uv pip install --system fastmcp + +# Create app directory +WORKDIR /app + +# Copy your MCP server +COPY app/zdb_server.py /app/ + +# Create workspace and output directories +RUN mkdir -p /app/workspace /app/output + +# Make sure the server script is executable +RUN chmod +x /app/zdb_server.py + +# Expose port for MCP over HTTP (optional) +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0)" + +# Default command runs the MCP server via stdio +CMD ["python", "/app/zdb_server.py"] + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/requirements.txt @@ -0,0 +1 @@ + diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_server.py new file mode 100644 index 0000000000000000000000000000000000000000..bd00bc41c2ff071de827f2ccae2cc0c2b938ecb8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_server.py @@ -0,0 +1,484 @@ +import subprocess +from pathlib import Path +from typing import List, Optional, Dict, Any + +def _execute_zdb_command( + subcommand: str, + args: List[str], + conda: bool, + docker: bool, + singularity: bool, + capture_output: bool = True, + cwd: Optional[Path] = None, +) -> Dict[str, Any]: + """ + Helper function to construct and execute zdb commands. + Handles environment flags (--conda, --docker, --singularity) and subprocess execution. + """ + cmd = ["zdb", subcommand] + + env_flags = [] + if conda: + env_flags.append("--conda") + if docker: + env_flags.append("--docker") + if singularity: + env_flags.append("--singularity") + + if len(env_flags) > 1: + return { + "command_executed": " ".join(map(str, cmd + env_flags + args)), + "stdout": "", + "stderr": "Error: Only one of --conda, --docker, or --singularity can be specified.", + "error": "Invalid environment flags", + "output_files": [], + } + + cmd.extend(env_flags) + cmd.extend(args) + + command_str = " ".join(map(str, cmd)) + stdout = "" + stderr = "" + output_files: List[Path] = [] + + try: + process = subprocess.run( + cmd, + cwd=cwd, + check=True, + capture_output=capture_output, + text=True, + encoding="utf-8", + ) + stdout = process.stdout + stderr = process.stderr + except subprocess.CalledProcessError as e: + stdout = e.stdout + stderr = e.stderr + return { + "command_executed": command_str, + "stdout": stdout, + "stderr": stderr, + "error": f"zdb command failed with exit code {e.returncode}", + "output_files": output_files, + } + except FileNotFoundError: + return { + "command_executed": command_str, + "stdout": "", + "stderr": "Error: zdb command not found. Is zdb installed and in your PATH?", + "error": "zdb executable not found", + "output_files": output_files, + } + + return { + "command_executed": command_str, + "stdout": stdout, + "stderr": stderr, + "output_files": output_files, + } + + +@mcp.tool() +def zdb_setup( + setup_base_db: bool = False, + cog: bool = False, + ko: bool = False, + pfam: bool = False, + vfdb: bool = False, + swissprot: bool = False, + refseq: bool = False, + db_install_dir: Optional[Path] = None, + conda: bool = False, + docker: bool = False, + singularity: bool = False, +) -> Dict[str, Any]: + """ + Downloads and prepares reference and base databases for zDB. + + Args: + setup_base_db: Prepare the database skeleton for zDB. This must be done once. + cog: Download CDD profiles for COG annotations. + ko: Download and set up HMM profiles for the KO database. + pfam: Download and set up HMM profiles for PFAM protein domains. + vfdb: Download and set up the Virulence Factor Database (VFDB). + swissprot: Download and index the SwissProt database. + refseq: Download and index the RefSeq database. + db_install_dir: Directory where databases will be installed. Defaults to the current directory. + conda: Run the setup in a Conda environment. + docker: Run the setup in a Docker container. + singularity: Run the setup in an Apptainer (Singularity) container (default if no other env flag is set). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + args: List[str] = [] + + if setup_base_db: + args.append("--setup_base_db") + if cog: + args.append("--cog") + if ko: + args.append("--ko") + if pfam: + args.append("--pfam") + if vfdb: + args.append("--vfdb") + if swissprot: + args.append("--swissprot") + if refseq: + args.append("--refseq") + + if not (setup_base_db or cog or ko or pfam or vfdb or swissprot or refseq): + return { + "command_executed": "zdb setup ...", + "stdout": "", + "stderr": "Error: At least one database or --setup_base_db flag must be specified.", + "error": "No databases selected for setup", + "output_files": [], + } + + if db_install_dir: + if not db_install_dir.is_dir(): + try: + db_install_dir.mkdir(parents=True, exist_ok=True) + except OSError as e: + return { + "command_executed": "zdb setup ...", + "stdout": "", + "stderr": f"Error: Could not create database installation directory {db_install_dir}: {e}", + "error": "Directory creation failed", + "output_files": [], + } + args.append(f"--dir={db_install_dir.resolve()}") + + return _execute_zdb_command("setup", args, conda, docker, singularity) + + +@mcp.tool() +def zdb_run( + input_csv: Path, + name: Optional[str] = None, + cpu: int = 16, + mem: str = "8GB", + singularity_dir: Optional[Path] = None, + ref_dir: Optional[Path] = None, + resume: bool = False, + output_dir: Optional[Path] = None, + ko: bool = False, + cog: bool = False, + pfam: bool = False, + vfdb: bool = False, + swissprot: bool = False, + refseq: bool = False, + amr: bool = False, + conda: bool = False, + docker: bool = False, + singularity: bool = False, +) -> Dict[str, Any]: + """ + Runs the zDB comparative genomics analysis pipeline. + + Args: + input_csv: Path to a CSV file containing genome information (name, file, groups). + The file must exist. + name: Custom name for the analysis run. Defaults to a Nextflow-generated name. + cpu: Number of parallel processes allowed. Default is 16. + mem: Maximum memory usage allowed (e.g., "8GB"). Default is "8GB". + singularity_dir: Directory where Apptainer (Singularity) images are downloaded. + Defaults to 'singularity' in the current directory. + ref_dir: Directory where reference databases were installed. + Defaults to 'zdb_ref' in the current directory. + resume: Resume a previous run that crashed or to add new analyses. + output_dir: Directory where files necessary for the webapp will be stored. + Defaults to the current directory. + ko: Enable KEGG Orthologs annotation. + cog: Enable COG annotation. + pfam: Enable PFAM domains annotation. + vfdb: Enable Virulence Factors annotation. + swissprot: Enable SwissProt homologs search. + refseq: Enable RefSeq homologs search. + amr: Enable Antimicrobial Resistance genes annotation. + conda: Run the analysis in a Conda environment. + docker: Run the analysis in a Docker container. + singularity: Run the analysis in an Apptainer (Singularity) container (default if no other env flag is set). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + args: List[str] = [] + + if not input_csv.is_file(): + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: Input CSV file not found at {input_csv}", + "error": "Input file not found", + "output_files": [], + } + args.append(f"--input={input_csv.resolve()}") + + if name: + args.append(f"--name={name}") + + if cpu <= 0: + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: CPU count must be a positive integer, got {cpu}", + "error": "Invalid CPU count", + "output_files": [], + } + args.append(f"--cpu={cpu}") + + # Basic validation for memory string format (e.g., "8GB", "16G", "200M") + if not isinstance(mem, str) or not any(mem.endswith(s) for s in ["B", "K", "M", "G", "T", "b", "k", "m", "g", "t"]): + # Allow raw numbers too, assuming bytes or default unit if zdb handles it + try: + int(mem) + except ValueError: + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: Invalid memory format '{mem}'. Expected format like '8GB' or '16G'.", + "error": "Invalid memory format", + "output_files": [], + } + args.append(f"--mem={mem}") + + if singularity_dir: + if not singularity_dir.is_dir(): + try: + singularity_dir.mkdir(parents=True, exist_ok=True) + except OSError as e: + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: Could not create singularity directory {singularity_dir}: {e}", + "error": "Directory creation failed", + "output_files": [], + } + args.append(f"--singularity_dir={singularity_dir.resolve()}") + + if ref_dir: + if not ref_dir.is_dir(): + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: Reference database directory not found at {ref_dir}", + "error": "Reference directory not found", + "output_files": [], + } + args.append(f"--ref_dir={ref_dir.resolve()}") + + if resume: + args.append("--resume") + + if output_dir: + if not output_dir.is_dir(): + try: + output_dir.mkdir(parents=True, exist_ok=True) + except OSError as e: + return { + "command_executed": "zdb run ...", + "stdout": "", + "stderr": f"Error: Could not create output directory {output_dir}: {e}", + "error": "Directory creation failed", + "output_files": [], + } + args.append(f"--out={output_dir.resolve()}") + + if ko: + args.append("--ko") + if cog: + args.append("--cog") + if pfam: + args.append("--pfam") + if vfdb: + args.append("--vfdb") + if swissprot: + args.append("--swissprot") + if refseq: + args.append("--refseq") + if amr: + args.append("--amr") + + return _execute_zdb_command("run", args, conda, docker, singularity) + + +@mcp.tool() +def zdb_webapp( + port: int = 8080, + name: Optional[str] = None, + allowed_host: Optional[str] = None, + conda: bool = False, + docker: bool = False, + singularity: bool = False, + debug: bool = False, + dev_server: bool = False, +) -> Dict[str, Any]: + """ + Starts the zDB Django web application to visualize analysis results. + + Args: + port: The port number the application will listen on. Default is 8080. + name: The name of the run to launch the webapp for. Defaults to the last successful run ('latest'). + allowed_host: The name of the host or the IP address of the server. + Defaults to the IP addresses of the current host. + For MacOSX users, advise setting to "0.0.0.0" or "127.0.0.1" with --docker. + conda: Run the web server in a Conda environment. + docker: Run the web server in a Docker container. + singularity: Run the web server in an Apptainer (Singularity) container (default if no other env flag is set). + debug: Enable debug mode for the webapp (more logs, for development). + dev_server: Enable development server mode (reflects changes on the fly, for development). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + args: List[str] = [] + + if not (1024 <= port <= 65535): + return { + "command_executed": "zdb webapp ...", + "stdout": "", + "stderr": f"Error: Port number {port} is out of valid range (1024-65535).", + "error": "Invalid port number", + "output_files": [], + } + args.append(f"--port={port}") + + if name: + args.append(f"--name={name}") + + if allowed_host: + args.append(f"--allowed_host={allowed_host}") + + if debug: + args.append("--debug") + if dev_server: + args.append("--dev_server") + + return _execute_zdb_command("webapp", args, conda, docker, singularity) + + +@mcp.tool() +def zdb_export( + run_name: str, + conda: bool = False, + docker: bool = False, + singularity: bool = False, +) -> Dict[str, Any]: + """ + Exports the results of a previous zDB run into a compressed archive. + + Args: + run_name: The name of the zDB run to export. + conda: Run the export in a Conda environment. + docker: Run the export in a Docker container. + singularity: Run the export in an Apptainer (Singularity) container (default if no other env flag is set). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + The output_files list will contain the path to the created archive if successful. + """ + args: List[str] = [] + + if not run_name: + return { + "command_executed": "zdb export ...", + "stdout": "", + "stderr": "Error: Run name cannot be empty for export.", + "error": "Missing run name", + "output_files": [], + } + args.append(run_name) # Positional argument + + result = _execute_zdb_command("export", args, conda, docker, singularity) + + # Attempt to infer output archive name. zDB documentation doesn't specify the output name. + # A common pattern is .tar.gz or similar. + # For now, we'll assume it's created in the current directory and might need manual inspection of stdout. + # If zDB had a --output parameter for export, we would use that. + # For now, we can't reliably predict the output file name without more info. + # If stdout contains a line like "Archive created at /path/to/archive.tar.gz", we could parse it. + # For now, we'll leave output_files empty unless we can reliably determine it. + # If the tool consistently names it, e.g., f"{run_name}.zdb.tar.gz", we could add: + # if "error" not in result: + # result["output_files"].append(Path(f"{run_name}.zdb.tar.gz")) + + return result + + +@mcp.tool() +def zdb_import( + archive_file: Path, + conda: bool = False, + docker: bool = False, + singularity: bool = False, +) -> Dict[str, Any]: + """ + Unpacks a zDB archive (created by `zdb export`) into the current directory + so that its results can be used to start the webapp. + + Args: + archive_file: Path to the compressed archive file to import. The file must exist. + conda: Run the import in a Conda environment. + docker: Run the import in a Docker container. + singularity: Run the import in an Apptainer (Singularity) container (default if no other env flag is set). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + args: List[str] = [] + + if not archive_file.is_file(): + return { + "command_executed": "zdb import ...", + "stdout": "", + "stderr": f"Error: Archive file not found at {archive_file}", + "error": "Archive file not found", + "output_files": [], + } + args.append(str(archive_file.resolve())) # Positional argument + + return _execute_zdb_command("import", args, conda, docker, singularity) + + +@mcp.tool() +def zdb_list_runs( + runs_directory: Optional[Path] = None, + conda: bool = False, + docker: bool = False, + singularity: bool = False, +) -> Dict[str, Any]: + """ + Lists the completed zDB runs available to start the website in a given directory. + + Args: + runs_directory: The directory to search for zDB runs. Defaults to the current working directory. + conda: Run the command in a Conda environment. + docker: Run the command in a Docker container. + singularity: Run the command in an Apptainer (Singularity) container (default if no other env flag is set). + + Returns: + A dictionary containing the command executed, stdout, stderr, and any output files. + """ + args: List[str] = [] + + if runs_directory: + if not runs_directory.is_dir(): + return { + "command_executed": "zdb list_runs ...", + "stdout": "", + "stderr": f"Error: Runs directory not found at {runs_directory}", + "error": "Runs directory not found", + "output_files": [], + } + # The documentation doesn't specify a flag for the directory, implying it might be a positional argument + # or an environment variable. Given "in a given directory", a positional argument is most likely. + # However, without explicit CLI help, it's a guess. Let's assume it's passed as a positional argument + # if provided, or zdb defaults to cwd. + args.append(str(runs_directory.resolve())) + + return _execute_zdb_command("list_runs", args, conda, docker, singularity) \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_shim_server.py b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_shim_server.py new file mode 100644 index 0000000000000000000000000000000000000000..ef6fd30084aee08543f4d8d24aca21941729fb62 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_shim_server.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 +from __future__ import annotations + +import ast +from pathlib import Path + +from mcp.server.fastmcp import FastMCP + + +SOURCE_SERVER = Path('/225040511/project/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/app/zdb_server.py') +SERVER_NAME = 'biosci_zdb' + + +class _ShimMCP: + @staticmethod + def tool(): + def _decorator(fn): + return fn + return _decorator + + +def _load_functions(): + code = SOURCE_SERVER.read_text(encoding="utf-8") + tree = ast.parse(code, filename=str(SOURCE_SERVER)) + function_names = [n.name for n in tree.body if isinstance(n, ast.FunctionDef) and not n.name.startswith("_")] + namespace = { + "__name__": "__mcp_source__", + "mcp": _ShimMCP(), + } + exec(compile(code, str(SOURCE_SERVER), "exec"), namespace, namespace) + loaded = [] + for name in function_names: + fn = namespace.get(name) + if callable(fn): + loaded.append(fn) + return loaded + + +mcp = FastMCP(SERVER_NAME) +for _fn in _load_functions(): + mcp.tool()(_fn) + + +if __name__ == "__main__": + mcp.run(transport="stdio") diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/docker-compose.yml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/docker-compose.yml new file mode 100644 index 0000000000000000000000000000000000000000..3b4bd2d346216050cf0d1a74674c9af1baaccad1 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/docker-compose.yml @@ -0,0 +1,22 @@ +version: '3.8' + +services: + mcp-zdb: + build: . + image: mcp-zdb:latest + container_name: mcp-zdb + ports: + - "8000:8000" + environment: + - MCP_SERVER_NAME=zdb + volumes: + - ./workspace:/app/workspace + - ./output:/app/output + restart: unless-stopped + healthcheck: + test: ["CMD", "python", "-c", "import sys; sys.exit(0)"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 5s + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/environment.yaml b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/environment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..01ab95d610b76375295d389eed0be96339224171 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/environment.yaml @@ -0,0 +1,10 @@ + +name: mcp-tool +channels: + - bioconda + - conda-forge + - defaults +dependencies: + - zdb + - python=3.10 + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/requirements.txt b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..fc4702c254694b94825ae9800a56d8f68b1bcda0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/mcp_batch_from_manual_txt/mcp_zdb/requirements.txt @@ -0,0 +1,2 @@ +fastmcp +mcp diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abricate.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abricate.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abricate.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abundancebin.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abundancebin.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..b5216c05dac73d815ddf7d03f764ad357d0fa77d --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/abundancebin.help.txt @@ -0,0 +1,17 @@ +$ conda run -n bioenv_cli abundancebin --help +[rc=255] +Usage: ./abundancebin -input (input filename) + [-kmer_len (composition len, default 20)] + [-output (output file, default inputfile.log)] + [-exclude (count)] + [-exclude_max (count)] + [-OUTPUT_FASTA] + + (if the bin number is known) + -bin_num (bin number) + + (or undergo recursive classification) + -RECURSIVE_CLASSIFICATION] + + +ERROR conda.cli.main_run:execute(127): `conda run abundancebin --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/aragorn.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/aragorn.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..d0902af848f323920d05a852fa7e79de207866fb --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/aragorn.help.txt @@ -0,0 +1,5 @@ +$ conda run -n bioenv_cli aragorn --help +[rc=0] + +--help not recognised, type aragorn -h for help + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/augustus.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/augustus.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..755e9fb3160938b710cc6d5fd140fd6106203e93 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/augustus.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/auspice.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/auspice.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..2eee5beaeaa58bea50ca0e4a7e2dc3e23de74d2e --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/auspice.help.txt @@ -0,0 +1,19 @@ +$ conda run -n bioenv_cli auspice --help +[rc=0] +usage: auspice [-h] [-v] {view,build,develop,convert} ... + +Auspice version 2.39.0. + +Optional arguments: + -h, --help Show this help message and exit. + -v, --version Show program's version number and exit. + +Auspice commands: + {view,build,develop,convert} + +Auspice is an interactive visualisation tool for phylogenomic data. It can be +used to display local datasets (see "auspice view -h" for details), or to +build a customised version of the software (see "auspice build -h" for +details). This is the software which powers the visualisations on nextstrain. +org and auspice.us, amoung others. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bamtools.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bamtools.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..abb8c0188ead10b89e39d6257feab9f76df6bedb --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bamtools.help.txt @@ -0,0 +1,24 @@ +$ conda run -n bioenv bamtools --help +[rc=0] + + +usage: bamtools [--help] COMMAND [ARGS] + +Available bamtools commands: + convert Converts between BAM and a number of other formats + count Prints number of alignments in BAM file(s) + coverage Prints coverage statistics from the input BAM file + filter Filters BAM file(s) by user-specified criteria + header Prints BAM header information + index Generates index for BAM file + merge Merge multiple BAM files into single file + random Select random alignments from existing BAM file(s), intended more as a testing tool. + resolve Resolves paired-end reads (marking the IsProperPair flag as needed) + revert Removes duplicate marks and restores original base qualities + sort Sorts the BAM file according to some criteria + split Splits a BAM file on user-specified property, creating a new BAM output file for each value found + stats Prints some basic statistics from input BAM file(s) + +See 'bamtools help COMMAND' for more information on a specific command. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/barrnap.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/barrnap.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/barrnap.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bbmap.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bbmap.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..0b8f7529448a392b672eab376bb9b4411884c457 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bbmap.help.txt @@ -0,0 +1,102 @@ +$ conda run -n bioenv java -help +[rc=0] + +Usage: java [options] [args...] + (to execute a class) + or java [options] -jar [args...] + (to execute a jar file) + or java [options] -m [/] [args...] + java [options] --module [/] [args...] + (to execute the main class in a module) + or java [options] [args] + (to execute a single source-file program) + + Arguments following the main class, source file, -jar , + -m or --module / are passed as the arguments to + main class. + + where options include: + + -cp + -classpath + --class-path + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -p + --module-path ... + A : separated list of directories, each directory + is a directory of modules. + --upgrade-module-path ... + A : separated list of directories, each directory + is a directory of modules that replace upgradeable + modules in the runtime image + --add-modules [,...] + root modules to resolve in addition to the initial module. + can also be ALL-DEFAULT, ALL-SYSTEM, + ALL-MODULE-PATH. + --enable-native-access [,...] + modules that are permitted to perform restricted native operations. + can also be ALL-UNNAMED. + --list-modules + list observable modules and exit + -d + --describe-module + describe a module and exit + --dry-run create VM and load main class but do not execute main method. + The --dry-run option may be useful for validating the + command-line options such as the module system configuration. + --validate-modules + validate all modules and exit + The --validate-modules option may be useful for finding + conflicts and other errors with modules on the module path. + -D= + set a system property + -verbose:[class|module|gc|jni] + enable verbose output for the given subsystem + -version print product version to the error stream and exit + --version print product version to the output stream and exit + -showversion print product version to the error stream and continue + --show-version + print product version to the output stream and continue + --show-module-resolution + show module resolution output during startup + -? -h -help + print this help message to the error stream + --help print this help message to the output stream + -X print help on extra options to the error stream + --help-extra print help on extra options to the output stream + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:jdwp + see also -agentlib:jdwp=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image + HiDPI scaled images are automatically supported and used + if available. The unscaled image filename, e.g. image.ext, + should always be passed as the argument to the -splash option. + The most appropriate scaled image provided will be picked up + automatically. + See the SplashScreen API documentation for more information + @argument files + one or more argument files containing options + -disable-@files + prevent further argument file expansion + --enable-preview + allow classes to depend on preview features of this release +To specify an argument for a long option, you can use --= or +-- . + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bcftools.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bcftools.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..755e9fb3160938b710cc6d5fd140fd6106203e93 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bcftools.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedops.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedops.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..f69aed818e355fb6aaefb08eea87125d23b34bcd --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedops.help.txt @@ -0,0 +1,51 @@ +$ conda run -n bioenv_cli bedops --help +[rc=0] +bedops + citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract + https://doi.org/10.1093/bioinformatics/bts277 + version: 2.4.42 (typical) + authors: Shane Neph & Scott Kuehn + + USAGE: bedops [process-flags] * + + Every input file must be sorted per the sort-bed utility. + Each operation requires a minimum number of files as shown below. + There is no fixed maximum number of files that may be used. + Input files must have at least the first 3 columns of the BED specification. + The program accepts BED and Starch file formats. + May use '-' for a file to indicate reading from standard input (BED format only). + + Process Flags: + --chrom Jump to and process data for given only. + --ec Error check input files (slower). + --header Accept headers (VCF, GFF, SAM, BED, WIG) in any input file. + --help Print this message and exit successfully. + --help- Detailed help on . + An example is --help-c or --help-complement + --range L:R Add 'L' bp to all start coordinates and 'R' bp to end + coordinates. Either value may be + or - to grow or + shrink regions. With the -e/-n operations, the first + (reference) file is not padded, unlike all other files. + --range S Pad or shrink input file(s) coordinates symmetrically by S. + This is shorthand for: --range -S:S. + --version Print program information. + + Operations: (choose one of) + -c, --complement [-L] File1 [File]* + -d, --difference ReferenceFile File2 [File]* + -e, --element-of [bp | percentage] ReferenceFile File2 [File]* + by default, -e 100% is used. 'bedops -e 1' is also popular. + -i, --intersect File1 File2 [File]* + -m, --merge File1 [File]* + -n, --not-element-of [bp | percentage] ReferenceFile File2 [File]* + by default, -n 100% is used. 'bedops -n 1' is also popular. + -p, --partition File1 [File]* + -s, --symmdiff File1 File2 [File]* + -u, --everything File1 [File]* + -w, --chop [bp] [--stagger ] [-x] File1 [File]* + by default, -w 1 is used with no staggering. + +Example: bedops --range 10 -u file1.bed + NOTE: Only operations -e|n|u preserve all columns (no flattening) + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedtools.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedtools.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..cb4f0db368ae7a115db6b4d29c8ff9b018437d47 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bedtools.help.txt @@ -0,0 +1,83 @@ +$ conda run -n bioenv bedtools --help +[rc=0] +bedtools is a powerful toolset for genome arithmetic. + +Version: v2.31.1 +About: developed in the quinlanlab.org and by many contributors worldwide. +Docs: http://bedtools.readthedocs.io/ +Code: https://github.com/arq5x/bedtools2 +Mail: https://groups.google.com/forum/#!forum/bedtools-discuss + +Usage: bedtools [options] + +The bedtools sub-commands include: + +[ Genome arithmetic ] + intersect Find overlapping intervals in various ways. + window Find overlapping intervals within a window around an interval. + closest Find the closest, potentially non-overlapping interval. + coverage Compute the coverage over defined intervals. + map Apply a function to a column for each overlapping interval. + genomecov Compute the coverage over an entire genome. + merge Combine overlapping/nearby intervals into a single interval. + cluster Cluster (but don't merge) overlapping/nearby intervals. + complement Extract intervals _not_ represented by an interval file. + shift Adjust the position of intervals. + subtract Remove intervals based on overlaps b/w two files. + slop Adjust the size of intervals. + flank Create new intervals from the flanks of existing intervals. + sort Order the intervals in a file. + random Generate random intervals in a genome. + shuffle Randomly redistribute intervals in a genome. + sample Sample random records from file using reservoir sampling. + spacing Report the gap lengths between intervals in a file. + annotate Annotate coverage of features from multiple files. + +[ Multi-way file comparisons ] + multiinter Identifies common intervals among multiple interval files. + unionbedg Combines coverage intervals from multiple BEDGRAPH files. + +[ Paired-end manipulation ] + pairtobed Find pairs that overlap intervals in various ways. + pairtopair Find pairs that overlap other pairs in various ways. + +[ Format conversion ] + bamtobed Convert BAM alignments to BED (& other) formats. + bedtobam Convert intervals to BAM records. + bamtofastq Convert BAM records to FASTQ records. + bedpetobam Convert BEDPE intervals to BAM records. + bed12tobed6 Breaks BED12 intervals into discrete BED6 intervals. + +[ Fasta manipulation ] + getfasta Use intervals to extract sequences from a FASTA file. + maskfasta Use intervals to mask sequences from a FASTA file. + nuc Profile the nucleotide content of intervals in a FASTA file. + +[ BAM focused tools ] + multicov Counts coverage from multiple BAMs at specific intervals. + tag Tag BAM alignments based on overlaps with interval files. + +[ Statistical relationships ] + jaccard Calculate the Jaccard statistic b/w two sets of intervals. + reldist Calculate the distribution of relative distances b/w two files. + fisher Calculate Fisher statistic b/w two feature files. + +[ Miscellaneous tools ] + overlap Computes the amount of overlap from two intervals. + igv Create an IGV snapshot batch script. + links Create a HTML page of links to UCSC locations. + makewindows Make interval "windows" across a genome. + groupby Group by common cols. & summarize oth. cols. (~ SQL "groupBy") + expand Replicate lines based on lists of values in columns. + split Split a file into multiple files with equal records or base pairs. + summary Statistical summary of intervals in a file. + +[ General Parameters ] + --cram-ref Reference used by a CRAM input + +[ General help ] + --help Print this help menu. + --version What version of bedtools are you using?. + --contact Feature requests, bugs, mailing lists, etc. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioawk.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioawk.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..cd530cb0dab01ed78613d8bef4334c07f551c6f0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioawk.help.txt @@ -0,0 +1,7 @@ +$ conda run -n bioenv_cli bioawk --help +[rc=2] + +bioawk: no program given + + +ERROR conda.cli.main_run:execute(127): `conda run bioawk --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affy.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affy.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affy.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affyio.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affyio.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-affyio.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotate.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotate.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotate.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotationdbi.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotationdbi.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-annotationdbi.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-apeglm.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-apeglm.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-apeglm.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-beachmat.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-beachmat.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-beachmat.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biobase.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biobase.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biobase.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocgenerics.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocgenerics.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocgenerics.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocneighbors.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocneighbors.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocneighbors.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocsingular.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocsingular.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biocsingular.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomart.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomart.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomart.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomformat.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomformat.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biomformat.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biostrings.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biostrings.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-biostrings.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-clustifyr.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-clustifyr.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-clustifyr.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-cytomapper.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-cytomapper.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-cytomapper.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-dirichletmultinomial.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-dirichletmultinomial.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-dirichletmultinomial.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-edger.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-edger.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-edger.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genefilter.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genefilter.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genefilter.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomeinfodbdata.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomeinfodbdata.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71801163bb9849e76c8ca06ae9f913c24be7df84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomeinfodbdata.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomicfeatures.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomicfeatures.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-genomicfeatures.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-go.db.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-go.db.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-go.db.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gosemsim.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gosemsim.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gosemsim.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-graph.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-graph.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-graph.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gsva.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gsva.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-gsva.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-impute.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-impute.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-impute.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-infercnv.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-infercnv.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-infercnv.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-keggrest.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-keggrest.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-keggrest.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-limma.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-limma.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-limma.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-metabolomicsworkbenchr.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-metabolomicsworkbenchr.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-metabolomicsworkbenchr.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-nebulosa.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-nebulosa.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-nebulosa.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-noiseq.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-noiseq.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-noiseq.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-org.hs.eg.db.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-org.hs.eg.db.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-org.hs.eg.db.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-preprocesscore.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-preprocesscore.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-preprocesscore.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-proteomicsannotationhubdata.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-proteomicsannotationhubdata.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-proteomicsannotationhubdata.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-protgenerics.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-protgenerics.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-protgenerics.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rbgl.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rbgl.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rbgl.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rforproteomics.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rforproteomics.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rforproteomics.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rgraphviz.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rgraphviz.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rgraphviz.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rhdf5.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rhdf5.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71801163bb9849e76c8ca06ae9f913c24be7df84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rhdf5.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsamtools.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsamtools.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsamtools.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsubread.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsubread.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rsubread.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rtracklayer.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rtracklayer.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-rtracklayer.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-s4vectors.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-s4vectors.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71801163bb9849e76c8ca06ae9f913c24be7df84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-s4vectors.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-sccb2.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-sccb2.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-sccb2.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scmageck.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scmageck.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scmageck.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-screpertoire.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-screpertoire.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-screpertoire.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scrnaseq.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scrnaseq.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-scrnaseq.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-shortread.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-shortread.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-shortread.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-singlecellmultimodal.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-singlecellmultimodal.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-singlecellmultimodal.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spaniel.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spaniel.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spaniel.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialcpie.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialcpie.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialcpie.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialexperiment.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialexperiment.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialexperiment.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialheatmap.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialheatmap.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-spatialheatmap.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-tximport.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-tximport.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-tximport.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-variantannotation.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-variantannotation.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-variantannotation.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-xvector.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-xvector.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71801163bb9849e76c8ca06ae9f913c24be7df84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-xvector.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-zlibbioc.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-zlibbioc.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71801163bb9849e76c8ca06ae9f913c24be7df84 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bioconductor-zlibbioc.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie2.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie2.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bowtie2.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bpipe.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bpipe.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bpipe.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bwa.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bwa.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/bwa.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cd-hit.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cd-hit.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..e3ab3b4e04bf3eca2298945e6b1947cc779d0cf9 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cd-hit.help.txt @@ -0,0 +1,89 @@ +$ conda run -n bioenv_cli cd-hit --help +[rc=1] + ====== CD-HIT version 4.8.1 (built on Nov 12 2024) ====== + +Usage: cd-hit [Options] + +Options + + -i input filename in fasta format, required, can be in .gz format + -o output filename, required + -c sequence identity threshold, default 0.9 + this is the default cd-hit's "global sequence identity" calculated as: + number of identical amino acids or bases in alignment + divided by the full length of the shorter sequence + -G use global sequence identity, default 1 + if set to 0, then use local sequence identity, calculated as : + number of identical amino acids or bases in alignment + divided by the length of the alignment + NOTE!!! don't use -G 0 unless you use alignment coverage controls + see options -aL, -AL, -aS, -AS + -b band_width of alignment, default 20 + -M memory limit (in MB) for the program, default 800; 0 for unlimitted; + -T number of threads, default 1; with 0, all CPUs will be used + -n word_length, default 5, see user's guide for choosing it + -l length of throw_away_sequences, default 10 + -t tolerance for redundance, default 2 + -d length of description in .clstr file, default 20 + if set to 0, it takes the fasta defline and stops at first space + -s length difference cutoff, default 0.0 + if set to 0.9, the shorter sequences need to be + at least 90% length of the representative of the cluster + -S length difference cutoff in amino acid, default 999999 + if set to 60, the length difference between the shorter sequences + and the representative of the cluster can not be bigger than 60 + -aL alignment coverage for the longer sequence, default 0.0 + if set to 0.9, the alignment must covers 90% of the sequence + -AL alignment coverage control for the longer sequence, default 99999999 + if set to 60, and the length of the sequence is 400, + then the alignment must be >= 340 (400-60) residues + -aS alignment coverage for the shorter sequence, default 0.0 + if set to 0.9, the alignment must covers 90% of the sequence + -AS alignment coverage control for the shorter sequence, default 99999999 + if set to 60, and the length of the sequence is 400, + then the alignment must be >= 340 (400-60) residues + -A minimal alignment coverage control for the both sequences, default 0 + alignment must cover >= this value for both sequences + -uL maximum unmatched percentage for the longer sequence, default 1.0 + if set to 0.1, the unmatched region (excluding leading and tailing gaps) + must not be more than 10% of the sequence + -uS maximum unmatched percentage for the shorter sequence, default 1.0 + if set to 0.1, the unmatched region (excluding leading and tailing gaps) + must not be more than 10% of the sequence + -U maximum unmatched length, default 99999999 + if set to 10, the unmatched region (excluding leading and tailing gaps) + must not be more than 10 bases + -B 1 or 0, default 0, by default, sequences are stored in RAM + if set to 1, sequence are stored on hard drive + !! No longer supported !! + -p 1 or 0, default 0 + if set to 1, print alignment overlap in .clstr file + -g 1 or 0, default 0 + by cd-hit's default algorithm, a sequence is clustered to the first + cluster that meet the threshold (fast cluster). If set to 1, the program + will cluster it into the most similar cluster that meet the threshold + (accurate but slow mode) + but either 1 or 0 won't change the representatives of final clusters + -sc sort clusters by size (number of sequences), default 0, output clusters by decreasing length + if set to 1, output clusters by decreasing size + -sf sort fasta/fastq by cluster size (number of sequences), default 0, no sorting + if set to 1, output sequences by decreasing cluster size + this can be very slow if the input is in .gz format + -bak write backup cluster file (1 or 0, default 0) + -h print this help + + Questions, bugs, contact Weizhong Li at liwz@sdsc.edu + For updated versions and information, please visit: http://cd-hit.org + or https://github.com/weizhongli/cdhit + + cd-hit web server is also available from http://cd-hit.org + + If you find cd-hit useful, please kindly cite: + + "CD-HIT: a fast program for clustering and comparing large sets of protein or nucleotide sequences", Weizhong Li & Adam Godzik. Bioinformatics, (2006) 22:1658-1659 + "CD-HIT: accelerated for clustering the next generation sequencing data", Limin Fu, Beifang Niu, Zhengwei Zhu, Sitao Wu & Weizhong Li. Bioinformatics, (2012) 28:3150-3152 + + + + +ERROR conda.cli.main_run:execute(127): `conda run cd-hit --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cellrank.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cellrank.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..d689626f837778a9d40488a6e2c9d224ba7b9d5b --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cellrank.help.txt @@ -0,0 +1,43 @@ +$ conda run -n bioenv python -m cellrank --help +[rc=1] + +Traceback (most recent call last): + File "", line 189, in _run_module_as_main + File "", line 148, in _get_module_details + File "", line 112, in _get_module_details + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/__init__.py", line 2, in + import cellrank.pl + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/pl/__init__.py", line 2, in + from cellrank.pl._graph import graph + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/pl/_graph.py", line 23, in + from cellrank.ul._docs import d + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/ul/__init__.py", line 2, in + import cellrank.ul.models + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/ul/models/__init__.py", line 2, in + from cellrank.ul.models._base_model import BaseModel, FailedModel, FittedModel + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/ul/models/_base_model.py", line 22, in + from cellrank.tl import Lineage + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/tl/__init__.py", line 2, in + import cellrank.tl.kernels + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/tl/kernels/__init__.py", line 4, in + from cellrank.tl.kernels._velocity_kernel import VelocityKernel + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/cellrank/tl/kernels/_velocity_kernel.py", line 8, in + from scvelo.preprocessing.moments import get_moments + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/__init__.py", line 5, in + from scvelo import datasets, logging + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/datasets/__init__.py", line 1, in + from ._datasets import ( + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/datasets/_datasets.py", line 10, in + from scvelo.core import cleanup + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/core/__init__.py", line 1, in + from ._anndata import ( + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/core/_anndata.py", line 15, in + from scvelo import logging as logg + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/logging.py", line 12, in + from scvelo import settings + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/scvelo/settings.py", line 91, in + warnings.filterwarnings("ignore", category=cbook.mplDeprecation) + ^^^^^^^^^^^^^^^^^^^^ +AttributeError: module 'matplotlib.cbook' has no attribute 'mplDeprecation' + +ERROR conda.cli.main_run:execute(127): `conda run python -m cellrank --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/circos.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/circos.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/circos.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalo.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalo.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..54b5b93b166d74874c3e48265b86dcff3b1e8bc4 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalo.help.txt @@ -0,0 +1,70 @@ +$ conda run -n bioenv_cli clustalo --help +[rc=0] +Clustal Omega - 1.2.4 (AndreaGiacomo) + +If you like Clustal-Omega please cite: + Sievers F, Wilm A, Dineen D, Gibson TJ, Karplus K, Li W, Lopez R, McWilliam H, Remmert M, Söding J, Thompson JD, Higgins DG. + Fast, scalable generation of high-quality protein multiple sequence alignments using Clustal Omega. + Mol Syst Biol. 2011 Oct 11;7:539. doi: 10.1038/msb.2011.75. PMID: 21988835. +If you don't like Clustal-Omega, please let us know why (and cite us anyway). + +Check http://www.clustal.org for more information and updates. + +Usage: clustalo [-hv] [-i {,-}] [--hmm-in=]... [--hmm-batch=] [--dealign] [--profile1=] [--profile2=] [--is-profile] [-t {Protein, RNA, DNA}] [--infmt={a2m=fa[sta],clu[stal],msf,phy[lip],selex,st[ockholm],vie[nna]}] [--distmat-in=] [--distmat-out=] [--guidetree-in=] [--guidetree-out=] [--pileup] [--full] [--full-iter] [--cluster-size=] [--clustering-out=] [--trans=] [--posterior-out=] [--use-kimura] [--percent-id] [-o {file,-}] [--outfmt={a2m=fa[sta],clu[stal],msf,phy[lip],selex,st[ockholm],vie[nna]}] [--residuenumber] [--wrap=] [--output-order={input-order,tree-order}] [--iterations=] [--max-guidetree-iterations=] [--max-hmm-iterations=] [--maxnumseq=] [--maxseqlen=] [--auto] [--threads=] [--pseudo=] [-l ] [--version] [--long-version] [--force] [--MAC-RAM=] + +A typical invocation would be: clustalo -i my-in-seqs.fa -o my-out-seqs.fa -v +See below for a list of all options. + +Sequence Input: + -i, --in, --infile={,-} Multiple sequence input file (- for stdin) + --hmm-in= HMM input files + --hmm-batch= specify HMMs for individual sequences + --dealign Dealign input sequences + --profile1, --p1= Pre-aligned multiple sequence file (aligned columns will be kept fix) + --profile2, --p2= Pre-aligned multiple sequence file (aligned columns will be kept fix) + --is-profile disable check if profile, force profile (default no) + -t, --seqtype={Protein, RNA, DNA} Force a sequence type (default: auto) + --infmt={a2m=fa[sta],clu[stal],msf,phy[lip],selex,st[ockholm],vie[nna]} Forced sequence input file format (default: auto) + +Clustering: + --distmat-in= Pairwise distance matrix input file (skips distance computation) + --distmat-out= Pairwise distance matrix output file + --guidetree-in= Guide tree input file (skips distance computation and guide-tree clustering step) + --guidetree-out= Guide tree output file + --pileup Sequentially align sequences + --full Use full distance matrix for guide-tree calculation (might be slow; mBed is default) + --full-iter Use full distance matrix for guide-tree calculation during iteration (might be slowish; mBed is default) + --cluster-size= soft maximum of sequences in sub-clusters + --clustering-out= Clustering output file + --trans= use transitivity (default: 0) + --posterior-out= Posterior probability output file + --use-kimura use Kimura distance correction for aligned sequences (default no) + --percent-id convert distances into percent identities (default no) + +Alignment Output: + -o, --out, --outfile={file,-} Multiple sequence alignment output file (default: stdout) + --outfmt={a2m=fa[sta],clu[stal],msf,phy[lip],selex,st[ockholm],vie[nna]} MSA output file format (default: fasta) + --residuenumber, --resno in Clustal format print residue numbers (default no) + --wrap= number of residues before line-wrap in output + --output-order={input-order,tree-order} MSA output order like in input/guide-tree + +Iteration: + --iterations, --iter= Number of (combined guide-tree/HMM) iterations + --max-guidetree-iterations= Maximum number of guidetree iterations + --max-hmm-iterations= Maximum number of HMM iterations + +Limits (will exit early, if exceeded): + --maxnumseq= Maximum allowed number of sequences + --maxseqlen= Maximum allowed sequence length + +Miscellaneous: + --auto Set options automatically (might overwrite some of your options) + --threads= Number of processors to use + --pseudo= Input file for pseudo-count parameters + -l, --log= Log all non-essential output to this file + -h, --help Print this help and exit + -v, --verbose Verbose output (increases if given multiple times) + --version Print version information and exit + --long-version Print long version information and exit + --force Force file overwriting + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalw.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalw.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..936749e9a7a2a76dcaa3cd3d20eb95ede1aecacf --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/clustalw.help.txt @@ -0,0 +1,13 @@ +$ conda run -n bioenv_cli clustalw --help +[rc=1] + + + + CLUSTAL 2.1 Multiple Sequence Alignments + + + + +Error: unknown option --help + +ERROR conda.cli.main_run:execute(127): `conda run clustalw --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cnmf.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cnmf.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..46cdc74197ea31e8e442c067bd097781d3cf4fb0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cnmf.help.txt @@ -0,0 +1,89 @@ +$ conda run -n bioenv cnmf --help +[rc=0] +usage: cnmf [-h] [--name [NAME]] [--output-dir [OUTPUT_DIR]] [-c COUNTS] + [-k COMPONENTS [COMPONENTS ...]] [-n N_ITER] + [--total-workers TOTAL_WORKERS] [--seed SEED] + [--genes-file GENES_FILE] [--numgenes NUMGENES] [--tpm TPM] + [--max-nmf-iter MAX_NMF_ITER] + [--beta-loss {frobenius,kullback-leibler,itakura-saito}] + [--init {random,nndsvd}] [--densify] [--worker-index WORKER_INDEX] + [--skip-completed-runs] + [--local-density-threshold LOCAL_DENSITY_THRESHOLD] + [--local-neighborhood-size LOCAL_NEIGHBORHOOD_SIZE] + [--show-clustering] [--build-reference] + {prepare,factorize,combine,consensus,k_selection_plot} + +positional arguments: + {prepare,factorize,combine,consensus,k_selection_plot} + +options: + -h, --help show this help message and exit + --name [NAME] [all] Name for analysis. All output will be placed in + [output-dir]/[name]/... + --output-dir [OUTPUT_DIR] + [all] Output directory. All output will be placed in + [output-dir]/[name]/... + -c COUNTS, --counts COUNTS + [prepare] Input (cell x gene) counts matrix as .h5ad, + .mtx, df.npz, or tab delimited text file + -k COMPONENTS [COMPONENTS ...], --components COMPONENTS [COMPONENTS ...] + [prepare] Numper of components (k) for matrix + factorization. Several can be specified with "-k 8 9 + 10" + -n N_ITER, --n-iter N_ITER + [prepare] Number of factorization replicates + --total-workers TOTAL_WORKERS + [all] Total number of workers to distribute jobs to + --seed SEED [prepare] Seed for pseudorandom number generation + --genes-file GENES_FILE + [prepare] File containing a list of genes to include, + one gene per line. Must match column labels of counts + matrix. + --numgenes NUMGENES [prepare] Number of high variance genes to use for + matrix factorization. + --tpm TPM [prepare] Pre-computed (cell x gene) TPM values as + df.npz or tab separated txt file. If not provided TPM + will be calculated automatically + --max-nmf-iter MAX_NMF_ITER + [prepare] Max number of iterations per individual NMF + run (default 1000) + --beta-loss {frobenius,kullback-leibler,itakura-saito} + [prepare] Loss function for NMF (default frobenius) + --init {random,nndsvd} + [prepare] Initialization algorithm for NMF (default + random) + --densify [prepare] Treat the input data as non-sparse (default + False) + --worker-index WORKER_INDEX + [factorize] Index of current worker (the first worker + should have index 0) + --skip-completed-runs + [factorize] Skip previously completed runs. Must re- + run prepare first to update completed runs + --local-density-threshold LOCAL_DENSITY_THRESHOLD + [consensus] Threshold for the local density filtering. + This string must convert to a float >0 and <=2 + --local-neighborhood-size LOCAL_NEIGHBORHOOD_SIZE + [consensus] Fraction of the number of replicates to + use as nearest neighbors for local density filtering + --show-clustering [consensus] Produce a clustergram figure summarizing + the spectra clustering + --build-reference [consensus] Generates a reference spectra for use in + starCAT + + +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_csv from `anndata` is deprecated. Import anndata.io.read_csv instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_excel from `anndata` is deprecated. Import anndata.io.read_excel instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_hdf from `anndata` is deprecated. Import anndata.io.read_hdf instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_loom from `anndata` is deprecated. Import anndata.io.read_loom instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_mtx from `anndata` is deprecated. Import anndata.io.read_mtx instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_text from `anndata` is deprecated. Import anndata.io.read_text instead. + warnings.warn(msg, FutureWarning) +/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/anndata/utils.py:434: FutureWarning: Importing read_umi_tools from `anndata` is deprecated. Import anndata.io.read_umi_tools instead. + warnings.warn(msg, FutureWarning) + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cromwell.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cromwell.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71457b768d443bb4a196f9cd0102e3abafb78d28 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cromwell.help.txt @@ -0,0 +1,102 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [options] [args...] + (to execute a class) + or java [options] -jar [args...] + (to execute a jar file) + or java [options] -m [/] [args...] + java [options] --module [/] [args...] + (to execute the main class in a module) + or java [options] [args] + (to execute a single source-file program) + + Arguments following the main class, source file, -jar , + -m or --module / are passed as the arguments to + main class. + + where options include: + + -cp + -classpath + --class-path + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -p + --module-path ... + A : separated list of directories, each directory + is a directory of modules. + --upgrade-module-path ... + A : separated list of directories, each directory + is a directory of modules that replace upgradeable + modules in the runtime image + --add-modules [,...] + root modules to resolve in addition to the initial module. + can also be ALL-DEFAULT, ALL-SYSTEM, + ALL-MODULE-PATH. + --enable-native-access [,...] + modules that are permitted to perform restricted native operations. + can also be ALL-UNNAMED. + --list-modules + list observable modules and exit + -d + --describe-module + describe a module and exit + --dry-run create VM and load main class but do not execute main method. + The --dry-run option may be useful for validating the + command-line options such as the module system configuration. + --validate-modules + validate all modules and exit + The --validate-modules option may be useful for finding + conflicts and other errors with modules on the module path. + -D= + set a system property + -verbose:[class|module|gc|jni] + enable verbose output for the given subsystem + -version print product version to the error stream and exit + --version print product version to the output stream and exit + -showversion print product version to the error stream and continue + --show-version + print product version to the output stream and continue + --show-module-resolution + show module resolution output during startup + -? -h -help + print this help message to the error stream + --help print this help message to the output stream + -X print help on extra options to the error stream + --help-extra print help on extra options to the output stream + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:jdwp + see also -agentlib:jdwp=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image + HiDPI scaled images are automatically supported and used + if available. The unscaled image filename, e.g. image.ext, + should always be passed as the argument to the -splash option. + The most appropriate scaled image provided will be picked up + automatically. + See the SplashScreen API documentation for more information + @argument files + one or more argument files containing options + -disable-@files + prevent further argument file expansion + --enable-preview + allow classes to depend on preview features of this release +To specify an argument for a long option, you can use --= or +-- . + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/csvtk.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/csvtk.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..28915e4ab720fbcf75590a6fc769011d974bd7da --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/csvtk.help.txt @@ -0,0 +1,145 @@ +$ conda run -n bioenv_cli csvtk --help +[rc=0] +csvtk -- a cross-platform, efficient and practical CSV/TSV toolkit + +Version: 0.31.0 + +Author: Wei Shen + +Documents : http://shenwei356.github.io/csvtk +Source code: https://github.com/shenwei356/csvtk + +Attention: + + 1. By default, csvtk assumes input files have header row, if not, switch flag "-H" on. + 2. By default, csvtk handles CSV files, use flag "-t" for tab-delimited files. + 3. Column names should be unique. + 4. By default, lines starting with "#" will be ignored, if the header row + starts with "#", please assign flag "-C" another rare symbol, e.g. '$'. + 5. Do not mix use field (column) numbers and names to specify columns to operate. + 6. The CSV parser requires all the lines have same numbers of fields/columns. + Even lines with spaces will cause error. + Use '-I/--ignore-illegal-row' to skip these lines if neccessary. + You can also use "csvtk fix" to fix files with different numbers of columns in rows. + 7. If double-quotes exist in fields not enclosed with double-quotes, e.g., + x,a "b" c,1 + It would report error: + bare " in non-quoted-field. + Please switch on the flag "-l" or use "csvtk fix-quotes" to fix it. + 8. If somes fields have only a double-quote eighter in the beginning or in the end, e.g., + x,d "e","a" b c,1 + It would report error: + extraneous or missing " in quoted-field + Please use "csvtk fix-quotes" to fix it, and use "csvtk del-quotes" to reset to the + original format as needed. + +Environment variables for frequently used global flags: + + - "CSVTK_T" for flag "-t/--tabs" + - "CSVTK_H" for flag "-H/--no-header-row" + - "CSVTK_QUIET" for flag "--quiet" + +You can also create a soft link named "tsvtk" for "csvtk", +which sets "-t/--tabs" by default. + +Usage: + csvtk [command] + +Commands for Information: + corr calculate Pearson correlation between two columns + dim dimensions of CSV file + headers print headers + ncol print number of columns + nrow print number of records + summary summary statistics of selected numeric or text fields (groupby group fields) + watch monitor the specified fields + +Format Conversion: + csv2json convert CSV to JSON format + csv2md convert CSV to markdown format + csv2rst convert CSV to reStructuredText format + csv2tab convert CSV to tabular format + csv2xlsx convert CSV/TSV files to XLSX file + pretty convert CSV to a readable aligned table + space2tab convert space delimited format to TSV + splitxlsx split XLSX sheet into multiple sheets according to column values + tab2csv convert tabular format to CSV + xlsx2csv convert XLSX to CSV format + +Commands for Set Operation: + comb compute combinations of items at every row + concat concatenate CSV/TSV files by rows + cut select and arrange fields + filter filter rows by values of selected fields with arithmetic expression + filter2 filter rows by awk-like arithmetic/string expressions + freq frequencies of selected fields + grep grep data by selected fields with patterns/regular expressions + head print first N records + inter intersection of multiple files + join join files by selected fields (inner, left and outer join) + sample sampling by proportion + split split CSV/TSV into multiple files according to column values + uniq unique data without sorting + +Commands for Edit: + add-header add column names + del-header delete column names + del-quotes remove extra double quotes added by 'fix-quotes' + fix fix CSV/TSV with different numbers of columns in rows + fix-quotes fix malformed CSV/TSV caused by double-quotes + fmtdate format date of selected fields + mutate create new column from selected fields by regular expression + mutate2 create a new column from selected fields by awk-like arithmetic/string expressions + mutate3 create a new column from selected fields with Go-like expressions + rename rename column names with new names + rename2 rename column names by regular expression + replace replace data of selected fields by regular expression + round round float to n decimal places + +Commands for Data Transformation: + fold fold multiple values of a field into cells of groups + gather gather columns into key-value pairs, like tidyr::gather/pivot_longer + sep separate column into multiple columns + spread spread a key-value pair across multiple columns, like tidyr::spread/pivot_wider + transpose transpose CSV data + unfold unfold multiple values in cells of a field + +Commands for Ordering: + sort sort by selected fields + +Commands for Ploting: + plot plot common figures + +Commands for Miscellaneous Functions: + cat stream file to stdout and report progress on stderr + +Additional Commands: + genautocomplete generate shell autocompletion script (bash|zsh|fish|powershell) + version print version information and check for update + +Flags: + -C, --comment-char string lines starting with commment-character will be ignored. if your header + row starts with '#', please assign "-C" another rare symbol, e.g. '$' + (default "#") + -U, --delete-header do not output header row + -d, --delimiter string delimiting character of the input CSV file (default ",") + -h, --help help for csvtk + -E, --ignore-empty-row ignore empty rows + -I, --ignore-illegal-row ignore illegal rows. You can also use 'csvtk fix' to fix files with + different numbers of columns in rows + -X, --infile-list string file of input files list (one file per line), if given, they are appended + to files from cli arguments + -l, --lazy-quotes if given, a quote may appear in an unquoted field and a non-doubled quote + may appear in a quoted field + -H, --no-header-row specifies that the input CSV file does not have header row + -j, --num-cpus int number of CPUs to use (default 4) + -D, --out-delimiter string delimiting character of the output CSV file, e.g., -D $'\t' for tab + (default ",") + -o, --out-file string out file ("-" for stdout, suffix .gz for gzipped out) (default "-") + -T, --out-tabs specifies that the output is delimited with tabs. Overrides "-D" + --quiet be quiet and do not show extra information and warnings + -Z, --show-row-number show row number as the first column, with header row skipped + -t, --tabs specifies that the input CSV file is delimited with tabs. Overrides "-d" + +Use "csvtk [command] --help" for more information about a command. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytoscape.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytoscape.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..71457b768d443bb4a196f9cd0102e3abafb78d28 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytoscape.help.txt @@ -0,0 +1,102 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [options] [args...] + (to execute a class) + or java [options] -jar [args...] + (to execute a jar file) + or java [options] -m [/] [args...] + java [options] --module [/] [args...] + (to execute the main class in a module) + or java [options] [args] + (to execute a single source-file program) + + Arguments following the main class, source file, -jar , + -m or --module / are passed as the arguments to + main class. + + where options include: + + -cp + -classpath + --class-path + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -p + --module-path ... + A : separated list of directories, each directory + is a directory of modules. + --upgrade-module-path ... + A : separated list of directories, each directory + is a directory of modules that replace upgradeable + modules in the runtime image + --add-modules [,...] + root modules to resolve in addition to the initial module. + can also be ALL-DEFAULT, ALL-SYSTEM, + ALL-MODULE-PATH. + --enable-native-access [,...] + modules that are permitted to perform restricted native operations. + can also be ALL-UNNAMED. + --list-modules + list observable modules and exit + -d + --describe-module + describe a module and exit + --dry-run create VM and load main class but do not execute main method. + The --dry-run option may be useful for validating the + command-line options such as the module system configuration. + --validate-modules + validate all modules and exit + The --validate-modules option may be useful for finding + conflicts and other errors with modules on the module path. + -D= + set a system property + -verbose:[class|module|gc|jni] + enable verbose output for the given subsystem + -version print product version to the error stream and exit + --version print product version to the output stream and exit + -showversion print product version to the error stream and continue + --show-version + print product version to the output stream and continue + --show-module-resolution + show module resolution output during startup + -? -h -help + print this help message to the error stream + --help print this help message to the output stream + -X print help on extra options to the error stream + --help-extra print help on extra options to the output stream + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:jdwp + see also -agentlib:jdwp=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image + HiDPI scaled images are automatically supported and used + if available. The unscaled image filename, e.g. image.ext, + should always be passed as the argument to the -splash option. + The most appropriate scaled image provided will be picked up + automatically. + See the SplashScreen API documentation for more information + @argument files + one or more argument files containing options + -disable-@files + prevent further argument file expansion + --enable-preview + allow classes to depend on preview features of this release +To specify an argument for a long option, you can use --= or +-- . + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytotrace2-python.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytotrace2-python.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba8c3c1d7d1e908b1f302a0542761a1346b180c8 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/cytotrace2-python.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv Rscript --help +[rc=0] + +Usage: /path/to/Rscript [--options] [-e expr [-e expr2 ...] | file] [args] + +--options accepted are + --help Print usage and exit + --version Print version and exit + --verbose Print information on progress + --default-packages=list + Where 'list' is a comma-separated set + of package names, or 'NULL' +or options to R, in addition to --no-echo --no-restore, such as + --save Do save workspace at the end of the session + --no-environ Don't read the site and user environment files + --no-site-file Don't read the site-wide Rprofile + --no-init-file Don't read the user R profile + --restore Do restore previously saved objects at startup + --vanilla Combine --no-save, --no-restore, --no-site-file + --no-init-file and --no-environ + +'file' may contain spaces but not shell metacharacters +Expressions (one or more '-e ') may be used *instead* of 'file' +See also ?Rscript from within R + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/decoupler.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/decoupler.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..4917dfdd1d4ecec68c3b8bb6e97d71256043ab02 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/decoupler.help.txt @@ -0,0 +1,86 @@ +$ conda run -n bioenv python -m decoupler --help +[rc=1] + +Traceback (most recent call last): + File "", line 189, in _run_module_as_main + File "", line 148, in _get_module_details + File "", line 112, in _get_module_details + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/decoupler/__init__.py", line 17, in + from .method_gsva import run_gsva # noqa: F401 + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/decoupler/method_gsva.py", line 83, in + @nb.njit(nb.types.Tuple((nb.f4[:, :], nb.i8[:, :]))(nb.f4[:, :]), parallel=True, cache=True) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/decorators.py", line 234, in wrapper + disp.compile(sig) + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/dispatcher.py", line 908, in compile + cres = self._compiler.compile(args, return_type) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/dispatcher.py", line 84, in compile + raise retval + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/dispatcher.py", line 94, in _compile_cached + retval = self._compile_core(args, return_type) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/dispatcher.py", line 107, in _compile_core + cres = compiler.compile_extra(self.targetdescr.typing_context, + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler.py", line 739, in compile_extra + return pipeline.compile_extra(func) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler.py", line 439, in compile_extra + return self._compile_bytecode() + ^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler.py", line 505, in _compile_bytecode + return self._compile_core() + ^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler.py", line 484, in _compile_core + raise e + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler.py", line 473, in _compile_core + pm.run(self.state) + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 367, in run + raise patched_exception + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 356, in run + self._runPass(idx, pass_inst, state) + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock + return func(*args, **kwargs) + ^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 311, in _runPass + mutated |= check(pss.run_pass, internal_state) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/compiler_machinery.py", line 272, in check + mangled = func(compiler_state) + ^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/typed_passes.py", line 114, in run_pass + typemap, return_type, calltypes, errs = type_inference_stage( + ^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/typed_passes.py", line 95, in type_inference_stage + errs = infer.propagate(raise_errors=raise_errors) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + File "/225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/typeinfer.py", line 1083, in propagate + raise errors[0] +numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend) +No implementation of function Function() found for signature: + + >>> arange(start=int64, stop=Literal[int](0), step=Literal[int](-1), dtype=class(float32)) + +There are 2 candidate implementations: + - Of which 2 did not match due to: + Overload in function 'np_arange': File: numba/np/arrayobj.py: Line 4983. + With argument(s): '(start=int64, stop=int64, step=int64, dtype=class(float32))': + Rejected as the implementation raised a specific error: + TypingError: 'start' parameter is positional only, but was passed as a keyword + raised from /225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/numba/core/typing/templates.py:791 + +During: resolving callee type: Function() +During: typing of call at /225040511/miniconda3/envs/bioenv/lib/python3.11/site-packages/decoupler/method_gsva.py (86) + +File "../../../miniconda3/envs/bioenv/lib/python3.11/site-packages/decoupler/method_gsva.py", line 86: +def nb_get_D_I(mat): + + n = mat.shape[1] + rev_idx = np.abs(np.arange(start=n, stop=0, step=-1, dtype=nb.f4) - n / 2) + ^ + +During: Pass nopython_type_inference + +ERROR conda.cli.main_run:execute(127): `conda run python -m decoupler --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/delly.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/delly.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..732d3e0750bfbb87a78b9ca2473949356449bff9 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/delly.help.txt @@ -0,0 +1,22 @@ +$ conda run -n bioenv_cli delly --help +[rc=0] +********************************************************************** +Program: Delly +This is free software, and you are welcome to redistribute it under +certain conditions (GPL); for license details use '-l'. +This program comes with ABSOLUTELY NO WARRANTY; for details use '-w'. + +Delly (Version: 0.7.6) +Contact: Tobias Rausch (rausch@embl.de) +********************************************************************** + +Usage: delly + +Commands: + + call discover and genotype structural variants + merge merge structural variants across VCF/BCF files and within a single VCF/BCF file + filter filter somatic or germline structural variants + + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dendropy.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dendropy.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..98db7a6d0a1217777ac444bb3c4193da1c29259f --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dendropy.help.txt @@ -0,0 +1,8 @@ +$ conda run -n bioenv_cli python -m dendropy --help +[rc=0] +DendroPy version : DendroPy 5.0.8 () +DendroPy location : /225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/dendropy +Python version : 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:23:14) [GCC 10.4.0] +Python executable : /225040511/miniconda3/envs/bioenv_cli/bin/python +Python site packages : ['/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages'] + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/diamond.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/diamond.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..842e353a17e533f97d4419c7f75d81a1174faafa --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/diamond.help.txt @@ -0,0 +1,32 @@ +$ conda run -n bioenv_cli diamond --help +[rc=0] +diamond v2.1.10.164 (C) Max Planck Society for the Advancement of Science, Benjamin Buchfink, University of Tuebingen +Documentation, support and updates available at http://www.diamondsearch.org +Please cite: http://dx.doi.org/10.1038/s41592-021-01101-x Nature Methods (2021) + +Syntax: diamond COMMAND [OPTIONS] + +Commands: +makedb Build DIAMOND database from a FASTA file +prepdb Prepare BLAST database for use with Diamond +blastp Align amino acid query sequences against a protein reference database +blastx Align DNA query sequences against a protein reference database +cluster Cluster protein sequences +linclust Cluster protein sequences in linear time +realign Realign clustered sequences against their centroids +recluster Recompute clustering to fix errors +reassign Reassign clustered sequences to the closest centroid +view View DIAMOND alignment archive (DAA) formatted file +merge-daa Merge DAA files +help Produce help message +version Display version information +getseq Retrieve sequences from a DIAMOND database file +dbinfo Print information about a DIAMOND database file +test Run regression tests +makeidx Make database index +greedy-vertex-cover Compute greedy vertex cover + +Possible [OPTIONS] for COMMAND can be seen with syntax: diamond COMMAND + +Online documentation at http://www.diamondsearch.org + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dsh-bio.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dsh-bio.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/dsh-bio.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ena-webin-cli.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ena-webin-cli.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ena-webin-cli.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/f5c.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/f5c.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..d28f3875c8b1b89914d2bff1c036e05f3c19d1f1 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/f5c.help.txt @@ -0,0 +1,14 @@ +$ conda run -n bioenv_cli f5c --help +[rc=0] +Usage: f5c [options] + +command: + index Build an index for accessing the base sequence and raw signal for a given read ID (optimised nanopolish index) + call-methylation Classify nucleotides as methylated or not (optimised nanopolish call-methylation) + meth-freq Calculate methylation frequency at genomic CpG sites (optimised nanopolish calculate_methylation_frequency.py) + eventalign Align nanopore events to reference k-mers (optimised nanopolish eventalign) + freq-merge Merge calculated methylation frequency tsv files + resquiggle Align raw signals to basecalled reads + +See the manual page for details (`man ./docs/f5c.1' or https://f5c.page.link/man). + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/famsa.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/famsa.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..86aa85ce6536d1f66a6a566f3055ce0f5302dc7b --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/famsa.help.txt @@ -0,0 +1,46 @@ +$ conda run -n bioenv_cli famsa --help +[rc=0] + +FAMSA (Fast and Accurate Multiple Sequence Alignment) + version 2.4.1-45c9b2b (2025-05-09) + S. Deorowicz, A. Debudaj-Grabysz, A. Gudys + +Usage: + famsa [options] [] + +Positional parameters: + input_file, input_file_2 - input files in FASTA format; action depends on the number of input files: + * one input - multiple sequence alignment (input gaps, if present, are removed prior the alignment), + * two inputs - profile-profile aligment (input gaps are preserved). + First input can be replaced with STDIN string to read from standard input. + output_file - output file (pass STDOUT when writing to standard output); available outputs: + * alignment in FASTA format, + * guide tree in Newick format (-gt_export option specified), + * distance matrix in CSV format (-dist_export option specified), + +Options: + -help - print this message + -t - no. of threads, NOTE: exceeding number of physical (not logical) cores decreases performance, + 0 indicates half of all the logical cores (default: 0) + -v - verbose mode, show timing information (default: disabled) + + -gt > - guide tree method (default: sl): + * sl - single linkage + * upgma - UPGMA + * nj - neighbour joining + * import - imported from a Newick file + -medoidtree - use MedoidTree heuristic for speeding up tree construction (default: disabled) + -medoid_threshold - if specified, medoid trees are used only for sets with or more + -gt_export - export a guide tree to output file in Newick format + -dist_export - export a distance matrix to output file in CSV format + -square_matrix - generate a square distance matrix instead of a default triangle + -pid - generate pairwise identity (the number of matching residues divided by the shorter sequence length) instead of distance + -keep-duplicates - keep duplicated sequences during alignment + (default: disabled - duplicates are removed prior and restored after the alignment). + + -gz - enable gzipped output (default: disabled) + -gz-lev - gzip compression level [0-9] (default: 7) + -remove-rare-columns - remove columns with less than fraction of non-gap characters + -refine_mode - refinement mode (default: auto - the refinement is enabled for sets <= 1000 seq.) + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastdtw.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastdtw.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..21da0ce38fe3673f8039eed050dcf68d83f936c9 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastdtw.help.txt @@ -0,0 +1,2 @@ +$ conda run -n bioenv_cli python -m fastdtw --help +[rc=0] diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastp.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastp.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..5ebdde40f993ad731e026143fa840c4d1c1e0c78 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastp.help.txt @@ -0,0 +1,88 @@ +$ conda run -n bioenv_cli fastp --help +[rc=0] + +usage: fastp [options] ... +options: + -i, --in1 read1 input file name (string [=]) + -o, --out1 read1 output file name (string [=]) + -I, --in2 read2 input file name (string [=]) + -O, --out2 read2 output file name (string [=]) + -D, --dedup enable deduplication to drop the duplicated reads/pairs + --unpaired1 for PE input, if read1 passed QC but read2 not, it will be written to unpaired1. Default is to discard it. (string [=]) + --unpaired2 for PE input, if read2 passed QC but read1 not, it will be written to unpaired2. If --unpaired2 is same as --unpaired1 (default mode), both unpaired reads will be written to this same file. (string [=]) + --overlapped_out for each read pair, output the overlapped region if it has no any mismatched base. (string [=]) + --failed_out specify the file to store reads that cannot pass the filters. (string [=]) + -m, --merge for paired-end input, merge each pair of reads into a single read if they are overlapped. The merged reads will be written to the file given by --merged_out, the unmerged reads will be written to the files specified by --out1 and --out2. The merging mode is disabled by default. + --merged_out in the merging mode, specify the file name to store merged output, or specify --stdout to stream the merged output (string [=]) + --include_unmerged in the merging mode, write the unmerged or unpaired reads to the file specified by --merge. Disabled by default. + -6, --phred64 indicate the input is using phred64 scoring (it'll be converted to phred33, so the output will still be phred33) + -z, --compression compression level for gzip output (1 ~ 9). 1 is fastest, 9 is smallest, default is 4. (int [=4]) + --stdin input from STDIN. If the STDIN is interleaved paired-end FASTQ, please also add --interleaved_in. + --stdout stream passing-filters reads to STDOUT. This option will result in interleaved FASTQ output for paired-end output. Disabled by default. + --interleaved_in indicate that is an interleaved FASTQ which contains both read1 and read2. Disabled by default. + --reads_to_process specify how many reads/pairs to be processed. Default 0 means process all reads. (int [=0]) + --dont_overwrite don't overwrite existing files. Overwritting is allowed by default. + --dont_eval_duplication don't evaluate duplication rate to save time and use less memory. + --fix_mgi_id the MGI FASTQ ID format is not compatible with many BAM operation tools, enable this option to fix it. + -V, --verbose output verbose log information (i.e. when every 1M reads are processed). + -A, --disable_adapter_trimming adapter trimming is enabled by default. If this option is specified, adapter trimming is disabled + -a, --adapter_sequence the adapter for read1. For SE data, if not specified, the adapter will be auto-detected. For PE data, this is used if R1/R2 are found not overlapped. (string [=auto]) + --adapter_sequence_r2 the adapter for read2 (PE data only). This is used if R1/R2 are found not overlapped. If not specified, it will be the same as (string [=auto]) + --adapter_fasta specify a FASTA file to trim both read1 and read2 (if PE) by all the sequences in this FASTA file (string [=]) + --detect_adapter_for_pe by default, the auto-detection for adapter is for SE data input only, turn on this option to enable it for PE data. + -f, --trim_front1 trimming how many bases in front for read1, default is 0 (int [=0]) + -t, --trim_tail1 trimming how many bases in tail for read1, default is 0 (int [=0]) + -b, --max_len1 if read1 is longer than max_len1, then trim read1 at its tail to make it as long as max_len1. Default 0 means no limitation (int [=0]) + -F, --trim_front2 trimming how many bases in front for read2. If it's not specified, it will follow read1's settings (int [=0]) + -T, --trim_tail2 trimming how many bases in tail for read2. If it's not specified, it will follow read1's settings (int [=0]) + -B, --max_len2 if read2 is longer than max_len2, then trim read2 at its tail to make it as long as max_len2. Default 0 means no limitation. If it's not specified, it will follow read1's settings (int [=0]) + -g, --trim_poly_g force polyG tail trimming, by default trimming is automatically enabled for Illumina NextSeq/NovaSeq data + --poly_g_min_len the minimum length to detect polyG in the read tail. 10 by default. (int [=10]) + -G, --disable_trim_poly_g disable polyG tail trimming, by default trimming is automatically enabled for Illumina NextSeq/NovaSeq data + -x, --trim_poly_x enable polyX trimming in 3' ends. + --poly_x_min_len the minimum length to detect polyX in the read tail. 10 by default. (int [=10]) + -5, --cut_front move a sliding window from front (5') to tail, drop the bases in the window if its mean quality < threshold, stop otherwise. + -3, --cut_tail move a sliding window from tail (3') to front, drop the bases in the window if its mean quality < threshold, stop otherwise. + -r, --cut_right move a sliding window from front to tail, if meet one window with mean quality < threshold, drop the bases in the window and the right part, and then stop. + -W, --cut_window_size the window size option shared by cut_front, cut_tail or cut_sliding. Range: 1~1000, default: 4 (int [=4]) + -M, --cut_mean_quality the mean quality requirement option shared by cut_front, cut_tail or cut_sliding. Range: 1~36 default: 20 (Q20) (int [=20]) + --cut_front_window_size the window size option of cut_front, default to cut_window_size if not specified (int [=4]) + --cut_front_mean_quality the mean quality requirement option for cut_front, default to cut_mean_quality if not specified (int [=20]) + --cut_tail_window_size the window size option of cut_tail, default to cut_window_size if not specified (int [=4]) + --cut_tail_mean_quality the mean quality requirement option for cut_tail, default to cut_mean_quality if not specified (int [=20]) + --cut_right_window_size the window size option of cut_right, default to cut_window_size if not specified (int [=4]) + --cut_right_mean_quality the mean quality requirement option for cut_right, default to cut_mean_quality if not specified (int [=20]) + -Q, --disable_quality_filtering quality filtering is enabled by default. If this option is specified, quality filtering is disabled + -q, --qualified_quality_phred the quality value that a base is qualified. Default 15 means phred quality >=Q15 is qualified. (int [=15]) + -u, --unqualified_percent_limit how many percents of bases are allowed to be unqualified (0~100). Default 40 means 40% (int [=40]) + -n, --n_base_limit if one read's number of N base is >n_base_limit, then this read/pair is discarded. Default is 5 (int [=5]) + -e, --average_qual if one read's average quality score =1000), a sequential number prefix will be added to output name ( 0001.out.fq, 0002.out.fq...), disabled by default (long [=0]) + -d, --split_prefix_digits the digits for the sequential number padding (1~10), default is 4, so the filename will be padded as 0001.xxx, 0 to disable padding (int [=4]) + --cut_by_quality5 DEPRECATED, use --cut_front instead. + --cut_by_quality3 DEPRECATED, use --cut_tail instead. + --cut_by_quality_aggressive DEPRECATED, use --cut_right instead. diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastqc.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastqc.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fastqc.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fasttree.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fasttree.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..813c40b363b2e3b456fd442e0e997c1d37d96bc5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fasttree.help.txt @@ -0,0 +1,45 @@ +$ conda run -n bioenv_cli fasttree --help +[rc=1] + +Unknown or incorrect use of option --help + FastTree protein_alignment > tree + FastTree < protein_alignment > tree + FastTree -out tree protein_alignment + FastTree -nt nucleotide_alignment > tree + FastTree -nt -gtr < nucleotide_alignment > tree + FastTree < nucleotide_alignment > tree +FastTree accepts alignments in fasta or phylip interleaved formats + +Common options (must be before the alignment file): + -quiet to suppress reporting information + -nopr to suppress progress indicator + -log logfile -- save intermediate trees, settings, and model details + -fastest -- speed up the neighbor joining phase & reduce memory usage + (recommended for >50,000 sequences) + -n to analyze multiple alignments (phylip format only) + (use for global bootstrap, with seqboot and CompareToBootstrap.pl) + -nosupport to not compute support values + -intree newick_file to set the starting tree(s) + -intree1 newick_file to use this starting tree for all the alignments + (for faster global bootstrap on huge alignments) + -pseudo to use pseudocounts (recommended for highly gapped sequences) + -gtr -- generalized time-reversible model (nucleotide alignments only) + -lg -- Le-Gascuel 2008 model (amino acid alignments only) + -wag -- Whelan-And-Goldman 2001 model (amino acid alignments only) + -quote -- allow spaces and other restricted characters (but not ' ) in + sequence names and quote names in the output tree (fasta input only; + FastTree will not be able to read these trees back in) + -noml to turn off maximum-likelihood + -nome to turn off minimum-evolution NNIs and SPRs + (recommended if running additional ML NNIs with -intree) + -nome -mllen with -intree to optimize branch lengths for a fixed topology + -cat # to specify the number of rate categories of sites (default 20) + or -nocat to use constant rates + -gamma -- after optimizing the tree under the CAT approximation, + rescale the lengths to optimize the Gamma20 likelihood + -constraints constraintAlignment to constrain the topology search + constraintAlignment should have 1s or 0s to indicates splits + -expert -- see more options +For more information, see http://www.microbesonline.org/fasttree/ + +ERROR conda.cli.main_run:execute(127): `conda run fasttree --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fermi2.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fermi2.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fermi2.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fgbio.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fgbio.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fgbio.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/flye.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/flye.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..0ce45b53c87657369a2158b90059a0814a77a86e --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/flye.help.txt @@ -0,0 +1,84 @@ +$ conda run -n bioenv_cli flye --help +[rc=0] +usage: flye (--pacbio-raw | --pacbio-corr | --pacbio-hifi | --nano-raw | + --nano-corr | --nano-hq ) file1 [file_2 ...] + --out-dir PATH + + [--genome-size SIZE] [--threads int] [--iterations int] + [--meta] [--polish-target] [--min-overlap SIZE] + [--keep-haplotypes] [--debug] [--version] [--help] + [--scaffold] [--resume] [--resume-from] [--stop-after] + [--read-error float] [--extra-params] + [--deterministic] + +Assembly of long reads with repeat graphs + +options: + -h, --help show this help message and exit + --pacbio-raw path [path ...] + PacBio regular CLR reads (<20% error) + --pacbio-corr path [path ...] + PacBio reads that were corrected with other methods + (<3% error) + --pacbio-hifi path [path ...] + PacBio HiFi reads (<1% error) + --nano-raw path [path ...] + ONT regular reads, pre-Guppy5 (<20% error) + --nano-corr path [path ...] + ONT reads that were corrected with other methods (<3% + error) + --nano-hq path [path ...] + ONT high-quality reads: Guppy5+ SUP or Q20 (<5% error) + --subassemblies path [path ...] + [deprecated] high-quality contigs input + -g size, --genome-size size + estimated genome size (for example, 5m or 2.6g) + -o path, --out-dir path + Output directory + -t int, --threads int + number of parallel threads [1] + -i int, --iterations int + number of polishing iterations [1] + -m int, --min-overlap int + minimum overlap between reads [auto] + --asm-coverage int reduced coverage for initial disjointig assembly [not + set] + --hifi-error float [deprecated] same as --read-error + --read-error float adjust parameters for given read error rate (as + fraction e.g. 0.03) + --extra-params extra_params + extra configuration parameters list (comma-separated) + --plasmids unused (retained for backward compatibility) + --meta metagenome / uneven coverage mode + --keep-haplotypes do not collapse alternative haplotypes + --no-alt-contigs do not output contigs representing alternative + haplotypes + --scaffold enable scaffolding using graph [disabled by default] + --trestle [deprecated] enable Trestle [disabled by default] + --polish-target path run polisher on the target sequence + --resume resume from the last completed stage + --resume-from stage_name + resume from a custom stage + --stop-after stage_name + stop after the specified stage completed + --debug enable debug output + -v, --version show program's version number and exit + --deterministic perform disjointig assembly single-threaded + +Input reads can be in FASTA or FASTQ format, uncompressed +or compressed with gz. Currently, PacBio (CLR, HiFi, corrected) +and ONT reads (regular, HQ, corrected) are supported. Expected error rates are +<15% for PB CLR/regular ONT; <5% for ONT HQ, <3% for corrected, and <1% for HiFi. Note that Flye +was primarily developed to run on uncorrected reads. You may specify multiple +files with reads (separated by spaces). Mixing different read +types is not yet supported. The --meta option enables the mode +for metagenome/uneven coverage assembly. + +To reduce memory consumption for large genome assemblies, +you can use a subset of the longest reads for initial disjointig +assembly by specifying --asm-coverage and --genome-size options. Typically, +40x coverage is enough to produce good disjointigs. + +You can run Flye polisher as a standalone tool using +--polish-target option. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/foldseek.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/foldseek.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..3bb976afab20bd71e7d2d8c180a368d1491c832e --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/foldseek.help.txt @@ -0,0 +1,53 @@ +$ conda run -n bioenv_cli foldseek --help +[rc=0] +Foldseek enables fast and sensitive comparisons of large structure sets. It reaches sensitivities similar to state-of-the-art structural aligners while being at least 20,000 times faster. + +Please cite: +van Kempen, M., Kim, S.S., Tumescheit, C., Mirdita, M., Lee, J., Gilchrist, C.L.M., Söding, J., and Steinegger, M. Fast and accurate protein structure search with Foldseek. Nature Biotechnology, doi:10.1038/s41587-023-01773-0 (2023) + +foldseek Version: 9.427df8a +© Michel van Kempen, Stephanie Kim, Charlotte Tumescheit, Milot Mirdita, Jeongjae Lee, Cameron L. M. Gilchrist, Johannes Söding, Martin Steinegger + +usage: foldseek [] + +Easy workflows for plain text input/output + easy-search Structual search + easy-cluster Slower, sensitive clustering + easy-rbh Find reciprocal best hit + easy-multimersearch Complex level search + easy-complexsearch + +Main workflows for database input/output + createdb Convert PDB/mmCIF/tar[.gz]/DB files or directory/TSV to a structure DB + search Sensitive homology search + rbh Reciprocal best hit search + cluster Slower, sensitive clustering + multimersearch Complex level search + +Input database creation + databases List and download databases + createindex Store precomputed index on disk to reduce search overhead + createclusearchdb Build a searchable cluster database allowing for faster searches + +Format conversion for downstream processing + convertalis Convert alignment DB to BLAST-tab, SAM or custom format + compressca Create a new C-alpha DB with chosen compression encoding from a sequence DB + convert2pdb Convert a foldseek structure db to a single multi model PDB file or a directory of PDB files + createmultimerreport Convert complexDB to tsv format + createcomplexreport + +Prefiltering + expandmultimer Re-prefilter to ensure complete alignment between complexes + expandcomplex + +Alignment + tmalign Compute tm-score + structurealign Compute structural alignment using 3Di alphabet, amino acids and neighborhood information + structurerescorediagonal Compute sequence identity for diagonal + aln2tmscore Compute tmscore of an alignment database + scoremultimer Get complex level alignments from alignmentDB + +Clustering + clust Cluster result by Set-Cover/Connected-Component/Greedy-Incremental + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/freebayes.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/freebayes.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..dfc82e850109f84c7c7273fe7179b51bbdd744b4 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/freebayes.help.txt @@ -0,0 +1,243 @@ +$ conda run -n bioenv_cli freebayes --help +[rc=0] +usage: freebayes [OPTION] ... [BAM FILE] ... + +Bayesian haplotype-based polymorphism discovery. + +citation: Erik Garrison, Gabor Marth + "Haplotype-based variant detection from short-read sequencing" + arXiv:1207.3907 (http://arxiv.org/abs/1207.3907) + +overview: + + To call variants from aligned short-read sequencing data, supply BAM files and + a reference. FreeBayes will provide VCF output on standard out describing SNPs, + indels, and complex variants in samples in the input alignments. + + By default, FreeBayes will consider variants supported by at least 2 + observations in a single sample (-C) and also by at least 20% of the reads from + a single sample (-F). These settings are suitable to low to high depth + sequencing in haploid and diploid samples, but users working with polyploid or + pooled samples may wish to adjust them depending on the characteristics of + their sequencing data. + + FreeBayes is capable of calling variant haplotypes shorter than a read length + where multiple polymorphisms segregate on the same read. The maximum distance + between polymorphisms phased in this way is determined by the + --max-complex-gap, which defaults to 3bp. In practice, this can comfortably be + set to half the read length. + + Ploidy may be set to any level (-p), but by default all samples are assumed to + be diploid. FreeBayes can model per-sample and per-region variation in + copy-number (-A) using a copy-number variation map. + + FreeBayes can act as a frequency-based pooled caller and describe variants + and haplotypes in terms of observation frequency rather than called genotypes. + To do so, use --pooled-continuous and set input filters to a suitable level. + Allele observation counts will be described by AO and RO fields in the VCF output. + + +examples: + + # call variants assuming a diploid sample + freebayes -f ref.fa aln.bam >var.vcf + + # call variants assuming a diploid sample, providing gVCF output + freebayes -f ref.fa --gvcf aln.bam >var.gvcf + + # require at least 5 supporting observations to consider a variant + freebayes -f ref.fa -C 5 aln.bam >var.vcf + + # use a different ploidy + freebayes -f ref.fa -p 4 aln.bam >var.vcf + + # assume a pooled sample with a known number of genome copies + freebayes -f ref.fa -p 20 --pooled-discrete aln.bam >var.vcf + + # generate frequency-based calls for all variants passing input thresholds + freebayes -f ref.fa -F 0.01 -C 1 --pooled-continuous aln.bam >var.vcf + + # use an input VCF (bgzipped + tabix indexed) to force calls at particular alleles + freebayes -f ref.fa -@ in.vcf.gz aln.bam >var.vcf + + # generate long haplotype calls over known variants + freebayes -f ref.fa --haplotype-basis-alleles in.vcf.gz \ + --haplotype-length 50 aln.bam + + # naive variant calling: simply annotate observation counts of SNPs and indels + freebayes -f ref.fa --haplotype-length 0 --min-alternate-count 1 \ + --min-alternate-fraction 0 --pooled-continuous --report-monomorphic >var.vcf + + +parameters: + + -h --help Prints this help dialog. + --version Prints the release number and the git commit id. + +input: + + -b --bam FILE Add FILE to the set of BAM files to be analyzed. + -L --bam-list FILE + A file containing a list of BAM files to be analyzed. + -c --stdin Read BAM input on stdin. + -f --fasta-reference FILE + Use FILE as the reference sequence for analysis. + An index file (FILE.fai) will be created if none exists. + If neither --targets nor --region are specified, FreeBayes + will analyze every position in this reference. + -t --targets FILE + Limit analysis to targets listed in the BED-format FILE. + -r --region :- + Limit analysis to the specified region, 0-base coordinates, + end_position not included (same as BED format). + Either '-' or '..' maybe used as a separator. + -s --samples FILE + Limit analysis to samples listed (one per line) in the FILE. + By default FreeBayes will analyze all samples in its input + BAM files. + --populations FILE + Each line of FILE should list a sample and a population which + it is part of. The population-based bayesian inference model + will then be partitioned on the basis of the populations. + -A --cnv-map FILE + Read a copy number map from the BED file FILE, which has + the format: + reference sequence, start, end, sample name, copy number + ... for each region in each sample which does not have the + default copy number as set by --ploidy. + +output: + + -v --vcf FILE Output VCF-format results to FILE. (default: stdout) + --gvcf + Write gVCF output, which indicates coverage in uncalled regions. + --gvcf-chunk NUM + When writing gVCF output emit a record for every NUM bases. + -@ --variant-input VCF + Use variants reported in VCF file as input to the algorithm. + Variants in this file will included in the output even if + there is not enough support in the data to pass input filters. + -l --only-use-input-alleles + Only provide variant calls and genotype likelihoods for sites + and alleles which are provided in the VCF input, and provide + output in the VCF for all input alleles, not just those which + have support in the data. + --haplotype-basis-alleles VCF + When specified, only variant alleles provided in this input + VCF will be used for the construction of complex or haplotype + alleles. + --report-all-haplotype-alleles + At sites where genotypes are made over haplotype alleles, + provide information about all alleles in output, not only + those which are called. + --report-monomorphic + Report even loci which appear to be monomorphic, and report all + considered alleles, even those which are not in called genotypes. + Loci which do not have any potential alternates have '.' for ALT. + -P --pvar N Report sites if the probability that there is a polymorphism + at the site is greater than N. default: 0.0. Note that post- + filtering is generally recommended over the use of this parameter. + +population model: + + -T --theta N The expected mutation rate or pairwise nucleotide diversity + among the population under analysis. This serves as the + single parameter to the Ewens Sampling Formula prior model + default: 0.001 + -p --ploidy N Sets the default ploidy for the analysis to N. default: 2 + -J --pooled-discrete + Assume that samples result from pooled sequencing. + Model pooled samples using discrete genotypes across pools. + When using this flag, set --ploidy to the number of + alleles in each sample or use the --cnv-map to define + per-sample ploidy. + -K --pooled-continuous + Output all alleles which pass input filters, regardles of + genotyping outcome or model. + +reference allele: + + -Z --use-reference-allele + This flag includes the reference allele in the analysis as + if it is another sample from the same population. + --reference-quality MQ,BQ + Assign mapping quality of MQ to the reference allele at each + site and base quality of BQ. default: 100,60 + +allele scope: + + -I --no-snps Ignore SNP alleles. + -i --no-indels Ignore insertion and deletion alleles. + -X --no-mnps Ignore multi-nuceotide polymorphisms, MNPs. + -u --no-complex Ignore complex events (composites of other classes). + -n --use-best-n-alleles N + Evaluate only the best N SNP alleles, ranked by sum of + supporting quality scores. (Set to 0 to use all; default: all) + -E --max-complex-gap N + --haplotype-length N + Allow haplotype calls with contiguous embedded matches of up + to this length. (default: 3) + --min-repeat-size N + When assembling observations across repeats, require the total repeat + length at least this many bp. (default: 5) + --min-repeat-entropy N + To detect interrupted repeats, build across sequence until it has + entropy > N bits per bp. (default: 0, off) + --no-partial-observations + Exclude observations which do not fully span the dynamically-determined + detection window. (default, use all observations, dividing partial + support across matching haplotypes when generating haplotypes.) + +indel realignment: + + -O --dont-left-align-indels + Turn off left-alignment of indels, which is enabled by default. + +input filters: + + -4 --use-duplicate-reads + Include duplicate-marked alignments in the analysis. + default: exclude duplicates marked as such in alignments + -m --min-mapping-quality Q + Exclude alignments from analysis if they have a mapping + quality less than Q. default: 1 + -q --min-base-quality Q + Exclude alleles from analysis if their supporting base + quality is less than Q. default: 0 + -R --min-supporting-allele-qsum Q + Consider any allele in which the sum of qualities of supporting + observations is at least Q. default: 0 + -Y --min-supporting-mapping-qsum Q + Consider any allele in which and the sum of mapping qualities of + supporting reads is at least Q. default: 0 + -Q --mismatch-base-quality-threshold Q + Count mismatches toward --read-mismatch-limit if the base + quality of the mismatch is >= Q. default: 10 + -U --read-mismatch-limit N + Exclude reads with more than N mismatches where each mismatch + has base quality >= mismatch-base-quality-threshold. + default: ~unbounded + -z --read-max-mismatch-fraction N + Exclude reads with more than N [0,1] fraction of mismatches where + each mismatch has base quality >= mismatch-base-quality-threshold + default: 1.0 + -$ --read-snp-limit N + Exclude reads with more than N base mismatches, ignoring gaps + with quality >= mismatch-base-quality-threshold. + default: ~unbounded + -e --read-indel-limit N + Exclude reads with more than N separate gaps. + default: ~unbounded + -0 --standard-filters Use stringent input base and mapping quality filters + Equivalent to -m 30 -q 20 -R 0 -S 0 + -F --min-alternate-fraction N + Require at least this fraction of observations supporting + an alternate allele within a single individual in the + in order to evaluate the position. default: 0.2 + -C --min-alternate-count N + Require at least this count of observations supporting + an alternate allele within a single individual in order + to evaluate the position. default: 2 + -3 --min-alternate-qsum N + Require at least this sum of quality of observations supporting + \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fwdpy11.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fwdpy11.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..5dab19b90bf22f147200c224e7b089ec401056aa --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/fwdpy11.help.txt @@ -0,0 +1,22 @@ +$ conda run -n bioenv_cli fwdpy11 --help +[rc=1] + +RuntimeError: module was compiled against NumPy C-API version 0x12 (NumPy 1.20) but the running NumPy has C-API version 0x11. Check the section C-API incompatibility at the Troubleshooting ImportError section at https://numpy.org/devdocs/user/troubleshooting-importerror.html#c-api-incompatibility for indications on how to solve this problem. +Traceback (most recent call last): + File "/225040511/miniconda3/envs/bioenv_cli/bin/fwdpy11", line 7, in + from fwdpy11.__main__ import main + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/fwdpy11/__init__.py", line 31, in + from . import discrete_demography # NOQA + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/fwdpy11/discrete_demography.py", line 27, in + from fwdpy11._types.demographic_model_details import DemographicModelDetails + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/fwdpy11/_types/__init__.py", line 28, in + from .diploid_population import DiploidPopulation # NOQA + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/fwdpy11/_types/diploid_population.py", line 4, in + import fwdpy11.tskit_tools._dump_tables_to_tskit + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/fwdpy11/tskit_tools/__init__.py", line 30, in + import tskit # type: ignore + File "/225040511/miniconda3/envs/bioenv_cli/lib/python3.10/site-packages/tskit/__init__.py", line 22, in + import _tskit +ImportError: numpy._core.multiarray failed to import + +ERROR conda.cli.main_run:execute(127): `conda run fwdpy11 --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk4-spark.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk4-spark.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gatk4-spark.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/genenotebook.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/genenotebook.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..b701a14b52c38b0d433c90ca0cf4ff2b0d330d15 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/genenotebook.help.txt @@ -0,0 +1,18 @@ +$ conda run -n bioenv_cli genenotebook --help +[rc=0] + + Usage: genenotebook [command] + + Options: + + -v, --version output the version number + -h, --help output usage information + + Commands: + + run Run a GeneNoteBook server + add [type] Add data to a running GeneNoteBook server + remove [type] Remove data from a running GeneNoteBook server + list List contents of a running GeneNoteBook server + help [cmd] display help for [cmd] + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gffread.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gffread.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..b454b196f45ae9ed98346d1926db7d79f7ed8b3f --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gffread.help.txt @@ -0,0 +1,141 @@ +$ conda run -n bioenv_cli gffread --help +[rc=1] + +gffread v0.12.7. Usage: +gffread [-g | ] [-s ] + [-o ] [-t ] [-r []:- [-R]] + [--jmatch :-] [--no-pseudo] + [-CTVNJMKQAFPGUBHZWTOLE] [-w ] [-x ] [-y ] + [-j ][--ids | --nids ] [--attrs ] [-i ] + [--stream] [--bed | --gtf | --tlf] [--table ] [--sort-by ] + [] + + Filter, convert or cluster GFF/GTF/BED records, extract the sequence of + transcripts (exon or CDS) and more. + By default (i.e. without -O) only transcripts are processed, discarding any + other non-transcript features. Default output is a simplified GFF3 with only + the basic attributes. + +Options: + --ids discard records/transcripts if their IDs are not listed in + --nids discard records/transcripts if their IDs are listed in + -i discard transcripts having an intron larger than + -l discard transcripts shorter than bases + -r only show transcripts overlapping coordinate range .. + (on chromosome/contig , strand if provided) + -R for -r option, discard all transcripts that are not fully + contained within the given range + --jmatch only output transcripts matching the given junction + -U discard single-exon transcripts + -C coding only: discard mRNAs that have no CDS features + --nc non-coding only: discard mRNAs that have CDS features + --ignore-locus : discard locus features and attributes found in the input + -A use the description field from and add it + as the value for a 'descr' attribute to the GFF record + -s is a tab-delimited file providing this info + for each of the mapped sequences: + + (useful for -A option with mRNA/EST/protein mappings) +Sorting: (by default, chromosomes are kept in the order they were found) + --sort-alpha : chromosomes (reference sequences) are sorted alphabetically + --sort-by : sort the reference sequences by the order in which their + names are given in the file +Misc options: + -F keep all GFF attributes (for non-exon features) + --keep-exon-attrs : for -F option, do not attempt to reduce redundant + exon/CDS attributes + -G do not keep exon attributes, move them to the transcript feature + (for GFF3 output) + --attrs only output the GTF/GFF attributes listed in + which is a comma delimited list of attribute names to + --keep-genes : in transcript-only mode (default), also preserve gene records + --keep-comments: for GFF3 input/output, try to preserve comments + -O process other non-transcript GFF records (by default non-transcript + records are ignored) + -V discard any mRNAs with CDS having in-frame stop codons (requires -g) + -H for -V option, check and adjust the starting CDS phase + if the original phase leads to a translation with an + in-frame stop codon + -B for -V option, single-exon transcripts are also checked on the + opposite strand (requires -g) + -P add transcript level GFF attributes about the coding status of each + transcript, including partialness or in-frame stop codons (requires -g) + --add-hasCDS : add a "hasCDS" attribute with value "true" for transcripts + that have CDS features + --adj-stop stop codon adjustment: enables -P and performs automatic + adjustment of the CDS stop coordinate if premature or downstream + -N discard multi-exon mRNAs that have any intron with a non-canonical + splice site consensus (i.e. not GT-AG, GC-AG or AT-AC) + -J discard any mRNAs that either lack initial START codon + or the terminal STOP codon, or have an in-frame stop codon + (i.e. only print mRNAs with a complete CDS) + --no-pseudo: filter out records matching the 'pseudo' keyword + --in-bed: input should be parsed as BED format (automatic if the input + filename ends with .bed*) + --in-tlf: input GFF-like one-line-per-transcript format without exon/CDS + features (see --tlf option below); automatic if the input + filename ends with .tlf) + --stream: fast processing of input GFF/BED transcripts as they are received + ((no sorting, exons must be grouped by transcript in the input data) +Clustering: + -M/--merge : cluster the input transcripts into loci, discarding + "redundant" transcripts (those with the same exact introns + and fully contained or equal boundaries) + -d : for -M option, write duplication info to file + --cluster-only: same as -M/--merge but without discarding any of the + "duplicate" transcripts, only create "locus" features + -K for -M option: also discard as redundant the shorter, fully contained + transcripts (intron chains matching a part of the container) + -Q for -M option, no longer require boundary containment when assessing + redundancy (can be combined with -K); only introns have to match for + multi-exon transcripts, and >=80% overlap for single-exon transcripts + -Y for -M option, enforce -Q but also discard overlapping single-exon + transcripts, even on the opposite strand (can be combined with -K) +Output options: + --force-exons: make sure that the lowest level GFF features are considered + "exon" features + --gene2exon: for single-line genes not parenting any transcripts, add an + exon feature spanning the entire gene (treat it as a transcript) + --t-adopt: try to find a parent gene overlapping/containing a transcript + that does not have any explicit gene Parent + -D decode url encoded characters within attributes + -Z merge very close exons into a single exon (when intron size<4) + -g full path to a multi-fasta file with the genomic sequences + for all input mappings, OR a directory with single-fasta files + (one per genomic sequence, with file names matching sequence names) + -j output the junctions and the corresponding transcripts + -w write a fasta file with spliced exons for each transcript + --w-add for the -w option, extract additional bases + both upstream and downstream of the transcript boundaries + --w-nocds for -w, disable the output of CDS info in the FASTA file + -x write a fasta file with spliced CDS for each GFF transcript + -y write a protein fasta file with the translation of CDS for each record + -W for -w, -x and -y options, write in the FASTA defline all the exon + coordinates projected onto the spliced sequence; + -S for -y option, use '*' instead of '.' as stop codon translation + -L Ensembl GTF to GFF3 conversion, adds version to IDs + -m is a name mapping table for converting reference + sequence names, having this 2-column format: + + -t use in the 2nd column of each GFF/GTF output line + -o write the output records into instead of stdout + -T main output will be GTF instead of GFF3 + --bed output records in BED format instead of default GFF3 + --tlf output "transcript line format" which is like GFF + but with exons and CDS related features stored as GFF + attributes in the transcript feature line, like this: + exoncount=N;exons=;CDSphase=;CDS= + is a comma-delimited list of exon_start-exon_end coordinates; + is CDS_start:CDS_end coordinates or a list like + --table output a simple tab delimited format instead of GFF, with columns + having the values of GFF attributes given in ; special + pseudo-attributes (prefixed by @) are recognized: + @id, @geneid, @chr, @start, @end, @strand, @numexons, @exons, + @cds, @covlen, @cdslen + If any of -w/-y/-x FASTA output files are enabled, the same fields + (excluding @id) are appended to the definition line of corresponding + FASTA records + -v,-E expose (warn about) duplicate transcript IDs and other potential + problems with the given GFF/GTF records + +ERROR conda.cli.main_run:execute(127): `conda run gffread --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/glimmerhmm.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/glimmerhmm.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..960306460f7370383fd440db38252bacf3ff4ad2 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/glimmerhmm.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_cli glimmerhmm --help +[rc=139] + +/tmp/tmpuzppbwf_: line 3: 633843 Segmentation fault (core dumped) glimmerhmm --help + +ERROR conda.cli.main_run:execute(127): `conda run glimmerhmm --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gmap.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gmap.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gmap.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gnuplot.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gnuplot.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..0fecf0561f960985a8cd3cbaaaa63ea092728508 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gnuplot.help.txt @@ -0,0 +1,11 @@ +$ conda run -n bioenv_cli gnuplot --help +[rc=0] +Usage: gnuplot [OPTION] ... [FILE] + -V, --version + -h, --help + -p --persist + -d --default-settings + -c scriptfile ARG1 ARG2 ... + -e "command1; command2; ..." +gnuplot 5.0 patchlevel 3 + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gofasta.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gofasta.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ded35db9f938b17380b3e1579217ab32aaf0df26 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gofasta.help.txt @@ -0,0 +1,28 @@ +$ conda run -n bioenv_cli gofasta --help +[rc=0] +Command-line utilities for genomic epidemiology research + +If you use gofasta in your work, please cite: + +Jackson B (2022). gofasta: command-line utilities for genomic epidemiology research. Bioinformatics 38 (16), 4033-4035 +https://doi.org/10.1093/bioinformatics/btac424 + +Usage: + gofasta [command] + +Available Commands: + closest Find the closest sequence(s) to a query by genetic distance + completion Generate the autocompletion script for the specified shell + help Help about any command + licences Print licence information + sam Do things with sam files + snps Find snps relative to a reference + updown Get pseudo-tree-aware catchments for query sequences from alignments + variants Annotate mutations relative to a reference from a multiple sequence alignment in fasta format + +Flags: + -h, --help help for gofasta + -v, --version version for gofasta + +Use "gofasta [command] --help" for more information about a command. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gridss.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gridss.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..9396ee6dd4e0ed35a6252ddcf0e196deafac3795 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gridss.help.txt @@ -0,0 +1,6 @@ +$ conda run -n bioenv_r_bioc Rscript --help +[rc=127] + +Rscript: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory + +ERROR conda.cli.main_run:execute(127): `conda run Rscript --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gsmap.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gsmap.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..b8350f3861624aedc2db622447f54286780cb48a --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gsmap.help.txt @@ -0,0 +1,32 @@ +$ conda run -n bioenv gsmap --help +[rc=0] +usage: gsMap [-h] [--version] + {quick_mode,run_find_latent_representations,run_latent_to_gene,run_generate_ldscore,run_spatial_ldsc,run_cauchy_combination,run_report,format_sumstats,create_slice_mean} + ... + + gsMap: genetically informed spatial mapping of cells for complex traits + +options: + -h, --help show this help message and exit + --version, -v show program's version number and exit + +Available subcommands: + {quick_mode,run_find_latent_representations,run_latent_to_gene,run_generate_ldscore,run_spatial_ldsc,run_cauchy_combination,run_report,format_sumstats,create_slice_mean} + Subcommands + quick_mode Run the entire gsMap pipeline in quick mode, utilizing pre-computed weights for faster execution. + run_find_latent_representations + Run Find_latent_representations + Find the latent representations of each spot by running GNN + run_latent_to_gene Run Latent_to_gene + Estimate gene marker gene scores for each spot by using latent representations from nearby spots + run_generate_ldscore + Run Generate_ldscore + Generate LD scores for each spot + run_spatial_ldsc Run Spatial_ldsc + Run spatial LDSC for each spot + run_cauchy_combination + Run Cauchy_combination for each annotation + run_report Run Report to generate diagnostic plots and tables + format_sumstats Format GWAS summary statistics + create_slice_mean Create slice mean from multiple h5ad files + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gtdbtk.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gtdbtk.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..2913168fbbf8252ea50fd3fed66e3ed443118ace --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/gtdbtk.help.txt @@ -0,0 +1,16 @@ +$ conda run -n bioenv_cli gtdbtk --help +[rc=1] + +================================================================================ + ERROR +________________________________________________________________________________ + + The GTDB-Tk reference data does not exist or is corrupted. + GTDBTK_DATA_PATH=/225040511/miniconda3/envs/bioenv_cli/share/gtdbtk-1.1.1/db/ + + Please compare the checksum to those provided in the download repository. + https://github.com/Ecogenomics/GTDBTk#gtdb-tk-reference-data +================================================================================ + + +ERROR conda.cli.main_run:execute(127): `conda run gtdbtk --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hhsuite.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hhsuite.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hhsuite.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hifiasm.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hifiasm.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..07595048a9bed10d50a641944ffe79328661e90f --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hifiasm.help.txt @@ -0,0 +1,7 @@ +$ conda run -n bioenv_cli hifiasm --help +[rc=139] + +[ERROR] unknown option in "--help" +/tmp/tmpp52g633r: line 3: 1248122 Segmentation fault (core dumped) hifiasm --help + +ERROR conda.cli.main_run:execute(127): `conda run hifiasm --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hisat2.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hisat2.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..18a5c4904976b9f3a8bb7d3532dc6a9859dfa854 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hisat2.help.txt @@ -0,0 +1,36 @@ +$ conda run -n bioenv_perl perl -h +[rc=0] + +Usage: perl [switches] [--] [programfile] [arguments] + -0[octal] specify record separator (\0, if no argument) + -a autosplit mode with -n or -p (splits $_ into @F) + -C[number/list] enables the listed Unicode features + -c check syntax only (runs BEGIN and CHECK blocks) + -d[:debugger] run program under debugger + -D[number/list] set debugging flags (argument is a bit mask or alphabets) + -e program one line of program (several -e's allowed, omit programfile) + -E program like -e, but enables all optional features + -f don't do $sitelib/sitecustomize.pl at startup + -F/pattern/ split() pattern for -a switch (//'s are optional) + -i[extension] edit <> files in place (makes backup if extension supplied) + -Idirectory specify @INC/#include directory (several -I's allowed) + -l[octal] enable line ending processing, specifies line terminator + -[mM][-]module execute "use/no module..." before executing program + -n assume "while (<>) { ... }" loop around program + -p assume loop like -n but print line also, like sed + -s enable rudimentary parsing for switches after programfile + -S look for programfile using PATH environment variable + -t enable tainting warnings + -T enable tainting checks + -u dump core after parsing program + -U allow unsafe operations + -v print version, patchlevel and license + -V[:variable] print configuration summary (or a single Config.pm variable) + -w enable many useful warnings + -W enable all warnings + -x[directory] ignore text before #!perl line (optionally cd to directory) + -X disable all warnings + +Run 'perldoc perl' for more help with Perl. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hyphy.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hyphy.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..15b7f1ba07c47208b0550f50cdf740bfb06cc946 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/hyphy.help.txt @@ -0,0 +1,116 @@ +$ conda run -n bioenv_cli hyphy --help +[rc=0] +usage: hyphy or HYPHYMPI [-h] [--help][-c] [-d] [-i] [-p] [BASEPATH=directory path] [CPU=integer] [LIBPATH=library path] [USEPATH=library path] [ or ] [--keyword value ...] [positional arguments ...] + +Execute a HyPhy analysis, either interactively, or in batch mode +optional flags: + -h --help show this help message and exit + -c calculator mode; causes HyPhy to drop into an expression evaluation until 'exit' is typed + -d debug mode; causes HyPhy to drop into an expression evaluation mode upon script error + -i interactive mode; causes HyPhy to always prompt the user for analysis options, even when defaults are available + -p postprocessor mode; drops HyPhy into an interactive mode where general post-processing scripts can be selected + upon analysis completion + +optional global arguments: + BASEPATH=directory path defines the base directory for all path operations (default is pwd) + CPU=integer if compiled with OpenMP multithreading support, requests this many threads; HyPhy could use fewer than this + but never more; default is the number of CPU cores (as computed by OpenMP) on the system + LIBPATH=directory path defines the directory where HyPhy library files are located (default installed location is /usr/local/lib/hyphy + or as configured during CMake installation + USEPATH=directory path specifies the optional working and relative path directory (default is BASEPATH) + + batch file to run if specified, execute this file, otherwise drop into an interactive mode + analysis arguments if batch file is present, all remaining positional arguments are interpreted as inputs to analysis prompts + +optional keyword arguments (can appear anywhere); will be consumed by the requested analysis + --keyword value will be passed to the analysis (which uses KeywordArgument directives) + multiple values for the same keywords are treated as an array of values for multiple selectors + +usage examples: + +Select a standard analysis from the list : + hyphy -i +Run a standard analysis with default options and one required user argument; + hyphy busted --alignment path/to/file +Run a standard analysis with additional keyword arguments + hyphy busted --alignment path/to/file --srv No +See whcih arguments are understood by a standard analysis + hyphy busted --help +Run a custom analysis and pass it some arguments + hyphy path/to/hyphy.script argument1 'argument 2' +Available standard keyword analyses (located in /225040511/miniconda3/envs/bioenv_cli/lib/hyphy/) + meme [MEME] Test for episodic site-level selection using MEME (Mixed Effects Model of Evolution). + mh Merge two datafiles by combining sites (horizontal merge). + mv Merge two datafiles by combining sequences (vertical merge). + mcc Compare mean within-clade branch length or pairwise divergence between two or more non-nested cladesd in a tree + mclk Test for the presence of a global molecular clock on the tree using its root (the resulting clock tree is unrooted, but one of the root branches can be divided in such a way as to enforce the clock). + mgvsgy Compare the fits of MG94 and GY94 models (crossed with an arbitrary nucleotide bias) on codon data. + mt Select an evolutionary model for nucleotide data, using the methods of 'ModelTest' - a program by David Posada and Keith Crandall. + fel [FEL] Test for pervasive site-level selection using FEL (Fixed Effects Likelihood). + fubar [FUBAR] Test for pervasive site-level selection using FUBAR (Fast Unconstrained Bayesian AppRoximation for inferring selection). + fade [FADE] Test a protein alignment for directional selection towards specific amino acids along a specified set of test branches using FADE (a FUBAR Approach to Directional Evolution). + faa Fit a multiple fitness class model to amino acid data. + fst Compute various measures of F_ST and (optionally) perform permutation tests. + slac [SLAC] Test for pervasive site-level selection using SLAC (Single Likelihood Ancestor Counting). + sm Peform a classic and structured Slatkin-Maddison test for the number migrations. + sns Parse a codon alignment for ambiguous codons and output a complete list/resolutions/syn and ns counts by sequence/position + sw Perform a sliding window analysis of sequence data. + sa Perform a phylogeny reconstuction for nucleotide, protein or codon data with user-selectable models using the method of sequential addition. + sbl Search an alignment for a single breakpoint. + spl Plot genetic distances (similarity) of one sequence against all others in an alignment, using a sliding window. Optionally, determine NJ-based clustering and bootstrap support in every window. This is a HyPhy adaptation of the excellent (but Windows only tool) SimPlot (and/or VarPlot) written by Stuart Ray (http://sray.med.som.jhmi.edu/SCRoftware/simplot/) + busted [BUSTED] Test for episodic gene-wide selection using BUSTED (Branch-site Unrestricted Statistical Test of Episodic Diversification). + bgm [BGM] Apply Bayesian Graphical Model inference to substitution histories at individual sites. + bva Run a selection analysis using a general discrete bivariate (dN AND dS) distribution; the appropriate number of rate classes is determined automatically. + brp Interpret bivariate codon rate analysis results. + bsel Split a tree into two clades (compartments) and a separating branch and test for equality of dN/dS between compartments and for selection along the separating branch using a series of Likelihood Ratio Tests. + bst Use the improved branch-site REL method of Yang and Nielsen (2005) to look for episodic selection in sequences. + bt Test whether a branch (or branches) in the tree evolves under different dN and dS than the rest of the tree. + absrel [aBSREL] Test for lineage-specific evolution using the branch-site method aBS-REL (Adaptive Branch-Site Random Effects Likelihood). + acd Analyse codon data with a variery of standard models using given tree. + ad Analyse nucleotide or aminoacid data with a variery of standard models using given tree. + adn Analyse di-nucleotide data with a variery of standard models using given tree. + afd Analyse nucleotide data with a variery of standard models using given tree, estimating equilibrium frequencies as parameters + ana Run a selection analysis. + ai Peter Simmonds' Association Index (AI). + relax [RELAX] Test for relaxation of selection pressure along a specified set of test branches using RELAX (a random effects test of selection relaxation). + red Replace sufficiently close sequence with their MRCA + rpc Interpret analysis results. + rmv Remove sequences with stop codons from the data. + rble Use a series of random effects branch-site models to perform robust model-averaged branch length estimation under a codon model with episodic selection. + rclk Test for the presence of a global molecular clock on the tree. The tree is rooted at every possible branch. + rr Use relative rate test on three species and a variety of standard models + rrt Use relative ratio test on 2 datasets and a variety of standard models + contrast-fel Use a FEL method to test which sites in a gene may be associated with adaptation to a different environment. + conv Translate an in-frame codon alignment to proteins. + corr Assess the correlation between phylogenetic and compartment segregation using generalized correlation coefficients and permutation tests. + cod Compare all 203 reversible nucleotide models composed with MG94 to extend them to codon data, and perform LRT and AIC model selection. + cmp Use a series of LR tests to decide if dN and dS rate distributions are the same or different between two codon alignments. + caln Align coding sequences to reference (assuming star topology) using a codon-based dynamic programming algorithm (good for fixing multiple frameshifts). Designed with within-patient HIV sequences in mind. + clg Remove 'gappy' sites from alignments based on a user-specified gap threshold. + cln Convert sequence names to HyPhy valid identifiers if needed and replace stop codons with gaps in codon data if any are present. + clsr Partition sequences into clusters based on a distance matrix. + clst Apply clustering methods for phylogeny reconstruction (UPGMA,WPGMA,complete or minimal linkage) to nucleotide, protein and codon data, using MLE of pairwise distances with user-selectable models. These methods produce trees with global molecular clock. + leisr Infer relative evolutionary rates on a nucleotide or protein alignment, in a spirit similar to Rate4Site (PMID: 12169533). + lz Compute Lempel-Ziv complexity and entropy of (possibly unaligned) sequences + lclk Test for the presence of a local molecular clock. Every subtree of the given tree is subjected to the clock constraint, while the remainder of the tree is free of the clock constraint. + lht A Likelihood Ratio Test to detect conflicting phylogenetic signal Huelsenbeck and Bull, 1996. [Contributed by Olivier Fedrigo]. + tc Test whether a group of sequences in a sample cluster together + ts Perform an exhaustive tree space search for nucleotide or protein data with user-selectable models. Should only be used for data sets with less than 10 taxa! + dtr Read sequence data (#,PHYLIP,NEXUS) and convert to a different format + dist Generate a pairwise sequence distance matrix in PHYLIP format. + pdf Read sequence data, select a contiguous subset of sites and save it to another datafile. + phb Run an example file from our book chapter in 'The Phylogentic Handbook' (2nd edition). + protein Compare the fit of several amino-acid substitution models to an alignment using AIC and c-AIC. + prr Using the model and the outgroup provided by the user, perform relative rate tests with all possible pair of species from the data file. + prrti Given a list of files (and optinally genetic code tables), perform relative ratio tests on all possible pair of the data files. + psm Test for positive selection using the approach of Nielsen and Yang, by sampling global dN/dS from an array of distributions, and using Bayesian posterior to identify the sites with dN/dS>1. Multiple subsets of one data set with shared dN/dS. + parris A PARtitioning approach for Robust Inference of Selection (written by K. Scheffler) + kh Perform a Kishino-Hasegawa test on two competing phylogenies + ub Obtain an upper bound on the likelihood score of a dataset. + nuc Compare all 203 reversible nucleotide models and perform LRT and AIC model selection. + nj Perform a phylogeny reconstuction for nucleotide, protein or codon data with user-selectable models using the method of neighbor joining. + ny Test for positive selection using the approach of Nielsen and Yabg, by sampling global dN/dS from an array of distributions, and using Bayesian posterior to identify the sites with dN/dS>1. + gard [GARD] Screen an alignment using GARD (requires an MPI environment). + grdr Process GARD results. + + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/igv.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/igv.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/igv.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/involucro.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/involucro.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..026eadf04bd6ec345323a05f7aae1a138cb3cef1 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/involucro.help.txt @@ -0,0 +1,28 @@ +$ conda run -n bioenv_cli involucro --help +[rc=0] + +Usage of involucro 1.1.2: + -H string + Set the URL of the Docker instance (default "unix:///var/run/docker.sock") + -T Shorthand for --tasks + -e string + Evaluate the given script directly, not evaluating the control file + -f string + Set the control file (default "invfile.lua") + -host string + Long form for -H (default "unix:///var/run/docker.sock") + -s value + Shorthand for --set + -set value + Used as KEY=VALUE, makes VAR[KEY] available with value VALUE in Lua script + -tasks + Show available tasks and then exit + -v int + Set verbosity, 3 logs everything, 2 shows standard output (default 1) + -version + Show version and the exit + -w string + Set working dir, being the base for all operations. Also settable via environment variable $INVOLUCRO_WORKDIR (default ".") + -wrap string + Execute encoded wrap task + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/iqtree.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/iqtree.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..3c2ea28faf6ab07395425e95c1721698b4811bc5 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/iqtree.help.txt @@ -0,0 +1,205 @@ +$ conda run -n bioenv_cli iqtree --help +[rc=0] +IQ-TREE version 3.1.1 for Linux x86 64-bit built Apr 8 2026 +Developed by Bui Quang Minh, Thomas Wong, Nhan Ly-Trong, Huaiyan Ren +Contributed by Lam-Tung Nguyen, Dominik Schrempf, Chris Bielow, +Olga Chernomor, Michael Woodhams, Diep Thi Hoang, Heiko Schmidt + +Usage: iqtree [-s ALIGNMENT] [-p PARTITION] [-m MODEL] [-t TREE] ... + +GENERAL OPTIONS: + -h, --help Print (more) help usages + -s FILE[,...,FILE] PHYLIP/FASTA/NEXUS/CLUSTAL/MSF alignment file(s) + -s DIR Directory of alignment files + --seqtype STRING BIN, DNA, AA, NT2AA, CODON, MORPH (default: auto-detect) + -t FILE|PARS|RAND Starting tree (default: 99 parsimony and BIONJ) + -o TAX[,...,TAX] Outgroup taxon (list) for writing .treefile + --prefix STRING Prefix for all output files (default: aln/partition) + --seed NUM Random seed number, normally used for debugging purpose + --safe Safe likelihood kernel to avoid numerical underflow + --mem NUM[G|M|%] Maximal RAM usage in GB | MB | % + --runs NUM Number of indepedent runs (default: 1) + -v, --verbose Verbose mode, printing more messages to screen + -V, --version Display version number + --quiet Quiet mode, suppress printing to screen (stdout) + -fconst f1,...,fN Add constant patterns into alignment (N=no. states) + --epsilon NUM Likelihood epsilon for parameter estimate (default 0.01) + -T NUM|AUTO No. cores/threads or AUTO-detect (default: 1) + --threads-max NUM Max number of threads for -T AUTO (default: all cores) + +CHECKPOINT: + --redo Redo both ModelFinder and tree search + --redo-tree Restore ModelFinder and only redo tree search + --undo Revoke finished run, used when changing some options + --cptime NUM Minimum checkpoint interval (default: 60 sec and adapt) + +PARTITION MODEL: + -p FILE|DIR NEXUS/RAxML partition file or directory with alignments + Edge-linked proportional partition model + -q FILE|DIR Like -p but edge-linked equal partition model + -Q FILE|DIR Like -p but edge-unlinked partition model + -S FILE|DIR Like -p but separate tree inference + --subsample NUM Randomly sub-sample partitions (negative for complement) + --subsample-seed NUM Random number seed for --subsample + +LIKELIHOOD/QUARTET MAPPING: + --lmap NUM Number of quartets for likelihood mapping analysis + --lmclust FILE NEXUS file containing clusters for likelihood mapping + --quartetlh Print quartet log-likelihoods to .quartetlh file + +TREE SEARCH ALGORITHM: + --ninit NUM Number of initial parsimony trees (default: 100) + --ntop NUM Number of top initial trees (default: 20) + --nbest NUM Number of best trees retained during search (default: 5) + -n NUM Fix number of iterations to stop (default: OFF) + --nstop NUM Number of unsuccessful iterations to stop (default: 100) + --perturb NUM Perturbation strength for randomized NNI (default: 0.5) + --radius NUM Radius for parsimony SPR search (default: 6) + --allnni Perform more thorough NNI search (default: OFF) + -g FILE (Multifurcating) topological constraint tree file + --fast Fast search to resemble FastTree + --polytomy Collapse near-zero branches into polytomy + --tree-fix Fix -t tree (no tree search performed) + --treels Write locally optimal trees into .treels file + --show-lh Compute tree likelihood without optimisation + --terrace Check if the tree lies on a phylogenetic terrace + +ULTRAFAST BOOTSTRAP/JACKKNIFE: + -B, --ufboot NUM Replicates for ultrafast bootstrap (>=1000) + -J, --ufjack NUM Replicates for ultrafast jackknife (>=1000) + --jack-prop NUM Subsampling proportion for jackknife (default: 0.5) + --sampling STRING GENE|GENESITE resampling for partitions (default: SITE) + --boot-trees Write bootstrap trees to .ufboot file (default: none) + --wbtl Like --boot-trees but also writing branch lengths + --nmax NUM Maximum number of iterations (default: 1000) + --nstep NUM Iterations for UFBoot stopping rule (default: 100) + --bcor NUM Minimum correlation coefficient (default: 0.99) + --beps NUM RELL epsilon to break tie (default: 0.5) + --bnni Optimize UFBoot trees by NNI on bootstrap alignment + +NON-PARAMETRIC BOOTSTRAP/JACKKNIFE: + -b, --boot NUM Replicates for bootstrap + ML tree + consensus tree + -j, --jack NUM Replicates for jackknife + ML tree + consensus tree + --jack-prop NUM Subsampling proportion for jackknife (default: 0.5) + --bcon NUM Replicates for bootstrap + consensus tree + --bonly NUM Replicates for bootstrap only + --tbe Transfer bootstrap expectation + +SINGLE BRANCH TEST: + --alrt NUM Replicates for SH approximate likelihood ratio test + --alrt 0 Parametric aLRT test (Anisimova and Gascuel 2006) + --abayes approximate Bayes test (Anisimova et al. 2011) + --lbp NUM Replicates for fast local bootstrap probabilities + +MODEL-FINDER: + --use-nn-model Use neural network for tree inference + --nn-path-model Neural network file for substitution model (onnx format) + --nn-path-rates Neural network file for alpha value (onnx format) + -m TESTONLY Standard model selection (like jModelTest, ProtTest) + -m TEST Standard model selection followed by tree inference + -m MF Extended model selection with FreeRate heterogeneity + -m MFP Extended model selection followed by tree inference + -m ...+LM Additionally test Lie Markov models + -m ...+LMRY Additionally test Lie Markov models with RY symmetry + -m ...+LMWS Additionally test Lie Markov models with WS symmetry + -m ...+LMMK Additionally test Lie Markov models with MK symmetry + -m ...+LMSS Additionally test strand-symmetric models + --mset STRING Restrict search to models supported by other programs + (raxml, phyml, mrbayes, beast1 or beast2) + If 'mrbayes' is selected, will output a MrBayes + Block File if Data Type is supported. + --mset STR,... Comma-separated model list (e.g. -mset WAG,LG,JTT) + --msub STRING Amino-acid model source + (nuclear, mitochondrial, chloroplast or viral) + --mfreq STR,... List of state frequencies + --mrate STR,... List of rate heterogeneity among sites + (e.g. -mrate E,I,G,I+G,R is used for -m MF) + --cmin NUM Min categories for FreeRate model [+R] (default: 2) + --cmax NUM Max categories for FreeRate model [+R] (default: 10) + --merit AIC|AICc|BIC Akaike|Bayesian information criterion (default: BIC) + --mtree Perform full tree search for every model + --madd STR,... List of mixture models to consider + --mdef FILE Model definition NEXUS file (see Manual) + --modelomatic Find best codon/protein/DNA models (Whelan et al. 2015) + +PARTITION-FINDER: + --merge Merge partitions to increase model fit + --merge greedy|rcluster|rclusterf + Set merging algorithm (default: rclusterf) + --merge-model 1|all Use only 1 or all models for merging (default: 1) + --merge-model STR,... + Comma-separated model list for merging + --merge-rate 1|all Use only 1 or all rate heterogeneity (default: 1) + --merge-rate STR,... + Comma-separated rate list for merging + --rcluster NUM Percentage of partition pairs for rcluster algorithm + --rclusterf NUM Percentage of partition pairs for rclusterf algorithm + --rcluster-max NUM Max number of partition pairs (default: 10*partitions) + +SUBSTITUTION MODEL: + -m STRING Model name string (e.g. GTR+F+I+G) + DNA: HKY (default), JC, F81, K2P, K3P, K81uf, TN/TrN, TNef, + TIM, TIMef, TVM, TVMef, SYM, GTR, or 6-digit model + specification (e.g., 010010 = HKY) + Protein: LG (default), Poisson, cpREV, mtREV, Dayhoff, mtMAM, + JTT, WAG, mtART, mtZOA, VT, rtREV, DCMut, PMB, HIVb, + HIVw, JTTDCMut, FLU, Blosum62, GTR20, mtMet, mtVer, mtInv, FLAVI, + Q.LG, Q.pfam, Q.pfam_gb, Q.bird, Q.mammal, Q.insect, Q.plant, Q.yeast + Protein mixture: C10,...,C60, EX2, EX3, EHO, UL2, UL3, EX_EHO, LG4M, LG4X + Binary: JC2 (default), GTR2 + Empirical codon: KOSI07, SCHN05 + Mechanistic codon: GY (default), MG, MGK, GY0K, GY1KTS, GY1KTV, GY2K, + MG1KTS, MG1KTV, MG2K +Semi-empirical codon: XX_YY where XX is empirical and YY is mechanistic model + Morphology/SNP: MK (default), ORDERED, GTR + Lie Markov DNA: 1.1, 2.2b, 3.3a, 3.3b, 3.3c, 3.4, 4.4a, 4.4b, 4.5a, + 4.5b, 5.6a, 5.6b, 5.7a, 5.7b, 5.7c, 5.11a, 5.11b, 5.11c, + 5.16, 6.6, 6.7a, 6.7b, 6.8a, 6.8b, 6.17a, 6.17b, 8.8, + 8.10a, 8.10b, 8.16, 8.17, 8.18, 9.20a, 9.20b, 10.12, + 10.34, 12.12 (optionally prefixed by RY, WS or MK) + Non-reversible: STRSYM (strand symmetric model, equiv. WS6.6), + NONREV, UNREST (unrestricted model, equiv. 12.12) + NQ.pfam, NQ.bird, NQ.mammal, NQ.insect, NQ.plant, NQ.yeast + Otherwise: Name of file containing user-model parameters + +STATE FREQUENCY: + -m ...+F Empirically counted frequencies from alignment + -m ...+FO Optimized frequencies by maximum-likelihood + -m ...+FQ Equal frequencies + -m ...+FRY For DNA, freq(A+G)=1/2=freq(C+T) + -m ...+FWS For DNA, freq(A+T)=1/2=freq(C+G) + -m ...+FMK For DNA, freq(A+C)=1/2=freq(G+T) + -m ...+Fabcd 4-digit constraint on ACGT frequency + (e.g. +F1221 means f_A=f_T, f_C=f_G) + -m ...+FU Amino-acid frequencies given protein matrix + -m ...+F1x4 Equal NT frequencies over three codon positions + -m ...+F3x4 Unequal NT frequencies over three codon positions + +RATE HETEROGENEITY AMONG SITES: + -m ...+I A proportion of invariable sites + -m ...+G[n] Discrete Gamma model with n categories (default n=4) + -m ...*G[n] Discrete Gamma model with unlinked model parameters + -m ...+I+G[n] Invariable sites plus Gamma model with n categories + -m ...+R[n] FreeRate model with n categories (default n=4) + -m ...*R[n] FreeRate model with unlinked model parameters + -m ...+I+R[n] Invariable sites plus FreeRate model with n categories + -m ...+Hn Heterotachy model with n classes + -m ...*Hn Heterotachy model with n classes and unlinked parameters + --alpha-min NUM Min Gamma shape parameter for site rates (default: 0.02) + --gamma-median Median approximation for +G site rates (default: mean) + --rate Write empirical Bayesian site rates to .rate file + --mlrate Write maximum likelihood site rates to .mlrate file + +POLYMORPHISM AWARE MODELS (PoMo): + -s FILE Input counts file (see manual) + -m ...+P DNA substitution model (see above) used with PoMo + -m ...+N Virtual population size (default: 9) + -m ...+WB|WH|S] Weighted binomial sampling + -m ...+WH Weighted hypergeometric sampling + -m ...+S Sampled sampling + -m ...+G[n] Discrete Gamma rate with n categories (default n=4) + +COMPLEX MODELS: + -m "MIX{m1,...,mK}" Mixture model with K components + -m "FMIX{f1,...fK}" Frequency mixture model with K components + --mix-opt Optimize mixture weights (defaul \ No newline at end of file diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ivar.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ivar.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31c9ff18d5b8419457ca926c63b1c5bc8cda8da --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/ivar.help.txt @@ -0,0 +1,15 @@ +$ conda run -n bioenv_cli ivar --help +[rc=0] +Usage: ivar [command ] + + Command Description + trim Trim reads in aligned BAM file + variants Call variants from aligned BAM file + filtervariants Filter variants across replicates + consensus Call consensus from aligned BAM file + getmasked Detect primer mismatches and get primer indices for the amplicon to be masked + removereads Remove reads from trimmed BAM file + version Show version information + +To view detailed usage for each command type `ivar ` + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jalview.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jalview.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jalview.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/java-jdk.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/java-jdk.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..1679b90d0df4baf450c04d6928c147d991132211 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/java-jdk.help.txt @@ -0,0 +1,56 @@ +$ conda run -n bioenv_java java -help +[rc=0] + +Usage: java [-options] class [args...] + (to execute a class) + or java [-options] -jar jarfile [args...] + (to execute a jar file) +where options include: + -d32 use a 32-bit data model if available + -d64 use a 64-bit data model if available + -server to select the "server" VM + The default VM is server, + because you are running on a server-class machine. + + + -cp + -classpath + A : separated list of directories, JAR archives, + and ZIP archives to search for class files. + -D= + set a system property + -verbose:[class|gc|jni] + enable verbose output + -version print product version and exit + -version: + Warning: this feature is deprecated and will be removed + in a future release. + require the specified version to run + -showversion print product version and continue + -jre-restrict-search | -no-jre-restrict-search + Warning: this feature is deprecated and will be removed + in a future release. + include/exclude user private JREs in the version search + -? -help print this help message + -X print help on non-standard options + -ea[:...|:] + -enableassertions[:...|:] + enable assertions with specified granularity + -da[:...|:] + -disableassertions[:...|:] + disable assertions with specified granularity + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:[=] + load native agent library , e.g. -agentlib:hprof + see also, -agentlib:jdwp=help and -agentlib:hprof=help + -agentpath:[=] + load native agent library by full pathname + -javaagent:[=] + load Java programming language agent, see java.lang.instrument + -splash: + show splash screen with specified image +See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jellyfish.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jellyfish.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..b69974d8fe7df016a8bc64124a9453603d381298 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jellyfish.help.txt @@ -0,0 +1,8 @@ +$ conda run -n bioenv_cli jellyfish --help +[rc=0] +Usage: jellyfish [options] arg... +Where is one of: count, bc, info, stats, histo, dump, merge, query, cite, mem, jf. +Options: + --version Display version + --help Display this message + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jq.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jq.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..ab9f7f274de4ba62e96b2425a064bda16e55d9d0 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/jq.help.txt @@ -0,0 +1,30 @@ +$ conda run -n bioenv_cli jq --help +[rc=0] +jq - commandline JSON processor [version 1.5] +Usage: jq [options] [file...] + + jq is a tool for processing JSON inputs, applying the + given filter to its JSON text inputs and producing the + filter's results as JSON on standard output. + The simplest filter is ., which is the identity filter, + copying jq's input to its output unmodified (except for + formatting). + For more advanced filters see the jq(1) manpage ("man jq") + and/or https://stedolan.github.io/jq + + Some of the options include: + -c compact instead of pretty-printed output; + -n use `null` as the single input value; + -e set the exit status code based on the output; + -s read (slurp) all inputs into an array; apply filter to it; + -r output raw strings, not JSON texts; + -R read raw strings, not JSON texts; + -C colorize JSON; + -M monochrome (don't colorize JSON); + -S sort keys of objects on output; + --tab use tabs for indentation; + --arg a v set variable $a to value ; + --argjson a v set variable $a to JSON value ; + --slurpfile a f set variable $a to an array of JSON texts read from ; + See the manpage for more options. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kallisto.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kallisto.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2dabd41d337844f12ce814960a2b54e128451ea --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kallisto.help.txt @@ -0,0 +1,25 @@ +$ conda run -n bioenv_cli kallisto --help +[rc=1] +kallisto 0.48.0 + +Usage: kallisto [arguments] .. + +Where can be one of: + + index Builds a kallisto index + quant Runs the quantification algorithm + quant-tcc Runs quantification on transcript-compatibility counts + bus Generate BUS files for single-cell data + merge Merges several batch runs + h5dump Converts HDF5-formatted results to plaintext + inspect Inspects and gives information about an index + version Prints version information + cite Prints citation information + +Running kallisto without arguments prints usage information for + + + +Error: invalid command --help + +ERROR conda.cli.main_run:execute(127): `conda run kallisto --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kma.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kma.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..4309aef64056a267ea917e16287613ec16b2454d --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kma.help.txt @@ -0,0 +1,112 @@ +$ conda run -n bioenv_cli kma --help +[rc=1] + + Invalid option: --help + Printing help message: +# KMA-1.4.15 maps and/or aligns raw reads to a template database. +# Options: Desc: Default: +# +# Input: +# -i Single end input(s) stdin +# -ipe Paired end input(s) +# -int Interleaved input(s) +# +# Output: +# -o Output prefix +# -ef Output additional features False +# -vcf Output vcf file, 2 to apply FT False +# -sam Output sam, 4/2096 for mapped/aligned False +# -nc No consensus file False +# -na No aln file False +# -nf No frag file False +# -matrix Output assembly matrix False +# -a Output all template mappings False +# -and Use both mrs and p-value on consensus or +# -oa Use neither mrs or p-value on consensus False +# -tsv Tsv flag 0 +# -tsvh Help on -tsv +# +# Consensus: +# -bc Minimum support to call bases 0 +# -bcNano Altered indel calling for ONT data False +# -bcd Minimum depth to cal bases 1 +# -bcg Maintain insignificant gaps False +# -ID Minimum consensus ID 1.0% +# -md Minimum depth 0.0 +# -dense Skip insertion in consensus False +# -ref_fsa Use n's on indels False +# +# General: +# -t_db Template DB +# -p P-value 0.05 +# -shm Use DB in shared memory 0 +# -mmap Memory map *.comp.b False +# -tmp Set directory for temporary files +# -mf Max number of fragments to store in memory 1000000 +# -t Number of threads 1 +# -status Extra status False +# -verbose Extra verbose False +# -c Citation +# -v Version +# -h Shows this help message +# +# Template mapping: +# -ConClave ConClave version 1 +# -mem_mode Base ConClave on template mappings False +# -proxi Proximity scoring (negative for soft) False/1.0 +# -ex_mode Searh kmers exhaustively False +# -deCon Remove contamination False +# -Sparse Only count kmers False +# -ss Sparse sorting (q,c,d) q +# -Mt1 Map everything to one template False/0 +# -pm Pairing method (p,u,f) u +# -1t1 One query to one template False +# -hmm Use a HMM to assign template(s) False +# -ck Count k-mers over pseudo alignment False +# -localopen Penalty for openning a local chain 6 +# -mct Max overlap between templates 0.1 +# -lc Length corrected template chaining False +# +# Chaining: +# -k K-mersize DB defined +# -ts Trim front of seeds 0 +# -ssa Seeds soround alignments False +# -ex_mode Searh kmers exhaustively False +# -fpm Pairing method (p,u,f) u +# -mq Minimum mapping quality 0 +# -localopen Penalty for local opening 6 +# +# Alignment: +# -ca Circular alignments False +# -mrs Minimum relative alignment score 0.5 +# -mrc Minimum query coverage 0.0 +# -ml Minimum alignment length 16 +# -reward Score for match 1 +# -penalty Penalty for mismatch 2 +# -gapopen Penalty for gap opening 3 +# -gapextend Penalty for gap extension 1 +# -per Reward for pairing reads 7 +# -Npenalty Penalty matching N 0 +# -transition Penalty for transition 2 +# -transversion Penalty for transversion 2 +# -sasm Skip alignment False +# +# Trimming: +# -mp Minimum phred score 20 +# -mi Minimum internal phred score 0 +# -eq Minimum avg. quality score 0 +# -5p Trim 5 prime 0 +# -3p Trim 3 prime 0 +# -ml Minimum length 16 +# -xl Maximum length on se 2147483647 +# -boot Bootstrap sub-sequence False +# +# Presets: +# -apm Sets both pm and fpm u +# -cge Set CGE penalties and rewards False +# -mint2 Set 2ng gen Mintyper preset False +# -mint3 Set 3rd gen Mintyper preset False +# -ont Set 3rd gen genefinding preset False +# + +ERROR conda.cli.main_run:execute(127): `conda run kma --help` failed. (See above for error) diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kraken2.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kraken2.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..f1e4da72964c09b6ee93a0c684ebe93c3c456f09 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/kraken2.help.txt @@ -0,0 +1,43 @@ +$ conda run -n bioenv_cli kraken2 --help +[rc=0] + +Usage: kraken2 [options] + +Options: + --db NAME Name for Kraken 2 DB + (default: none) + --threads NUM Number of threads (default: 1) + --quick Quick operation (use first hit or hits) + --unclassified-out FILENAME + Print unclassified sequences to filename + --classified-out FILENAME + Print classified sequences to filename + --output FILENAME Print output to filename (default: stdout); "-" will + suppress normal output + --confidence FLOAT Confidence score threshold (default: 0.0); must be + in [0, 1]. + --minimum-base-quality NUM + Minimum base quality used in classification (def: 0, + only effective with FASTQ input). + --report FILENAME Print a report with aggregrate counts/clade to file + --use-mpa-style With --report, format report output like Kraken 1's + kraken-mpa-report + --report-zero-counts With --report, report counts for ALL taxa, even if + counts are zero + --report-minimizer-data With --report, report minimizer and distinct minimizer + count information in addition to normal Kraken report + --memory-mapping Avoids loading database into RAM + --paired The filenames provided have paired-end reads + --use-names Print scientific names instead of just taxids + --gzip-compressed Input files are compressed with gzip + --bzip2-compressed Input files are compressed with bzip2 + --minimum-hit-groups NUM + Minimum number of hit groups (overlapping k-mers + sharing the same minimizer) needed to make a call + (default: 2) + --help Print this message + --version Print version information + +If none of the *-compressed flags are specified, and the filename provided +is a regular file, automatic format detection is attempted. + diff --git a/BioScientist/agent_system/toolbase/output/help_docs/help_txt/last.help.txt b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/last.help.txt new file mode 100644 index 0000000000000000000000000000000000000000..83e9b712eee4814dae566adfdc79ac32c7eb1813 --- /dev/null +++ b/BioScientist/agent_system/toolbase/output/help_docs/help_txt/last.help.txt @@ -0,0 +1,30 @@ +$ conda run -n bioenv_cli last --help +[rc=0] + +Usage: + last [options] [...] [...] + +Show a listing of last logged in users. + +Options: + - how many lines to show + -a, --hostlast display hostnames in the last column + -d, --dns translate the IP number back into a hostname + -f, --file use a specific file instead of /var/log/wtmp + -F, --fulltimes print full login and logout times and dates + -i, --ip display IP numbers in numbers-and-dots notation + -n, --limit how many lines to show + -R, --nohostname don't display the hostname field + -s, --since