How somalogic/somadataio works
Main Components
• Core Library Code – Represented by the R/ directory. This is where the bulk of the functionality is implemented (e.g., functions for reading ADAT files, data manipulation, wrangling with dplyr/tidyr S3 methods, and exporting data).
• Testing Framework – Located in the tests/ directory (with testthat scripts, snapshot files, and helper scripts). This represents how functionality is verified.
• Documentation & Vignettes – Refer to the README.md, the vignettes/ directory, and the pkgdown website configuration. These are used to generate user documentation and example workflows.
• Build & Configuration – Files like DESCRIPTION, NAMESPACE, Makefile, and various GitHub workflows within .github/workflows. They manage package metadata, build procedures, CI/CD pipelines, and deployment to CRAN.
• External Data / Examples – The inst/extdata and data/ directories contain example ADAT files and data objects used for demonstrating functionality.
• Dependency Integrations – The package depends on several CRAN packages (e.g., dplyr, tidyr, cli, magrittr, tibble) along with an optional integration with Biobase from Bioconductor for specific functions.
Relationships and Interactions
• Core Library functions interact with external dependencies (e.g., dplyr and tidyr for S3 generic methods) to process ‘SomaScan’ data.
• Functions in the R/ folder provide the public API (read_adat, write_adat, pivotExpressionSet, etc.) which are then exercised by both user scripts and tests.
• The tests directory validates these functionalities by running a comprehensive test suite using the testthat framework.
• Documentation (via README, vignettes, and pkgdown) communicates how the core functionalities work and explains workflows (like two-group comparisons, linear regression, etc.).
• CI/CD pipelines (configured via the GitHub workflows) are set to perform recurring checks (build, test, document rendering, version checking, and even CRAN submission check via rhub).
Architectural Decisions and Design Patterns
• The package follows a modular design where each R script or function (e.g., read_adat, write_adat, and various utility functions) represents a specific responsibility in the process of importing, processing, and exporting data.
• S3 methods are prominently used to override standard R generics (print, summary, subset, etc.), enabling a clean, idiomatic interface.
• Testing is done using snapshot testing and unit tests to ensure stability of each component before public release.
• Continuous Integration is used for automated testing and documentation rendering to maintain quality.
Incorporate Relevant Technologies and Frameworks
• R as the primary language.
• CRAN packages: dplyr, tidyr, magrittr, tibble, cli, and lifecycle.
• Optionally, Bioconductor’s Biobase for transforming data into ExpressionSets.
• Testing: testthat framework.
• Documentation: pkgdown for website generation.
• GitHub Actions for CI/CD workflows.
• Do not hide utilities and helper functions; include them as sub-components in the “Core Library” section.
• Example objects and data transformation flows, such as how an ADAT file is loaded, parsed into a structured R object, manipulated, and then exported.