You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Accepts an unlimited number of length-2 lists or tuples and returns a rich.Table with the value of the first indices as the row names and the second indices as the values
107
107
Use None instead of a list to ignore that entry (useful for conditionals). The second value will always be converted to a string.
print_error(f"invalid format", "There are [bold]{len(invalids)}[/bold] rows in [blue]{infile}[/blue] without a space/tab delimiter or don't have two entries for sample[dim]<tab>[/dim]barcode. Terminating Harpy to avoid downstream errors.")
265
-
print_solution_with_culprits(
266
-
f"Make sure every entry in [blue]{infile}[/blue] uses space or tab delimeters and has both a sample name and barcode designation. You may comment out rows with a [green]#[/green] to have Harpy ignore them.",
code_letters=set() #codes can be Axx, Bxx, Cxx, Dxx
261
+
segment_ids=set()
262
+
withopen(infile, 'r') asfile:
263
+
forlineinfile:
264
+
try:
265
+
sample, segment_id=line.rstrip().split()
266
+
code_letters.add(segment_id[0])
267
+
ifsegment_idinsegment_ids:
268
+
print_error("An ID segment must only be associated with a single sample.")
269
+
print_solution_with_culprits(
270
+
"A barcode segment can only be associated with a single sample. For example, [green]C05[/green] cannot not be the segment that identifies both [blue]sample_01[/blue] and [blue]sample_2[/blue].",
271
+
"The segment triggering this error is:"
272
+
)
273
+
click.echo(segment_id)
274
+
sys.exit(1)
275
+
else:
276
+
segment_id.add(seg_id)
277
+
exceptValueError:
278
+
# skip rows without two columns
279
+
continue
280
+
ifnotcode_letters:
281
+
print_error("incorrect schema format", f"Schema file {os.path.basename(infile)} has no valid rows. Rows should be sample<tab>segment, e.g. sample_01<tab>C75")
282
+
sys.exit(1)
283
+
iflen(code_letters) >1:
284
+
print("invalid schema", f"Schema file {os.path.basename(file_path)} has sample IDs expected to be indentified across multiple barcode segments. All sample IDs for this technology should be in a single segment, such as [bold green]C[/bold green] or [bold green]D[/bold green].")
285
+
sys.exit(1)
271
286
272
287
defvalidate_regions(regioninput, genome):
273
288
"""validates the --regions input of harpy snp to infer whether it's an integer, region, or file"""
0 commit comments