Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 3.58 KB

File metadata and controls

71 lines (48 loc) · 3.58 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

CoSIA (Cross-Species Investigation and Analysis) is an R Bioconductor package for comparative transcriptomics. It enables gene expression analysis across six species (human, mouse, rat, zebrafish, fruit fly, C. elegans) using RNA-Seq data from the Bgee database.

Common Commands

# Load package during development
devtools::load_all()

# Regenerate NAMESPACE and man/*.Rd files from roxygen2 comments
roxygen2::roxygenise()

# Run R CMD check
devtools::check()

# Run a single test file
testthat::test_file("tests/testthat/test-filename.R")

# Build vignettes
devtools::build_vignettes()

Command-line equivalents:

R CMD build .
R CMD check CoSIA_*.tar.gz

Architecture

The package is built around a single S4 class CoSIAn with a sequential three-step workflow:

  1. getConversion() — maps gene IDs and orthologs across species. Supports Ensembl_id, Entrez_id, and Symbol. Uses BiomaRt or AnnotationDBI for ID conversion, and HomoloGene or NCBIOrtho for ortholog mapping. Populates the converted_id slot.

  2. getGEx() — fetches VST-normalized expression data from ExperimentHub (datasets EH7858–EH7863, one per species). Filters by tissues/species in the CoSIAn object. Populates the gex slot.

  3. getGExMetrics() — computes Coefficient of Variation (CV) or Shannon Diversity/Specificity (DS) metrics from the expression data. Metric types: CV_Tissue, CV_Species, DS_Gene, DS_Gene_all, DS_Tissue, DS_Tissue_all. Populates the metric slot.

Visualization methods (plotTissueGEx, plotSpeciesGEx, plotCVGEx, plotDSGEx) consume the gex or metric slots and return ggplot2/plotly objects. Utility methods getTissues() and viewCoSIAn() are standalone helpers.

Key Files

File Purpose
R/CoSIA-class.R S4 class definition and constructor validation
R/CoSIA-getConversion-method.R Gene ID/ortholog conversion logic (~1,300 lines)
R/CoSIA-getGEx-method.R ExperimentHub data fetching and tissue filtering
R/CoSIA-getGExMetrics-method.R CV and Shannon entropy metric calculations
R/CoSIA-plots-method.R All visualization methods
R/CoSIA-globals.R Global variable declarations (suppresses R CMD check NOTEs)
R/zzz.R Package load hook
vignettes/CoSIA_Intro.Rmd Primary user guide and usage examples

Claude Changelog

All changes made by Claude Code must be recorded in CLAUDE_CHANGELOG.md at the repo root. Add an entry for every session in which changes are made, with the date and a bullet list of what was changed and why.

At the start of every session, read CLAUDE_CHANGELOG.md to understand what has already been changed, what bugs have been fixed, and the reasoning behind non-obvious decisions.

Conventions

  • Documentation: All .Rd files are auto-generated by roxygen2 — edit comments in R/ source, then run roxygen2::roxygenise(). Never edit man/ files directly.
  • Examples: All exported functions use @examples with \dontrun{} or eval=FALSE to avoid long-running ExperimentHub downloads during R CMD check.
  • S4 pattern: Generic defined with setGeneric(), method defined with setMethod(). Follow existing patterns for any new methods.
  • Naming: camelCase for functions/methods (e.g., getConversion, plotTissueGEx); snake_case for slot names.
  • Versioning: Bioconductor-style (x.y.z where odd y = devel, even y = release). Update DESCRIPTION and NEWS.md together.