From 0e55d097137fc0b8c5ad4f166d133ac0a3903bb2 Mon Sep 17 00:00:00 2001 From: Juan Esteban Arango Ossa Date: Thu, 23 May 2024 16:19:58 -0400 Subject: [PATCH] fix file handler issue when running as cli (#4) --- mergesvvcf/mergedfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mergesvvcf/mergedfile.py b/mergesvvcf/mergedfile.py index 30ee1d6..42e36aa 100644 --- a/mergesvvcf/mergedfile.py +++ b/mergesvvcf/mergedfile.py @@ -270,8 +270,9 @@ def passed_variant(record): "String", "Strand orientation of the adjacency in BEDPE format (DEL:+-, DUP:-+, INV:++/--)", ) - - outfile = open(outfile,'w') + # outfile should be a file handler. if it's a file name open it + if isinstance(outfile, str): + outfile = open(outfile,'w') print(outvcf.header, end="", file=outfile) for variant in sorted(calldict, key=operator.itemgetter(0)):