Skip to content

Commit

Permalink
make samples type array and nest under items #204
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Aug 30, 2024
1 parent 402ab1c commit b1b451d
Show file tree
Hide file tree
Showing 13 changed files with 336 additions and 306 deletions.
6 changes: 6 additions & 0 deletions pipestat/parsed_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,16 @@ def __init__(self, data: Union[Dict[str, Any], Path, str]) -> None:

self._pipeline_name = data["properties"].pop(SCHEMA_PIPELINE_NAME_KEY, None)

# Two passes for sample-data as it is now nested under items per #204
sample_data = _safe_pop_one_mapping(
subkeys=["samples"],
data=data["properties"],
info_name="sample-level",
mappingkey="items",
)
sample_data = _safe_pop_one_mapping(
data=sample_data,
info_name="sample-level",
mappingkey="properties",
)

Expand Down
12 changes: 7 additions & 5 deletions tests/data/output_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ type: object
properties:
pipeline_name: "default_pipeline_name"
samples:
type: object
properties:
result_name:
type: string
description: "ResultName"
type: array
items:
type: object
properties:
result_name:
type: string
description: "ResultName"

90 changes: 46 additions & 44 deletions tests/data/output_schema_as_JSON_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,56 @@ type: object
properties:
pipeline_name: "default_pipeline_name"
samples:
type: object
properties:
number_of_things:
type: integer
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
output_image:
$ref: "#/$defs/image"
description: "This an output image"
output_file:
$ref: "#/$defs/file"
description: "This a path to the output image"
collection_of_images:
type: array
description: A collection of images.
items:
type: array
items:
type: object
properties:
number_of_things:
type: integer
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit."
output_image:
$ref: "#/$defs/image"
description: "This an output image"
output_file:
$ref: "#/$defs/file"
description: "This a path to the output image"
collection_of_images:
type: array
description: A collection of images.
items:
type: object
properties:
prop1:
$ref: "#/$defs/file"
description: An example file.
nested_object:
type: object
description: An object containing output file and image.
properties:
prop1:
example_property_1:
$ref: "#/$defs/file"
description: An example file.
nested_object:
type: object
description: An object containing output file and image.
properties:
example_property_1:
$ref: "#/$defs/file"
description: An example file.
example_property_2:
$ref: "#/$defs/image"
description: An example image.
output_file_nested_object:
type: object
description: First Level
properties:
example_property_1:
type: object
description: Second Level
properties:
third_level_property_1:
$ref: "#/$defs/file"
description: Third Level
example_property_2:
type: object
description: Second Level
properties:
third_level_property_1:
$ref: "#/$defs/file"
description: Third Level
example_property_2:
$ref: "#/$defs/image"
description: An example image.
output_file_nested_object:
type: object
description: First Level
properties:
example_property_1:
type: object
description: Second Level
properties:
third_level_property_1:
$ref: "#/$defs/file"
description: Third Level
example_property_2:
type: object
description: Second Level
properties:
third_level_property_1:
$ref: "#/$defs/file"
description: Third Level
$defs:
image:
type: object
Expand Down
42 changes: 22 additions & 20 deletions tests/data/output_schema_html_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,28 @@ properties:
type: boolean
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra."
samples:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ipsum erat, porta in condimentum viverra, pellentesque in nisl. Nulla rhoncus nibh est, quis malesuada diam suscipit at. In ut diam."
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
output_file:
$ref: "#/$defs/file"
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
output_image:
$ref: "#/$defs/image"
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra."
type: array
items:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ipsum erat, porta in condimentum viverra, pellentesque in nisl. Nulla rhoncus nibh est, quis malesuada diam suscipit at. In ut diam."
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
output_file:
$ref: "#/$defs/file"
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce nec cursus nulla."
output_image:
$ref: "#/$defs/image"
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras pharetra."
$defs:
image:
type: object
Expand Down
50 changes: 26 additions & 24 deletions tests/data/sample_output_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@ type: object
properties:
pipeline_name: "default_pipeline_name"
samples:
type: object
properties:
number_of_things:
type: integer
description: "Number of things"
percentage_of_things:
type: number
description: "Percentage of things"
name_of_something:
type: string
description: "Name of something"
switch_value:
type: boolean
description: "Is the switch on or off"
output_file:
$ref: "#/$defs/file"
description: "This a path to the output file"
output_image:
$ref: "#/$defs/image"
description: "This a path to the output image"
md5sum:
type: string
description: "MD5SUM of an object"
highlight: true
type: array
items:
type: object
properties:
number_of_things:
type: integer
description: "Number of things"
percentage_of_things:
type: number
description: "Percentage of things"
name_of_something:
type: string
description: "Name of something"
switch_value:
type: boolean
description: "Is the switch on or off"
output_file:
$ref: "#/$defs/file"
description: "This a path to the output file"
output_image:
$ref: "#/$defs/image"
description: "This a path to the output image"
md5sum:
type: string
description: "MD5SUM of an object"
highlight: true
$defs:
image:
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ properties:
type: boolean
description: "Is the switch on or off"
samples:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
type: array
items:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
status:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ properties:
type: boolean
description: "Is the switch on or off"
samples:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
type: array
items:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ type: object
properties:
pipeline_name: "default_pipeline_name"
samples:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
type: array
items:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
status:
type: object
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ type: object
properties:
pipeline_name: "default_pipeline_name"
samples:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
type: array
items:
type: object
properties:
smooth_bw:
path: "aligned_{genome}/{sample_name}_smooth.bw"
type: string
description: "A smooth bigwig file"
aligned_bam:
path: "aligned_{genome}/{sample_name}_sort.bam"
type: string
description: "A sorted, aligned BAM file"
peaks_bed:
path: "peak_calling_{genome}/{sample_name}_peaks.bed"
type: string
description: "Peaks in BED format"
Loading

0 comments on commit b1b451d

Please sign in to comment.