biocohort (development version)
- README: a CRAN badge, and installation from CRAN first.
- Breaking change:
cohort_qc(scope = "subject", action = "flag")now writessubject_qc_statusandsubject_qc_reasontosubject_tbl. It used the same names as the sample scope,qc_statusandqc_reason. With both scopes flagged,write_manifest()andwrite_study_yaml()failed, and a subject flag alone moved to the samples after a write and a read. Code that reads the subject flag by its old name needs the new one.cohort_read()renames the old columns in a cohort saved by 0.1.x. -
write_manifest()andsamples(with_subjects = TRUE)(and soas_coldata(),join_metadata()andsample_sheet()) now stop with a clear error when a column other thansubject_idis in both tables. Before, the join renamed the pair to.xand.y, andwrite_manifest()failed with an internal error.cohort_derive()no longer creates a column whose name is used at the other level. -
validate_manifest()andread_manifest()no longer treat a missing subject value as a conflict when another row of the same subject gives the value. The given value fills the subject row. Two different given values are still a conflict.missing_is_conflict = TRUEkeeps the old check (#75). -
AnalysisSpechas a fourth level,"sample", for pipelines that write one file per sample. Its path template takes{sample_id}and{role}, its defaultkey_colsaresubject_idandsample_id, andcohort_filter()trims a loaded sample-level table to the kept samples (#73). -
analysis_files()now records thesize,modifiedtime andsha256checksum of each file, so a report can show which inputs changed since the last run. The checksum is filled withchecksum = TRUEinload_analysis()andload_analyses()(#79).load_analyses()now keeps the file tables of earlier loads when it loads one analysis at a time.load_analysis()andload_analyses()(#79). -
write_study_yaml()writes the QC, derive and corrections logs as CSV files next to the manifest and lists them under a newlogs:key.read_study_yaml()reads them back, so a study folder in git keeps the reason for each QC flag (#78). -
Cohorthas acorrectionsproperty, set with the newcorrectionsargument ofcohort_new().corrections_log()accepts a cohort, andread_study_yaml()keeps the audit of the corrections it applies.cohort_read()gives a cohort saved by 0.1.x the new property. -
read_manifest()takes several files and stacks them into one manifest, for example one sample sheet per assay. A name on a path fills theassaycolumn of a file that has none, and a conflict across files names the files. The study YAMLmanifest:key accepts a list ofpathandassayentries (#75).
biocohort 0.1.1
CRAN release: 2026-09-18
Resubmission to CRAN. The package code is unchanged from 0.1.0; every change is in the documentation and the repository.
-
?biocohortnames the three articles asvignette()calls instead of linking to them by a relative path that only exists on the website, and the package README links to the contributing guide by its full URL. CRAN’s pretest rejected 0.1.0 for both links. - The
liftover_rtracklayer()example is wrapped in\donttest{}. Loadingrtracklayeralone takes longer than the five seconds CRAN allows an example. - The
Descriptionfield is rewritten in plainer sentences. - New examples for
translate()on a cohort,translation_report(),load_analyses(),cohort_read(),register_liftover_backend(),register_ortholog_backend(),liftover_vcf(), and theStudy,Subject,Cohort,AnalysisSpec, andTranslationResultconstructors. Thetranslation_report()example was a comment before, not code. - Help pages that still pointed to
orthologize()now point totranslate(). -
citation("biocohort")includes the Zenodo DOI. - README: install from r-universe as well as GitHub.
- CI: a
cranworkflow runs the check the way CRAN’s pretest does.
biocohort 0.1.0
First release. Earlier drafts carried the numbers 0.1.0 to 0.3.0 and were never tagged.
Data model
- S7 classes
Study,Subject,Cohort, andAnalysisSpec, built withstudy_new(),subject_new(),cohort_new(), andanalysis_spec_new(). Each class validates on construction, including the rawStudy(),Subject(), andCohort()constructors. -
validate_manifest()takes one long-format manifest (one row per sample, required columnssubject_id,assay,sample_id, optionalroleplus subject-level columns) and returnssubject_tbl,sample_map, andcompleteness_tbl. Species and assays are free-form values, never a fixed list and never columns. Every column is coerced to character, so a factor or a numeric column never breaks a downstream join. -
validate_manifest(sample_cols = )keeps named extra columns (fastq_1,fastq_2,lane,qc_status, and more) at the sample level instead of raising a false conflict. -
read_manifest_csv()reads a manifest from CSV and delegates tovalidate_manifest(). -
validate_cohort()checks aCohortfor the four requiredsample_mapcolumns, non-missing species, unique subject ids, and referential integrity. -
sample_pairs()derives tumor and normal pairs from asample_mapon demand, with configurable role labels and asepargument for the pair id. -
example_cohortships as a small demonstration dataset.
Accessors and cohort tools
-
subjects(),samples(), andcompleteness()return plain tibbles read from a cohort.completeness(wide = TRUE)gives one row per subject and one column per assay. -
subject()reads one subject fromsubject_tblas aSubjectobject. -
cohort_filter()keeps a subset of subjects or assays and returns a cohort that is still valid.drop_sample_idsremoves specific sample ids instead of naming every sample to keep. -
print()forCohort,Subject, andAnalysisSpecshows subject and sample counts, extra sample columns, a QC summary, and registered analyses.
Quality control
-
cohort_qc()flags or drops subjects or samples, recording the reason inqc_status/qc_reasoncolumns (flag) or by removing the matching rows (drop).qc_log()reads the audit trail every call appends tocohort@qc, which is not cleared bycohort_filter(), so the record survives later structural changes to the cohort.
Groups and contrasts
-
cohort_groups()groups a cohort’s subjects by one or moresubject_tblcolumns and returns one row per combination that actually occurs, with the matching subject ids.cohort_contrasts()enumerates every pairwise contrast between those groups, ready to pipe intocohort_filter()for each side.
Derived columns
-
cohort_derive()bins an existing numeric column at one or more named cutoffs and writes the result as a new column onsubject_tblorsample_map, so a cutoff like “early onset is 120 days or under” is a value passed in, not code.derive_log()reads the provenance every call appends tocohort@derived, which, likecohort@qc, is not cleared bycohort_filter().
Reading and writing files
-
read_manifest()reads a manifest from CSV, TSV, or Excel, always as text, and validates it in one call. -
manifest_from_wide()reshapes a wide, one-row-per-subject table with one id column per assay into the long formvalidate_manifest()expects. -
write_manifest()writes a cohort’s tables back out as one manifest.cohort_save()andcohort_read()keep a whole cohort as an RDS file. -
read_study_yaml()builds a cohort from one YAML file that names the study, the manifest, the file paths, and the registered analyses.write_study_yaml()writes one back. Every path is resolved relative to the YAML file’s own directory. -
apply_corrections()applies a table of documented overrides (level,id,column,value,reason) to a manifest before it is validated, and keeps an audit trail.read_corrections()reads that table from a file.
Pipeline integration
-
sample_sheet()writes the sample list a pipeline expects, with built-in templates fornf-core/rnaseq,nf-core/rnavar,nf-core/atacseq, andnf-core/sarek.sample_sheet_templates()lists the built-in names. -
check_paths()tests that the file paths named incohort@pathsand in known sample-level path columns exist, without ever raising an error. -
as_coldata()returns aCohort’s per-sample metadata as row-named data, ready for aSummarizedExperiment’scolData.join_metadata()carries that metadata into aSummarizedExperiment, a Seurat object, or a plain data frame. -
project_root(),project_path(),ensure_dir(), andread_dotenv()find a project’s root folder, build paths under it, and read a.envfile.
Analysis registry and loading
-
analysis_register(),analysis_list(), andanalysis_spec()manageAnalysisSpecentries in a cohort.format,reader, andkey_colsdefault from the spec’spath_templateandlevelwhen not given. -
load_analysis()andload_analyses()resolve a spec’spath_templateper subject, per pair, or per cohort, read the files with the spec’s reader, and record which files were found. Subject and pair units are enumerated only for the spec’s own assay.analysis_files()returns that record. - A
path_templateending in.parquetnow getsarrow::read_parquetas its default reader, the same way.csv,.tsv,.txt, and.rdsalready do.
Cross-species translation (experimental)
-
translate()moves a feature table across genome builds or species. Coordinate features go through a liftover backend; gene features go through an ortholog backend.orthologize()still works as an alias and warns once per session.translation_report()returns the per-analysis results. - For a whole cohort, the source species is inferred from
subject_tblwhen every subject shares one species. A cohort with more than one species is split by species, translated, and recombined, as long as the analysis table carries asubject_idcolumn. -
liftover_intervals()with anrtracklayerbackend and acrossmapbackend, plusliftover_vcf()for allele-aware variant liftover through CrossMap. Backends are registered withregister_liftover_backend(). -
ortholog_genes()with an offlinebabelgenebackend, registered withregister_ortholog_backend(). Model-to-model pairs pivot through human. The backend accepts acachefile so repeated lookups skip babelgene. -
TranslationResultkeeps mapped and unmapped features under one.feature_idkey, for both coordinate and gene features.translation_stats()summarizes them.