Skip to content

Turn any AI agent into an AI Scientist. The #1 Agent Skills library for science, used by 250,000+ scientists worldwide. 177 ready-to-use validated skills plus 100+ scientific databases covering biology, chemistry, medicine, and drug discovery. Compatible with Cursor, Claude Code, Codex, Pi, Antigravity, and the open Agent Skills standard.

fix(deeptools): replace only the BAM filename suffix for indexes

Timothy Kassisd900a9808c45
diff --git a/skills/deeptools/SKILL.md b/skills/deeptools/SKILL.md
index 22ef7d07..adcd44f3 100644
--- a/skills/deeptools/SKILL.md
+++ b/skills/deeptools/SKILL.md
@@ -5,7 +5,7 @@ license: BSD license
allowed-tools: Read Write Edit Bash
compatibility: Requires Python >3.8 and deepTools 3.5.6-compatible dependencies. The upstream project recommends conda/bioconda for full dependency resolution; repo examples use uv with pinned PyPI installs for reproducible command-line workflows.
metadata:
- version: "1.4"
+ version: "1.5"
skill-author: K-Dense Inc.
---
diff --git a/skills/deeptools/scripts/validate_files.py b/skills/deeptools/scripts/validate_files.py
index d9885144..f5db0321 100644
--- a/skills/deeptools/scripts/validate_files.py
+++ b/skills/deeptools/scripts/validate_files.py
@@ -24,7 +24,8 @@ def check_file_exists(filepath):
def check_bam_index(bam_file):
"""Check if BAM file has an index (.bai or .bam.bai)."""
bai_file1 = bam_file + ".bai"
- bai_file2 = bam_file.replace(".bam", ".bai")
+ # Preserve parent directories and any earlier .bam in the filename.
+ bai_file2 = str(Path(bam_file).with_suffix(".bai"))
if os.path.exists(bai_file1):
return True, f"✓ BAM index found: {bai_file1}"
diff --git a/tests/deeptools/test_scripts.py b/tests/deeptools/test_scripts.py
index 557a66e0..751818a8 100644
--- a/tests/deeptools/test_scripts.py
+++ b/tests/deeptools/test_scripts.py
@@ -236,6 +236,23 @@ class FileValidationTests(unittest.TestCase):
ok, _ = validate_files.check_bam_index(str(bam))
self.assertTrue(ok)
+ def test_bam_index_lookup_only_replaces_the_final_suffix(self) -> None:
+ for name in ("sample.bam", "sample.bam.bam"):
+ for append in (False, True):
+ with self.subTest(name=name, append=append):
+ with tempfile.TemporaryDirectory() as directory:
+ stage = Path(directory) / "align.bam"
+ stage.mkdir()
+ bam = stage / name
+ bam.write_bytes(b"BAM\1")
+ ok, _ = validate_files.check_bam_index(str(bam))
+ self.assertFalse(ok)
+ index = Path(str(bam) + ".bai") if append else bam.with_suffix(".bai")
+ index.write_bytes(b"BAI\1")
+ ok, message = validate_files.check_bam_index(str(bam))
+ self.assertTrue(ok, message)
+ self.assertIn(str(index), message)
+
def test_tiny_bigwig_is_flagged_as_suspicious(self) -> None:
with tempfile.TemporaryDirectory() as directory:
small = Path(directory) / "small.bw"