1 |
commit: 9aa415db19bd5661d638f9e0dcc7d1a2e51cb7a7 |
2 |
Author: Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz> |
3 |
AuthorDate: Thu Mar 3 01:12:54 2011 +0000 |
4 |
Commit: Martin Mokrejs <mmokrejs <AT> fold <DOT> natur <DOT> cuni <DOT> cz> |
5 |
CommitDate: Thu Mar 3 01:12:54 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=9aa415db |
7 |
|
8 |
sci-biology/bambus: added goBambus.pl script and perl/python dependencies |
9 |
|
10 |
(Portage version: 2.1.9.28/git/Linux i686, unsigned Manifest commit) |
11 |
|
12 |
--- |
13 |
sci-biology/bambus/bambus-2.33.ebuild | 6 +- |
14 |
sci-biology/bambus/files/goBambus.pl | 244 +++++++++++++++++++++++++++++++++ |
15 |
2 files changed, 249 insertions(+), 1 deletions(-) |
16 |
|
17 |
diff --git a/sci-biology/bambus/bambus-2.33.ebuild b/sci-biology/bambus/bambus-2.33.ebuild |
18 |
index 2a46d9c..045c267 100644 |
19 |
--- a/sci-biology/bambus/bambus-2.33.ebuild |
20 |
+++ b/sci-biology/bambus/bambus-2.33.ebuild |
21 |
@@ -1,4 +1,4 @@ |
22 |
-# Copyright 1999-2010 Gentoo Foundation |
23 |
+# Copyright 1999-2011 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
# $Header: $ |
26 |
|
27 |
@@ -18,6 +18,8 @@ IUSE="" |
28 |
|
29 |
DEPEND="sci-biology/tigr-foundation-libs" |
30 |
RDEPEND="${DEPEND} |
31 |
+ dev-lang/perl |
32 |
+ dev-lang/python |
33 |
dev-perl/XML-Parser |
34 |
dev-perl/Config-IniFiles |
35 |
dev-perl/GraphViz" |
36 |
@@ -95,6 +97,8 @@ src_install() { |
37 |
mkdir -p "${D}"/usr/share/doc/"${P}" || die |
38 |
mv "${D}"/usr/doc/* "${D}"/usr/share/doc/"${P}" || die |
39 |
rmdir "${D}"/usr/doc || die |
40 |
+ |
41 |
+ dobin "${FILESDIR}"/goBambus.pl || die "Failed to install the alternative of goBambus.py written in perl" |
42 |
} |
43 |
|
44 |
pkg_postinst(){ |
45 |
|
46 |
diff --git a/sci-biology/bambus/files/goBambus.pl b/sci-biology/bambus/files/goBambus.pl |
47 |
new file mode 100644 |
48 |
index 0000000..61f9ed3 |
49 |
--- /dev/null |
50 |
+++ b/sci-biology/bambus/files/goBambus.pl |
51 |
@@ -0,0 +1,244 @@ |
52 |
+#!/usr/bin/perl -w |
53 |
+ |
54 |
+## Very simple perl script to drive the Bambus 2.0 pipeline (as I |
55 |
+## currently understand it). |
56 |
+## http://sourceforge.net/apps/mediawiki/amos/index.php?title=Bambus_2.0/goBambus-perl |
57 |
+## as of 201103021123 |
58 |
+ |
59 |
+use strict; |
60 |
+use Getopt::Long; |
61 |
+ |
62 |
+ |
63 |
+ |
64 |
+## Configure defaults |
65 |
+ |
66 |
+my $verbose = 1; |
67 |
+ |
68 |
+my $contig_file = ''; |
69 |
+my $fasta_file = ''; |
70 |
+my $mates_file = ''; |
71 |
+ |
72 |
+my $output_prefix = 'out'; |
73 |
+ |
74 |
+## The threshold used to accept or reject a link between contigs |
75 |
+my $link_redundancy = 1; |
76 |
+ |
77 |
+## Weather or not to run the (crappy) 'repeat filter' code |
78 |
+my $filter_repeats = 0; |
79 |
+ |
80 |
+## Not running dot saves time on 'big' runs |
81 |
+my $run_dot = 1; |
82 |
+ |
83 |
+ |
84 |
+ |
85 |
+## Process command line arguments |
86 |
+ |
87 |
+GetOptions |
88 |
+ ("contig_file=s" => \$contig_file, |
89 |
+ "fasta_file=s" => \$fasta_file, |
90 |
+ "mates_file=s" => \$mates_file, |
91 |
+ "output_prefix=s" => \$output_prefix, |
92 |
+ |
93 |
+ "link_redundancy|r=i" => \$link_redundancy, |
94 |
+ "repeat_filter|x" => \$filter_repeats, |
95 |
+ "dot|d!" => \$run_dot, |
96 |
+ "verbose+" => \$verbose, |
97 |
+ ) |
98 |
+ or die "failure to communicate\n"; |
99 |
+ |
100 |
+die "-c contig file plz!\n" unless -s $contig_file; |
101 |
+die "-f fasta file plz!\n" unless -s $fasta_file; |
102 |
+die "-m mates file plz!\n" unless -s $mates_file; |
103 |
+ |
104 |
+die "are you crazy?\n" |
105 |
+ if $output_prefix eq ''; |
106 |
+ |
107 |
+warn |
108 |
+ join("\n", |
109 |
+ "contig file : $contig_file", |
110 |
+ "fasta file : $fasta_file", |
111 |
+ "mates file : $mates_file", |
112 |
+ "output prefix : $output_prefix", |
113 |
+ "link redundancy : $link_redundancy", |
114 |
+ "repeat filter : $filter_repeats", |
115 |
+ "run dot? : $run_dot", |
116 |
+ "verbose : $verbose", |
117 |
+ ), "\n" |
118 |
+ if $verbose > 0; |
119 |
+#exit; |
120 |
+ |
121 |
+ |
122 |
+ |
123 |
+## Run the pipeline |
124 |
+ |
125 |
+## Get data into bank format |
126 |
+ |
127 |
+run(qq/ |
128 |
+ toAmos |
129 |
+ -s $fasta_file |
130 |
+ -c $contig_file |
131 |
+ -m $mates_file |
132 |
+ -o $output_prefix.afg |
133 |
+/); |
134 |
+ |
135 |
+## Debugging mates file |
136 |
+#exit; |
137 |
+ |
138 |
+run(qq/ |
139 |
+ bank-transact -cf |
140 |
+ -m $output_prefix.afg |
141 |
+ -b $output_prefix.bnk |
142 |
+/); |
143 |
+ |
144 |
+ |
145 |
+ |
146 |
+## Run the new Bambus pipeline |
147 |
+ |
148 |
+run(qq/ |
149 |
+ clk |
150 |
+ -b $output_prefix.bnk |
151 |
+/); |
152 |
+ |
153 |
+run(qq/ |
154 |
+ Bundler |
155 |
+ -b $output_prefix.bnk |
156 |
+/); |
157 |
+ |
158 |
+## Repeat filtering? |
159 |
+my $filter_repeats_option_string = ''; |
160 |
+if($filter_repeats){ |
161 |
+ run(qq/ |
162 |
+ MarkRepeats |
163 |
+ -noCoverageRepeats |
164 |
+ -b $output_prefix.bnk |
165 |
+ -redundancy $link_redundancy |
166 |
+ > $output_prefix.repeats |
167 |
+ /); |
168 |
+ |
169 |
+ $filter_repeats_option_string = |
170 |
+ "-repeats $output_prefix.repeats"; |
171 |
+} |
172 |
+ |
173 |
+run(qq/ |
174 |
+ OrientContigs |
175 |
+ -noreduce |
176 |
+ $filter_repeats_option_string |
177 |
+ -b $output_prefix.bnk |
178 |
+ -redundancy $link_redundancy |
179 |
+ -prefix $output_prefix |
180 |
+/); |
181 |
+ |
182 |
+ |
183 |
+ |
184 |
+## Generate some additional TEXT output |
185 |
+ |
186 |
+## ouput a fasta sequence for the contigs from the bank (passed to |
187 |
+## printScaff with -f) |
188 |
+ |
189 |
+#run(qq/ |
190 |
+# bank2fasta -iid |
191 |
+# -b $output_prefix.bnk |
192 |
+# > $output_prefix.contig.fasta |
193 |
+#/); |
194 |
+ |
195 |
+## Generates the useful .details, .oo, .sum and .stats files |
196 |
+# -f $output_prefix.contig.fasta |
197 |
+run(qq/ |
198 |
+ printScaff -detail -oo -sum |
199 |
+ -e $output_prefix.evidence.xml |
200 |
+ -s $output_prefix.out.xml |
201 |
+ -l $output_prefix.library |
202 |
+ -o $output_prefix |
203 |
+/); |
204 |
+ |
205 |
+run(qq/ |
206 |
+ mv -f |
207 |
+ printScaff.error |
208 |
+ $output_prefix.printScaff.error |
209 |
+/) |
210 |
+ if -s 'printScaff.error'; |
211 |
+ |
212 |
+ |
213 |
+ |
214 |
+ |
215 |
+ |
216 |
+## UNTANGLE |
217 |
+ |
218 |
+run(qq/ |
219 |
+ untangle |
220 |
+ -e $output_prefix.evidence.xml |
221 |
+ -s $output_prefix.out.xml |
222 |
+ -o $output_prefix.out.untangle.xml |
223 |
+/); |
224 |
+ |
225 |
+run(qq/ |
226 |
+ mv -f |
227 |
+ untangle.error |
228 |
+ $output_prefix.untangle.error |
229 |
+/) |
230 |
+ if -s 'untangle.error'; |
231 |
+ |
232 |
+ |
233 |
+ |
234 |
+## Generates the useful .details, .oo, .sum and .stats files |
235 |
+# -f $output_prefix.contig.fasta |
236 |
+run(qq/ |
237 |
+ printScaff -detail -oo -sum -dot |
238 |
+ -e $output_prefix.evidence.xml |
239 |
+ -s $output_prefix.out.untangle.xml |
240 |
+ -l $output_prefix.library |
241 |
+ -o $output_prefix.untangle |
242 |
+/); |
243 |
+ |
244 |
+run(qq/ |
245 |
+ mv -f |
246 |
+ printScaff.error |
247 |
+ $output_prefix.untangle.printScaff.error |
248 |
+/) |
249 |
+ if -s 'printScaff.error'; |
250 |
+ |
251 |
+ |
252 |
+ |
253 |
+ |
254 |
+ |
255 |
+## FINALLY, DOT |
256 |
+ |
257 |
+if($run_dot){ |
258 |
+ # output before untangle |
259 |
+ run(qq/ |
260 |
+ dot -Tps |
261 |
+ $output_prefix.dot |
262 |
+ > $output_prefix.ps |
263 |
+ /); |
264 |
+ |
265 |
+ # output after untangle |
266 |
+ run(qq/ |
267 |
+ dot -Tps |
268 |
+ $output_prefix.untangle.dot |
269 |
+ > $output_prefix.untangle.ps |
270 |
+ /); |
271 |
+} |
272 |
+ |
273 |
+warn "OK\n"; |
274 |
+ |
275 |
+ |
276 |
+ |
277 |
+ |
278 |
+ |
279 |
+## Yup |
280 |
+ |
281 |
+sub run{ |
282 |
+ my $cmd = shift; |
283 |
+ |
284 |
+ $cmd =~ s/\n/ /g; |
285 |
+ |
286 |
+ print "\n\n\nRUN: $cmd\n\n" |
287 |
+ if $verbose > 0; |
288 |
+ |
289 |
+ `$cmd`; |
290 |
+ |
291 |
+ die if $? != 0; |
292 |
+ |
293 |
+ return 1; |
294 |
+} |
295 |
+ |