From 5fa3f7ed3ab060857cd66da73f562115153186e7 Mon Sep 17 00:00:00 2001 From: hanna Date: Tue, 9 Jun 2009 02:25:17 +0000 Subject: [PATCH] Added absolute path bug fix for Mark. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@949 348d0f76-0448-11de-a6fe-93d51630548a --- python/RecalQual.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/python/RecalQual.py b/python/RecalQual.py index eb70d22ab..987c5d7b2 100755 --- a/python/RecalQual.py +++ b/python/RecalQual.py @@ -16,6 +16,15 @@ output_root = './' # If editing, please end this variable with a trailing slash. resources='resources/' +import getopt,glob,os,sys +import LogisticRegressionByReadGroup + +# if the provided resources path is relative, convert it to a path +# relative to the calling script rather than the cwd. +if not os.path.isabs(resources): + application_path = os.path.dirname(sys.argv[0]) + resources = os.path.abspath(application_path) + '/' + resources + # Where does the reference live? reference_base = resources + 'human_b36_both' reference = reference_base + '.fasta' @@ -30,9 +39,6 @@ gatk = resources + 'gatk/GenomeAnalysisTK.jar' logistic_regression_script = resources + 'logistic_regression.R' empirical_vs_reported_grapher = resources + 'plot_q_emp_stated_hst.R' -import getopt,glob,os,sys -import LogisticRegressionByReadGroup - def exit(msg,errorcode): print msg sys.exit(errorcode) @@ -122,6 +128,8 @@ do_recalibration = not (evaluate_requested and not recalibrate_requested) # Only evaluate if the user specifically requested evaluation. do_evaluation = evaluate_requested +print 'Looking for supplemental files in ' + resources + # check that the input bam file exists, and that the bam is indexed. bam = args[0] bam_index = bam + '.bai'