← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-temporal-genomics-circadian-rhythms / references / usage-guide.md

Known-Period Rhythm Testing - Usage Guide

Overview

Tests and estimates rhythmicity at a PRE-SPECIFIED period (canonically 24h) in a single condition of time-series omics. This is known-period TESTING (the period is fixed, then rhythmicity, phase, amplitude, and MESOR are tested/estimated at it), which is categorically different from unknown-period DISCOVERY (finding the period; see temporal-genomics/periodicity-detection) and from comparing rhythms BETWEEN conditions (differential rhythmicity; see temporal-genomics/differential-rhythmicity). It fits cosinor regression (CosinorPy), runs JTK_CYCLE/ARSER/Lomb-Scargle meta-analysis (MetaCycle meta2d), and non-parametric tests for asymmetric waveforms (RAIN, DiscoRhythm). The governing rule: temporal conclusions are dominated by SAMPLING DESIGN, not the algorithm.

Prerequisites

Python

pip install "numpy<2.0" CosinorPy pandas statsmodels matplotlib seaborn

CosinorPy 3.1 calls the removed np.round_, so it requires numpy<2.0, and it imports as from CosinorPy import cosinor, cosinor1, file_parser (capitalized package name).

R

install.packages(c('data.table', 'MetaCycle'))
BiocManager::install(c('rain', 'DiscoRhythm'))

Data Requirements

Quick Start

Tell the AI agent what to analyze: - "Test which genes are circadian in my 48-hour time-course RNA-seq (sampled every 4 hours)" - "Fit cosinor models and give me phase, amplitude, MESOR, and relative amplitude per gene" - "Run MetaCycle meta2d on my expression matrix and rank rhythmic genes with an amplitude filter" - "My waveforms are asymmetric (fast rise, slow decay) - use RAIN instead of cosinor"

Example Prompts

Basic Rhythm Detection

"I have a gene expression matrix sampled every 4 hours over 48 hours. Test which genes have 24-hour rhythms and report relative amplitude, not just p-value."

"Run MetaCycle meta2d on my RNA-seq time-course, but treat meta2d_BH.Q as a rank and add an rAMP filter."

Parameter Estimation

"Fit cosinor models and give me acrophase converted to peak hour, amplitude, and MESOR for each rhythmic gene."

"This is free-running (constant darkness) data - use a 22-26h period window and report phase in CT."

Method Choice

"My clock-output genes have sharp asymmetric peaks. Which method should I use and why?"

"I have single-replicate sparse sampling - are my JTK p-values trustworthy, and what should I use instead?"

(Comparing rhythms between conditions - "which genes lose/gain/phase-shift their rhythm in the KO?" - is temporal-genomics/differential-rhythmicity, not this skill.)

What the Agent Will Do

  1. Confirm the question is known-period testing (not period discovery) and set the period window from the light regime
  2. Load and validate the matrix; check cycles, sampling density, and replication against design minima
  3. Choose a method by waveform shape and sampling (cosinor / JTK / eJTK / ARSER / RAIN / meta2d) and explain why
  4. Fit models and extract amplitude, relative amplitude, acrophase (converted to peak hour), MESOR, p-value
  5. Control FDR (BH), then apply an effect-size filter (rAMP / fold-change) because significance alone over-detects
  6. Report the amplitude distribution of the hit list and flag design confounds (harvest order, LD masking, damping)
  7. Route between-condition questions to temporal-genomics/differential-rhythmicity (never intersect two separate rhythm lists)

Tips

temporal-genomics/differential-rhythmicity - Comparing rhythms between conditions (gain/loss/phase/amplitude change) temporal-genomics/periodicity-detection - Unknown-period discovery with Lomb-Scargle and wavelets temporal-genomics/temporal-clustering - Group rhythmic genes by phase/shape differential-expression/timeseries-de - Temporal differential expression (monotone trend, not rhythmicity) data-visualization/heatmaps-clustering - Circular phase heatmaps and phase-ordered maps