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)):