File: proper_calls_to_tools.patch

package info (click to toggle)
parsnp 1.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,280 kB
  • ctags: 560
  • sloc: cpp: 3,859; python: 1,243; ansic: 937; makefile: 22; sh: 21
file content (121 lines) | stat: -rw-r--r-- 6,756 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Author: Andreas Tille <tille@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"%(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+"]"