Required setup
This page takes you from the downloaded project to your first successful RNA-seq input check. R runs the analysis; Quarto renders the lessons and reports.
1. Gather the software
Install R, Quarto and an editor such as VS Code or RStudio. Reopen the terminal after installing R so it can find Rscript.
You can run the R analysis before installing Quarto. Quarto is needed when you want to preview or render the QMD guide and reports.
2. Download and open the project
- Open the AI-Assisted RNA-Seq Analysis repository.
- Select the green Code button, then Download ZIP.
- Extract the downloaded ZIP. The folder is usually named
ai-assisted-rnaseq-analysis-main. Do not work inside the compressed ZIP. - In VS Code, choose File → Open Folder and select the extracted folder.
- Check the file list:
_quarto.yml,data/,scripts/andexamples/should appear directly inside it. - Choose Terminal → New Terminal.
This is the main project folder. Run all guide commands here. You can keep the downloaded folder name; no renaming is required. If extraction created an extra outer folder, open the inner folder containing _quarto.yml.
Check the folder and R installation:
macOS or Linux terminal
pwd
ls
Rscript --versionWindows PowerShell
Get-Location
Get-ChildItem
Rscript --versionIf the expected files are missing, reopen the correct folder and a new terminal before continuing. If Rscript is missing, install R or reopen the terminal after installation.
3. Create the R package environment
renv keeps packages in a project-specific library. The commands set a CRAN mirror explicitly so R does not stop at “Please select a CRAN mirror for use in this session”. Open an R console with the main project folder as its working directory. Confirm with getwd() before proceeding. Follow only the route that applies to your files.
If the project includes renv.lock
Install renv if needed and restore its recorded package versions:
options(repos = c(CRAN = "https://cloud.r-project.org"))
install.packages("renv")
renv::restore()
stopifnot(requireNamespace("DESeq2", quietly = TRUE),
requireNamespace("ggplot2", quietly = TRUE))
renv::status()Wait for restoration to finish and read any errors. This route applies once a tested lockfile and the renv activation files have been added to the project.
For this starter ZIP without a lockfile
options(repos = c(CRAN = "https://cloud.r-project.org"))
install.packages("renv")
renv::init(bare = TRUE)
renv::install(c("BiocManager", "ggplot2"))
BiocManager::install(c("DESeq2", "airway", "SummarizedExperiment"), ask = FALSE)
stopifnot(
requireNamespace("DESeq2", quietly = TRUE),
requireNamespace("airway", quietly = TRUE),
requireNamespace("SummarizedExperiment", quietly = TRUE),
requireNamespace("ggplot2", quietly = TRUE)
)
renv::status()init() creates .Rprofile, renv/activate.R and a local project library. If R restarts, reopen the project and continue in its environment. The stopifnot() check must finish without an error; it confirms the four packages are available in this R session. If DESeq2 is missing, run BiocManager::install("DESeq2", ask = FALSE) in the activated project and inspect any installation error before trying again.
If renv::status() lists airway, DESeq2 or SummarizedExperiment as missing: these are Bioconductor packages. Install them with BiocManager::install(c("airway", "DESeq2", "SummarizedExperiment"), ask = FALSE) or use their explicit renv sources:
renv::install(c("bioc::airway", "bioc::DESeq2", "bioc::SummarizedExperiment"))
stopifnot(requireNamespace("airway", quietly = TRUE),
requireNamespace("DESeq2", quietly = TRUE),
requireNamespace("SummarizedExperiment", quietly = TRUE))
renv::status()Do not use renv::install("airway") without the bioc:: prefix: it may search the CRAN repository and report that airway is unavailable. If an explicit Bioconductor install also fails, keep the download or installation error above the final message for diagnosis. Do not snapshot a project while required packages remain missing.
Once the analysis has run successfully, record the installed versions in the project lockfile:
renv::snapshot()
renv::status()
q(save = "no")When sharing the project, include renv.lock, .Rprofile and renv/activate.R; leave out the machine-specific renv/library/. The starter ZIP contains no lockfile because a portable project renv lockfile has not been generated. The bundled previews have their own tested run logs and session information. renv should activate when R starts in the initialized project. renv::status() checks its state.
Run these expressions at an R prompt, not in Bash or PowerShell. To exit an R console, use q(save = "no") before entering Rscript commands in the terminal.
4. Check the synthetic inputs
From the main project folder:
Rscript scripts/R/run_workflow.R data/synthetic results/synthetic --check-onlyExpect 12 samples, 2,000 genes and design ~donor + group. This checks file structure, matching sample IDs, nonnegative integer counts and basic replication. It does not run DESeq2 or refresh old results.
The full run needs DESeq2 and ggplot2, while --check-only stops before loading them. To confirm that the terminal uses the same project library as the R console, run:
Rscript -e 'cat("DESeq2 available:", requireNamespace("DESeq2", quietly = TRUE), "\n"); print(.libPaths())'It should print DESeq2 available: TRUE. If the console check passes but this says FALSE, confirm you are in the main project folder and that its .Rprofile and renv/activate.R exist. Restart the terminal there and repeat the check. On Windows PowerShell, use the same single-quoted command.
Continue when the packages load in the project environment and the input check passes. If installation fails, resolve the complete error before running the analysis.
5. Know where things live
| Folder | Purpose |
|---|---|
data/ |
Input counts and metadata by dataset |
scripts/R/ |
Preparation, analysis and verification scripts |
examples/ |
Seven lesson pages per dataset |
results/ |
Generated tables, figures and run logs |
reports/ |
Learner reports |
docs/ |
Rendered book after quarto render |
renv/ |
Project activation and package environment after initialization |
Paths such as data/synthetic/ are relative to the main folder. If a file cannot be found, check your terminal location before changing the command.
6. Preview or render
quarto previewPress Ctrl+C to stop preview. quarto render builds the complete guide. Rendering displays instructions; it does not run the analysis. To render a completed report after running the workflow, use quarto render reports/synthetic-report.qmd --to html.
Return for another session
Open the same project folder. Its .Rprofile activates renv when R starts. Check renv::status() in R; if the lockfile and local library disagree, run renv::restore() before proceeding. Then use the --check-only command above to confirm the inputs.