Sample subannotation

The PEPs that this examples are based on are available in the example_peps repsitory.

This vignette will show you how sample subannotations work in a series of examples.

Import libraries and set the working directory

import peppy

Example 1: basic sample subannotation table

Example 1 demonstrates how a sample_subannotation is used. In this example, 2 samples have multiple input files that need merging (frog_1 and frog_2), while 1 sample (frog_3) does not. Therefore, frog_3 specifies its file in the sample_annotation table, while the others leave that field blank and instead specify several files in the sample_subannotation.

p1 = peppy.Project("../examples/example_peps-master/example_subannotation1/project_config.yaml")
p1.samples[0].file
No local config file was provided
Found global config file in DIVCFG: /Users/mstolarczyk/Uczelnia/UVA/code/pepenv/uva_rivanna.yaml
Loading divvy config file: /Users/mstolarczyk/Uczelnia/UVA/code/pepenv/uva_rivanna.yaml
Use 'compute_packages' instead of 'compute'
Available packages: set(['singularity_local', 'default', 'largemem', 'singularity_slurm', 'sigterm', 'local', 'parallel'])
Activating compute package 'default'

ss = p1.get_subsample(sample_name="frog_1", subsample_name="sub_a")
print(type(ss))
print(ss)

Example 2: subannotations and derived columns

Example 2 uses a sample_subannotation table and a derived column to point to files. This is a rather complex example. Notice we must include the file_id column in the sample_annotation table, and leave it blank; this is then populated by just some of the samples (frog_1 and frog_2) in the sample_subannotation, but is left empty for the samples that are not merged.

import peppy
p2 = peppy.Project("../examples/example_peps-master/example_subannotation2/project_config.yaml")
p2.samples[0].file
p2.samples[1].file
p2.samples[2].file
p2.samples[3].file

Example 3: subannotations and expansion characters

This example gives the exact same results as example 2, but in this case, uses a wildcard for frog_2 instead of including it in the sample_subannotation table. Since we can't use a wildcard and a subannotation for the same sample, this necessitates specifying a second data source class (local_files_unmerged) that uses an asterisk. The outcome is the same.

p3 = peppy.Project("../examples/example_peps-master/example_subannotation3/project_config.yaml")
p3.samples[0].file
p3.samples[1].file
p3.samples[2].file
p3.samples[3].file

Example 4: subannotations and multiple (separate-class) inputs

Merging is for same class inputs (like, multiple files for read1). Different-class inputs (like read1 vs read2) are handled by different attributes (or columns). This example shows you how to handle paired-end data, while also merging within each.

p4 = peppy.Project("../examples/example_peps-master/example_subannotation4/project_config.yaml")
p4.samples[0].read1
p4.samples[0].read2

Example 5: subannotations and multiple (separate-class) inputs with derived columns

Merging is for same class inputs (like, multiple files for read1). Different-class inputs (like read1 vs read2) are handled by different attributes (or columns). This example shows you how to handle paired-end data, while also merging within each.

p5 = peppy.Project("../examples/example_peps-master/example_subannotation5/project_config.yaml")
p5.samples[0].read1
p5.samples[0].read2
p5.samples[1].read1
p5.samples[1].read2
p5.samples[2].read1
p5.samples[2].read2
p5.samples[3].read1
p5.samples[3].read2