From 8d61fa1ca69a91baee4cbc2261575a7a1d26fd3c Mon Sep 17 00:00:00 2001 From: Blaise Li <blaise.li__git@nsup.org> Date: Tue, 8 Sep 2020 12:44:08 +0200 Subject: [PATCH] Option to save bed file. --- create_metagene_profile.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/create_metagene_profile.py b/create_metagene_profile.py index 79c495b..3b185a4 100755 --- a/create_metagene_profile.py +++ b/create_metagene_profile.py @@ -72,6 +72,7 @@ import sys import warnings from copy import deepcopy from pathlib import Path +from shutil import copyfile from tempfile import NamedTemporaryFile from collections import defaultdict # from itertools import chain @@ -310,6 +311,10 @@ def main(): help="Path to a file containing one gene identifier per line.\n" "The metagene profile will only take into account those genes.\n" "This should not be used at the same time as option -c") + parser.add_argument( + "-k", "--keep_bed", + help="Path to a file where bed coordinates of the genes " + "listed whith option -g are to be saved.") parser.add_argument( "-c", "--bed_coordinates", help="Path to a file containing the coordinates of the features " @@ -380,6 +385,9 @@ def main(): args.bigwig_files, bed_filename, plot_filename=args.profile_plot, **extra_parameters) if args.gene_list: + if args.keep_bed: + copyfile(bed_filename, args.keep_bed) + print(f"bed coordinates saved in: {args.keep_bed}") os.unlink(bed_filename) return 0 -- GitLab