docs / data_structures / read_group / validate_read_group
Task

validate_read_group

Validate a ReadGroup struct's fields are defined and well-formed
WDL Version
1.1
RUN WITH

sprocket run --name validate_read_group data_structures/read_group.wdldata_structures\read_group.wdl [INPUTS]...

Inputs

Required Inputs

Name
Type
Description
read_group
ReadGroup
ReadGroup struct to validate
ReadGroup struct to validate

Other Inputs

Name
Type
Default
Description
required_fields
Array[String]
[]
Array of read group fields that must be defined. The ID field is always required and does not need to be specified.
Array of read group fields that must be defined. The ID field is always required and does not need to be specified.
[]
restrictive
Boolean
true
If true, run a stricter validation of field values. Otherwise, check against SAM spec-defined values.
If true, run a stricter validation of field values. Otherwise, check against SAM spec-defined values.
true

Outputs

Name
Type
Expression
Description
check
String
"passed"
Dummy output to indicate success and enable call-caching
Dummy output to indicate success and enable call-caching
"passed"

Default Runtime Attributes

Attribute
Value
memory
"4 GB"
disks
"10 GB"
container
"ghcr.io/stjudecloud/util:2.2.1"
maxRetries
1

Command

exit_code=0 if ~{restrictive}; then if [[ ~{read_group.ID} =~ ^~{id_pattern}$ ]] \ || [[ ~{read_group.ID} =~ ~{restrictive_pattern} ]] then >&2 echo "ID (~{read_group.ID}) must not match patterns:" >&2 echo "'~{id_pattern}' or '~{restrictive_pattern}'" exit_code=1 fi fi if [[ ! "~{read_group.ID}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "ID must match pattern ~{sam_spec_pattern}" exit_code=1 fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "SM") -eq 1 ]; then if [ -z "~{read_group.SM}" ]; then >&2 echo "SM is required" exit_code=1 fi fi if ~{defined(read_group.SM)}; then if ~{restrictive}; then if [[ "~{read_group.SM}" =~ ^~{sample_pattern}$ ]] \ || [[ "~{read_group.SM}" =~ ~{restrictive_pattern} ]] then >&2 echo "SM must not match patterns:" >&2 echo "'~{sample_pattern}' or '~{restrictive_pattern}'" exit_code=1 fi fi if [[ ! "~{read_group.SM}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "SM must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "BC") -eq 1 ]; then if [ -z "~{read_group.BC}" ]; then >&2 echo "BC is required" exit_code=1 fi fi if ~{defined(read_group.BC)}; then if [[ ! "~{read_group.BC}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "BC must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "CN") -eq 1 ]; then if [ -z "~{read_group.CN}" ]; then >&2 echo "CN is required" exit_code=1 fi fi if ~{defined(read_group.CN)}; then if [[ ! "~{read_group.CN}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "CN must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "DS") -eq 1 ]; then if [ -z "~{read_group.DS}" ]; then >&2 echo "DS is required" exit_code=1 fi fi if ~{defined(read_group.DS)}; then if [[ ! "~{read_group.DS}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "DS must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "DT") -eq 1 ]; then if [ -z "~{read_group.DT}" ]; then >&2 echo "DT is required" exit_code=1 fi fi if ~{defined(read_group.DT)}; then if [[ ! "~{read_group.DT}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "DT must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "FO") -eq 1 ]; then if [ -z "~{read_group.FO}" ]; then >&2 echo "FO is required" exit_code=1 fi fi if ~{defined(read_group.FO)}; then if [[ ! "~{read_group.FO}" =~ ^\*|[ACMGRSVTWYHKDBN]+$ ]]; then >&2 echo "FO must match pattern \*|[ACMGRSVTWYHKDBN]+" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "KS") -eq 1 ]; then if [ -z "~{if defined(read_group.KS) then read_group.KS else ""}" ]; then >&2 echo "KS is required" exit_code=1 fi fi if ~{defined(read_group.KS)}; then if [[ ! "~{read_group.KS}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "KS must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "LB") -eq 1 ]; then if [ -z "~{read_group.LB}" ]; then >&2 echo "LB is required" exit_code=1 fi fi if ~{defined(read_group.LB)}; then if [[ ! "~{read_group.LB}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "LB must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "PG") -eq 1 ]; then if [ -z "~{read_group.PG}" ]; then >&2 echo "PG is required" exit_code=1 fi fi if ~{defined(read_group.PG)}; then if [[ ! "~{read_group.PG}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "PG must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "PI") -eq 1 ]; then if [ -z "~{read_group.PI}" ]; then >&2 echo "PI is required" exit_code=1 fi fi if ~{defined(read_group.PI)}; then if [[ ! "~{read_group.PI}" =~ ^[0-9]+$ ]]; then >&2 echo "PI must match pattern [0-9]+" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "PL") -eq 1 ]; then if [ -z "~{read_group.PL}" ]; then >&2 echo "PL is required" exit_code=1 fi fi if ~{defined(read_group.PL)}; then if [[ ! "~{read_group.PL}" =~ ^~{sep("|", platforms)}$ ]]; then >&2 echo "PL must match pattern ~{sep("|", platforms)}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "PM") -eq 1 ]; then if [ -z "~{read_group.PM}" ]; then >&2 echo "PM is required" exit_code=1 fi fi if ~{defined(read_group.PM)}; then if [[ ! "~{read_group.PM}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "PM must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi if [ $(echo "~{sep(" ", required_fields)}" | grep -Ewc "PU") -eq 1 ]; then if [ -z "~{read_group.PU}" ]; then >&2 echo "PU is required" exit_code=1 fi fi if ~{defined(read_group.PU)}; then if [[ ! "~{read_group.PU}" =~ ^~{sam_spec_pattern}$ ]]; then >&2 echo "PU must match pattern ~{sam_spec_pattern}" exit_code=1 fi fi exit $exit_code