Skip to contents

A small Cohort with two rat and two mouse subjects. Use it to explore the data model, to try the API, or as a template for a cohort built from real data.

Usage

example_cohort

Format

A Cohort object (S7 class) with the following structure:

  • study: A Study object with metadata for a cross-species genomics project

  • subject_tbl (tibble): 4 subjects (2 rat, 2 mouse) with species, sex, strain, genotype, cohort, timepoint

  • sample_map (tibble): Long-format map (subject_id, assay, sample_id, role, fastq_1, fastq_2) covering WES tumor/normal and snRNA-seq samples. fastq_1/fastq_2 show that an extra sample-level column survives validate_manifest() alongside the four canonical ones.

  • paths (list): Empty, ready for file paths

  • analyses (list): Empty, ready for analysis results

Details

The cohort shows:

  • Two species in one subject table

  • Two assays per subject in one long-format sample map

  • A Study object for project context

Subjects are stored as rows of subject_tbl. Use subject() to read one of them as a Subject object.

See also

cohort_new() for creating Cohort objects, subject() for reading one subject, validate_manifest() for preparing manifest data, read_manifest_csv() for loading manifest from CSV file

Examples

# Load the example cohort
data(example_cohort)

# View the study metadata
example_cohort@study
#> Study <STUDY001>: Cross-species genomics comparison 
#>   Example study comparing rat and mouse genomes

# Read one subject as a Subject object
rat1 <- subject(example_cohort, "RAT001")
rat1@species
#> [1] "rat"
rat1@sex
#> [1] "M"

# List all subject ids
example_cohort@subject_tbl$subject_id
#> [1] "RAT001"   "RAT002"   "MOUSE001" "MOUSE002"

# View all subjects with metadata
example_cohort@subject_tbl
#> # A tibble: 4 × 7
#>   subject_id species sex   strain  genotype cohort    timepoint
#>   <chr>      <chr>   <chr> <chr>   <chr>    <chr>     <chr>    
#> 1 RAT001     rat     M     Lewis   WT       Control   Day0     
#> 2 RAT002     rat     F     Lewis   WT       Control   Day0     
#> 3 MOUSE001   mouse   M     C57BL/6 WT       Control   Day0     
#> 4 MOUSE002   mouse   F     C57BL/6 KO       Treatment Day0     

# View the sample map
example_cohort@sample_map
#> # A tibble: 12 × 6
#>    subject_id assay sample_id  role   fastq_1                fastq_2            
#>    <chr>      <chr> <chr>      <chr>  <chr>                  <chr>              
#>  1 RAT001     wes   WES_R001_T tumor  wes_r001_t_R1.fastq.gz wes_r001_t_R2.fast…
#>  2 RAT001     wes   WES_R001_N normal wes_r001_n_R1.fastq.gz wes_r001_n_R2.fast…
#>  3 RAT001     scrna SNRNA_R001 tumor  snrna_r001_R1.fastq.gz snrna_r001_R2.fast…
#>  4 RAT002     wes   WES_R002_T tumor  wes_r002_t_R1.fastq.gz wes_r002_t_R2.fast…
#>  5 RAT002     wes   WES_R002_N normal wes_r002_n_R1.fastq.gz wes_r002_n_R2.fast…
#>  6 RAT002     scrna SNRNA_R002 tumor  snrna_r002_R1.fastq.gz snrna_r002_R2.fast…
#>  7 MOUSE001   wes   WES_M001_T tumor  wes_m001_t_R1.fastq.gz wes_m001_t_R2.fast…
#>  8 MOUSE001   wes   WES_M001_N normal wes_m001_n_R1.fastq.gz wes_m001_n_R2.fast…
#>  9 MOUSE001   scrna SNRNA_M001 tumor  snrna_m001_R1.fastq.gz snrna_m001_R2.fast…
#> 10 MOUSE002   wes   WES_M002_T tumor  wes_m002_t_R1.fastq.gz wes_m002_t_R2.fast…
#> 11 MOUSE002   wes   WES_M002_N normal wes_m002_n_R1.fastq.gz wes_m002_n_R2.fast…
#> 12 MOUSE002   scrna SNRNA_M002 tumor  snrna_m002_R1.fastq.gz snrna_m002_R2.fast…

# Count subjects by species
table(example_cohort@subject_tbl$species)
#> 
#> mouse   rat 
#>     2     2