Skip to content

Commit 4e6c8cd

Browse files
committed
Allow arbitrary run folder name
1 parent 249360c commit 4e6c8cd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

anglerfish/anglerfish.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def run_demux(args):
3434
if args.debug:
3535
log.setLevel(logging.DEBUG)
3636
run_uuid = str(uuid.uuid4())
37-
os.mkdir(args.out_fastq)
3837
ss = SampleSheet(args.samplesheet, args.ont_barcodes)
3938
version = pkg_resources.get_distribution("bio-anglerfish").version
4039
report = Report(args.run_name, run_uuid, version)
@@ -80,7 +79,12 @@ def run_demux(args):
8079
adaptors_sorted[(entry.adaptor.name, entry.ont_barcode)].append(
8180
(entry.sample_name, entry.adaptor, os.path.abspath(entry.fastq))
8281
)
83-
82+
if os.path.exists(args.out_fastq):
83+
raise FileExistsError(
84+
f"Output folder '{args.out_fastq}' already exists. Please remove it or specify another --run_name"
85+
)
86+
else:
87+
os.mkdir(args.out_fastq)
8488
out_fastqs = []
8589
for key, sample in adaptors_sorted.items():
8690
adaptor_name, ont_barcode = key

anglerfish/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ def run(
269269
)
270270
utcnow = dt.datetime.now(dt.timezone.utc)
271271
runname = utcnow.strftime(f"{args.run_name}_%Y_%m_%d_%H%M%S")
272+
if run_name != "anglerfish":
273+
runname = args.run_name
274+
272275
assert os.path.exists(args.out_fastq), f"Output folder '{args.out_fastq}' not found"
273276
assert os.path.exists(
274277
args.samplesheet

0 commit comments

Comments
 (0)