[med-svn] [parsnp] 05/05: Fix names of tools in Debian installations

Andreas Tille tille at debian.org
Wed Apr 20 11:04:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository parsnp.

commit db5429476f45a805df0c3601e6a42c8ddf844e27
Author: Andreas Tille <tille at debian.org>
Date:   Wed Apr 20 13:03:38 2016 +0200

    Fix names of tools in Debian installations
---
 debian/patches/proper_calls_to_tools.patch | 121 +++++++++++++++++++++++++++++
 debian/patches/series                      |   1 +
 2 files changed, 122 insertions(+)

diff --git a/debian/patches/proper_calls_to_tools.patch b/debian/patches/proper_calls_to_tools.patch
new file mode 100644
index 0000000..f776aa5
--- /dev/null
+++ b/debian/patches/proper_calls_to_tools.patch
@@ -0,0 +1,121 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Wed, 20 Apr 2016 10:31:32 +0200
+Description: Fix path to Debian installed tools
+ Parsnp uses an unusual way to call external tools.
+ At first these are linked to some place relative to the scrip
+ location which is definitely not allowed on /usr in a Debian
+ installation.  Later these symlinks are used for calling the tools.
+ .
+ This patch calls the according tools directly at their Debian
+ locations (and the Debian names).
+
+--- a/Parsnp.py
++++ b/Parsnp.py
+@@ -102,14 +102,14 @@ signal.signal(signal.SIGINT, handler)
+ def run_phipack(query,seqlen,workingdir):
+     currdir = os.getcwd()
+     os.chdir(workingdir)
+-    command = "%s/phiprofile -o -v -n %d -w 100 -m 100 -f %s > %s.out"%(PARSNP_DIR,seqlen,query,query)
++    command = "/usr/bin/phipack-profile -o -v -n %d -w 100 -m 100 -f %s > %s.out"%(seqlen,query,query)
+     run_command(command,1)
+     os.chdir(currdir)
+ 
+ def run_fasttree(query,workingdir,recombination_sites):
+     currdir = os.getcwd()
+     os.chdir(workingdir)
+-    command = "%s/ft -nt -quote -gamma -slow -boot 100 seq.fna > out.tree"%(PARSNP_DIR)
++    command = "fasttree -nt -quote -gamma -slow -boot 100 seq.fna > out.tree"
+     run_command(command,1)
+     os.chdir(currdir)
+ 
+@@ -207,20 +207,6 @@ sys.stderr.write( BOLDME+"|--Parsnp %s--
+ sys.stderr.write( BOLDME+"For detailed documentation please see --> http://harvest.readthedocs.org/en/latest\n"+ENDC)
+ 
+ 
+-if not os.path.lexists("%s/parsnp"%(PARSNP_DIR)):
+-    os.system("ln -s %s/bin/parsnp %s/parsnp"%(PARSNP_DIR, PARSNP_DIR))
+-if not os.path.lexists("%s/harvest"%(PARSNP_DIR)):
+-    os.system("ln -s %s/bin/harvest_%s %s/harvest"%(PARSNP_DIR,binary_type,PARSNP_DIR))
+-if not os.path.lexists("%s/ft"%(PARSNP_DIR)):
+-    os.system("ln -s %s/bin/fasttree_%s %s/ft"%(PARSNP_DIR,binary_type,PARSNP_DIR))
+-if not os.path.lexists("%s/phiprofile"%(PARSNP_DIR)):
+-    os.system("ln -s %s/bin/Profile_%s %s/phiprofile"%(PARSNP_DIR,binary_type,PARSNP_DIR))
+-
+-if not os.path.lexists("%s/nucmer"%(PARSNP_DIR)):
+-    os.system("ln -s %s/MUMmer/nucmer %s/nucmer"%(PARSNP_DIR,PARSNP_DIR))
+-if not os.path.lexists("%s/show-coords"%(PARSNP_DIR)):
+-    os.system("ln -s %s/MUMmer/show-coords %s/show-coords"%(PARSNP_DIR,PARSNP_DIR))
+-
+ #set MUMmer paths
+ if os.path.exists("%s/MUMmer/nucmer_run"%(PARSNP_DIR)):
+     ff = open("%s/MUMmer/nucmer_run"%(PARSNP_DIR))
+@@ -784,12 +770,12 @@ if __name__ == "__main__":
+     if use_parsnp_mumi and not curated:
+         sys.stderr.write( "-->Calculating MUMi..\n")
+         if not inifile_exists:
+-            command = "%s/parsnp %sall_mumi.ini"%(PARSNP_DIR,outputDir+os.sep)
++            command = "/usr/lib/parsnp/parsnp %sall_mumi.ini"%(PARSNP_DIR,outputDir+os.sep)
+         else:
+             if not os.path.exists(inifile):
+                 sys.stderr.write( "Error: ini file %s does not exist!\n"%(inifile))
+                 sys.exit(1)
+-            command = "%s/parsnp %s"%(PARSNP_DIR,inifile.replace(".ini","_mumi.ini"))
++            command = "/usr/lib/parsnp/parsnp %s"%(inifile.replace(".ini","_mumi.ini"))
+         run_command(command)
+         try:
+             mumif = open(outputDir+os.sep+"all.mumi",'r')
+@@ -962,14 +948,14 @@ if __name__ == "__main__":
+                 if command == "" and xtrafast and 0:
+                     command = "%s/parsnpA_fast %sparsnpAligner.ini"%(PARSNP_DIR,outputDir+os.sep)
+                 elif command == "":
+-                    command = "%s/parsnp %sparsnpAligner.ini"%(PARSNP_DIR,outputDir+os.sep)
++                    command = "/usr/lib/parsnp/parsnp %sparsnpAligner.ini"%(outputDir+os.sep)
+                 else:
+-                    command = "%s/parsnp %spsnn.ini"%(PARSNP_DIR,outputDir+os.sep)
++                    command = "/usr/lib/parsnp/parsnp %spsnn.ini"%(outputDir+os.sep)
+             else:
+                 if not os.path.exists(inifile):
+                     sys.stderr.write("Error: ini file %s does not exist!\n"%(inifile))
+                     sys.exit(1)
+-                command = "%s/parsnp %s"%(PARSNP_DIR,inifile)
++                command = "/usr/lib/parsnp/parsnp %s"%(inifile)
+             run_command(command)
+         
+ 
+@@ -1159,21 +1145,21 @@ if __name__ == "__main__":
+     if xtrafast or 1:
+         #add genbank here, if present
+         if len(genbank_ref) != 0:
+-            rnc = "%s/harvest -q -o %s/parsnp.ggr -x "%(PARSNP_DIR,outputDir)+outputDir+os.sep+"parsnp.xmfa"
++            rnc = "harvesttools -q -o %s/parsnp.ggr -x "%(outputDir)+outputDir+os.sep+"parsnp.xmfa"
+             for file in genbank_files:
+                 rnc += " -g %s " %(file)
+             run_command(rnc)
+         else:
+-            run_command("%s/harvest -q -o %s/parsnp.ggr -f %s -x "%(PARSNP_DIR,outputDir,ref)+outputDir+os.sep+"parsnp.xmfa")
++            run_command("harvesttools -q -o %s/parsnp.ggr -f %s -x "%(outputDir,ref)+outputDir+os.sep+"parsnp.xmfa")
+ 
+         if run_recomb_filter:
+-            run_command("%s/harvest -q -b %s/parsnp.rec,REC,\"PhiPack\" -o %s/parsnp.ggr -i %s/parsnp.ggr"%(PARSNP_DIR,outputDir,outputDir,outputDir))
++            run_command("harvesttools -q -b %s/parsnp.rec,REC,\"PhiPack\" -o %s/parsnp.ggr -i %s/parsnp.ggr"%(outputDir,outputDir,outputDir))
+         if run_repeat_filter:
+-            run_command("%s/harvest -q -b %s,REP,\"Intragenomic repeats > 100bp\" -o %s/parsnp.ggr -i %s/parsnp.ggr"%(PARSNP_DIR,repfile,outputDir,outputDir))
++            run_command("harvesttools -q -b %s,REP,\"Intragenomic repeats > 100bp\" -o %s/parsnp.ggr -i %s/parsnp.ggr"%(repfile,outputDir,outputDir))
+ 
+-        run_command("%s/harvest -q -i %s/parsnp.ggr -S "%(PARSNP_DIR,outputDir)+outputDir+os.sep+"parsnp.snps.mblocks")
++        run_command("harvesttools -q -i %s/parsnp.ggr -S "%(outputDir)+outputDir+os.sep+"parsnp.snps.mblocks")
+ 
+-    command = "%s/ft -nt -quote -gamma -slow -boot 100 "%(PARSNP_DIR)+outputDir+os.sep+"parsnp.snps.mblocks > "+outputDir+os.sep+"parsnp.tree"
++    command = "fasttree -nt -quote -gamma -slow -boot 100 "+outputDir+os.sep+"parsnp.snps.mblocks > "+outputDir+os.sep+"parsnp.tree"
+     print "-->Reconstructing core genome phylogeny.."
+     run_command(command)
+     #7)reroot to midpoint
+@@ -1204,7 +1190,7 @@ if __name__ == "__main__":
+         if xtrafast or 1:
+             #if newick available, add
+             #new flag to update branch lengths
+-            run_command("%s/harvest --midpoint-reroot -u -q -i "%(PARSNP_DIR)+outputDir+os.sep+"parsnp.ggr -o "+outputDir+os.sep+"parsnp.ggr -n %s"%(outputDir+os.sep+"parsnp.tree "))
++            run_command("harvesttools --midpoint-reroot -u -q -i "+outputDir+os.sep+"parsnp.ggr -o "+outputDir+os.sep+"parsnp.ggr -n %s"%(outputDir+os.sep+"parsnp.tree "))
+  
+     print "  |->["+OK_GREEN+"OK"+ENDC+"]"
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 3569290..6ac76e5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ fix_setup.py
 fix_install_path.patch
 avoid_rpath.patch
 add_missing_interpreter_line.patch
+proper_calls_to_tools.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/parsnp.git



More information about the debian-med-commit mailing list