From 57a6dbba36f65cd4c463cb9bc95184269d4538fb Mon Sep 17 00:00:00 2001 From: Devon Ryan Date: Wed, 15 May 2019 10:39:39 +0200 Subject: [PATCH] Implement #832 (#835) * Implement #832 * update dti requirement --- deeptools/plotEnrichment.py | 11 ++++++++++- galaxy/wrapper/plotEnrichment.xml | 9 +++++++++ requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/deeptools/plotEnrichment.py b/deeptools/plotEnrichment.py index f902c9dce0..adda203a10 100644 --- a/deeptools/plotEnrichment.py +++ b/deeptools/plotEnrichment.py @@ -86,6 +86,11 @@ def plot_enrichment_args(): type=parserCommon.writableFile, metavar='FILE') + optional.add_argument('--attributeKey', + help='Instead of deriving labels from the feature column in a GTF file, ' + 'use the given attribute key, such as gene_biotype. For BED files or ' + 'entries without the attribute key, None is used as the label.') + optional.add_argument('--labels', '-l', metavar='sample1 sample2', help='User defined labels instead of default labels from ' @@ -495,10 +500,14 @@ def main(args=None): if len(args.labels) != len(args.bamfiles): sys.exit("Error: The number of labels ({0}) does not match the number of BAM files ({1})!".format(len(args.labels), len(args.bamfiles))) + # Ensure that if we're given an attributeKey that it's not empty + if args.attributeKey and args.attributeKey == "": + args.attributeKey = None + global gtf if not args.regionLabels and args.smartLabels: args.regionLabels = smartLabels(args.BED) - gtf = Enrichment(args.BED, keepExons=args.keepExons, labels=args.regionLabels) + gtf = Enrichment(args.BED, keepExons=args.keepExons, labels=args.regionLabels, attributeKey=args.attributeKey) # Get fragment size and chromosome dict fhs = [openBam(x) for x in args.bamfiles] diff --git a/galaxy/wrapper/plotEnrichment.xml b/galaxy/wrapper/plotEnrichment.xml index 83d903867f..e54f6daf17 100644 --- a/galaxy/wrapper/plotEnrichment.xml +++ b/galaxy/wrapper/plotEnrichment.xml @@ -29,6 +29,10 @@ #end if #if $advancedOpt.showAdvancedOpt == "yes" + #if $advancedOpt.attributeKey and str($advancedOpt.attributeKey).strip() != "": + --attributeKey '$advancedOpt.attributeKey' + #end if + #if $advancedOpt.labels and str($advancedOpt.labels).strip() != "": --labels $advancedOpt.labels #end if @@ -84,6 +88,11 @@ + + diff --git a/requirements.txt b/requirements.txt index ab3611b523..cb2b61788e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,4 @@ py2bit>=0.2.0 numpydoc>=0.5 pyBigWig>=0.2.1 plotly>=2.0.0 -deeptoolsintervals>=0.1.7 +deeptoolsintervals>=0.1.8 diff --git a/setup.py b/setup.py index ad6256d2ed..5adedc9e72 100755 --- a/setup.py +++ b/setup.py @@ -90,7 +90,7 @@ def openREADME(): "pyBigWig >= 0.2.1", "py2bit >= 0.2.0", "plotly >= 2.0.0", - "deeptoolsintervals >= 0.1.7" + "deeptoolsintervals >= 0.1.8" ], zip_safe=True, cmdclass={'sdist': sdist, 'install': install}