Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make samples type array and nest under items #204 #205

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading