Protein Function Annotation With InterProScan
Domain: life_sciences — Genomics & Sequence Analysis

Summary: Annotate one staged yeast protein with InterProScan, export the required InterPro and GO TSV files, and write a short gamma-tubulin functional summary.

Task prompt:
You are working on a Linux VM to annotate one staged protein with InterProScan.

## Visible Task Directory
- `base`

## Visible Inputs
- Protein FASTA: `base/input/protein_sequence.fasta`
- Organism name: `base/input/organism_name.txt`
- InterProScan install script: `base/software/install_software.sh`
- InterProScan wrapper: `base/software/interproscan.sh`
- InterPro2GO mapping file: `base/software/interpro2go`
- GO namespace lookup: `base/software/go_namespace_lookup.tsv`

## Your Task
1. Install InterProScan by running `base/software/install_software.sh`. This downloads and sets up InterProScan 5.77-108.0 (~15 GB download, requires Java 11 which is already available). The script is idempotent and will skip if already installed.
2. Run the staged InterProScan 5.77-108.0 wrapper on `base/input/protein_sequence.fasta`.
3. Create `base/output/interpro_domains.tsv` with exactly these columns:
   `sequence_id,interpro_accession,interpro_name,start,end,e_value`
4. Retain exactly one row per non-empty InterPro accession. If multiple InterProScan rows map to the same accession, merge them into one retained row by using the minimum `start`, the maximum `end`, the shared `interpro_name` for that accession, and the smallest numeric score as `e_value`. If an accession has no numeric score in its retained rows, write `0.00`.
5. Sort the retained domain rows by `start` ascending, then by `interpro_accession` ascending.
6. Round every retained `e_value` to 2 decimal places.
7. Map the retained InterPro accessions to GO terms using `base/software/interpro2go`, use `base/software/go_namespace_lookup.tsv` to fill `go_namespace`, and write `base/output/go_terms.tsv` with exactly these columns:
   `go_id,go_name,go_namespace,source_interpro_accession`
8. Remove exact duplicate GO rows.
9. Write `base/output/functional_summary.txt` as a concise 1-2 sentence summary consistent with the retained domains and GO terms.

## Important Requirements
- The summary must include gamma-tubulin family identity plus microtubule nucleation and minus-end initiation or equivalent wording.
- Write only these three files under `base/output`.
- Do not modify files under `base/input` or `base/software`.
- Do not read or modify hidden evaluator-owned directories.


Required actions:
Run the install script to install InterProScan 5.77-108.0 before scanning.
Run the staged InterProScan wrapper on the visible FASTA input.
Write `interpro_domains.tsv` with the exact required columns, one retained row per non-empty InterPro accession, merged spans for repeated accessions, and 2-decimal `e_value` formatting.
Map the retained InterPro accessions to GO terms with the staged `interpro2go` file and write `go_terms.tsv`.
Remove exact duplicate GO rows before saving the GO table.
Write a 1-2 sentence gamma-tubulin functional summary under `output/`.
Do not write extra files into `output/`.

Software: InterProScan
Python
bash

Input files:
name: protein_sequence.fasta
format: FASTA
description: Single staged query protein sequence to annotate
name: organism_name.txt
format: TXT
description: Visible organism context for the staged protein
name: install_software.sh
format: shell script
description: Idempotent installer for InterProScan 5.77-108.0 (~15 GB download, requires Java 11)
name: interproscan.sh
format: shell wrapper
description: Visible wrapper around the verified InterProScan 5.77-108.0 install
name: interpro2go
format: mapping text
description: Visible InterPro2GO mapping file aligned to the staged InterPro release
name: go_namespace_lookup.tsv
format: TSV
description: Visible GO namespace lookup for the staged GO ids