MCPcopy
hub / github.com/openai/plugins / validate_inputs

Function validate_inputs

plugins/ngs-analysis/scripts/run_dna_somatic_variants.py:113–258  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

111
112
113def validate_inputs(args: argparse.Namespace) -> tuple[dict[str, Any], list[dict[str, str]]]:
114 sample_sheet = args.sample_sheet.expanduser().resolve()
115 errors: list[str] = []
116 warnings: list[str] = []
117 pairs: list[dict[str, str]] = []
118 rows: list[dict[str, str]] = []
119 columns: list[str] = []
120 if not sample_sheet.exists():
121 errors.append(f"sample sheet does not exist: {sample_sheet}")
122 else:
123 try:
124 rows, columns = read_table(sample_sheet)
125 except Exception as exc: # pragma: no cover - defensive parser guard
126 errors.append(f"failed to parse sample sheet {sample_sheet}: {exc}")
127
128 reference = optional_existing_path(
129 str(args.reference_fasta),
130 sample_sheet.parent,
131 errors,
132 warnings,
133 "reference FASTA",
134 required=True,
135 )
136 if reference:
137 if not Path(str(reference) + ".fai").exists():
138 warnings.append(
139 f"reference FASTA index is missing and may be created by samtools faidx: {reference}.fai"
140 )
141 if not reference.with_suffix(".dict").exists():
142 warnings.append(
143 f"reference sequence dictionary is missing and may be created by GATK: {reference.with_suffix('.dict')}"
144 )
145 target_bed = optional_existing_path(
146 str(args.target_bed) if args.target_bed else None,
147 sample_sheet.parent,
148 errors,
149 warnings,
150 "target BED",
151 )
152 panel_of_normals = optional_existing_path(
153 str(args.panel_of_normals) if args.panel_of_normals else None,
154 sample_sheet.parent,
155 errors,
156 warnings,
157 "panel-of-normals VCF",
158 )
159 germline_resource = optional_existing_path(
160 str(args.germline_resource) if args.germline_resource else None,
161 sample_sheet.parent,
162 errors,
163 warnings,
164 "germline resource VCF",
165 )
166 annotation_vcf = optional_existing_path(
167 str(args.annotation_vcf) if args.annotation_vcf else None,
168 sample_sheet.parent,
169 errors,
170 warnings,

Callers 1

mainFunction · 0.70

Calls 4

read_tableFunction · 0.90
normalize_sample_nameFunction · 0.90
optional_existing_pathFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected