ensembl-hive  2.7.0
LocalExonerateGappedBest1.pm
Go to the documentation of this file.
1 =head1 LICENSE
2 
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 
18 =cut
19 
20 package XrefMapper::Methods::LocalExonerateGappedBest1;
21 
22 use strict;
23 use File::Basename;
24 
26 
27 use vars '@ISA';
28 
30 
31 our $exonerate_path = 'exonerate'; # Make sure exonerate binary is in
32  # $PATH
33 
34 sub options {
35 
36  return ('--model', 'affine:local', '--subopt', 'no', '--bestn', '1');
37 
38 }
39 
40 sub query_identity_threshold {
41 
42  #return 90;
43  return 50;
44 }
45 
46 sub target_identity_threshold {
47 
48  #return 90;
49  return 50;
50 }
51 
52 sub submit_exonerate{
53  my ($self, $query, $target, $root_dir, @options) = @_;
54 
55  # Exonerate can run individual chunks of a large job.
56  # Determine the number of chunks that will be used, and add to total
57  my $num_jobs
59  $self->jobcount($self->jobcount()+$num_jobs);
60 
61  # Determine the output filename
62  my $queryfile = basename($query);
63  my $targetfile = basename($target);
64  my $query_alphabet = $queryfile =~ /peptide/ ? 'peptide' : 'dna';
65  my $outfile = join( '_',
66  $self->get_class_name() ,
67  $query_alphabet,
68  q[%s.map] # Substitute the chunk ID
69  );
70 
71  # Build a template representing the exonerate command
72  my $options_str = join(" ", @options);
73  my $exonerate_command = join
74  ( " \\\n ",
75  $exonerate_path,
76  qq[--target $target],
77  qq[--query $query],
78  qq[--querychunktotal $num_jobs],
79  q [--querychunkid %s], # Substitute the chunk ID
80  q [--showvulgar false],
81  q [--showalignment FALSE],
82  q [--ryo "%s"],
83  $options_str );
84  my $ryo_format = 'xref:%qi:%ti:%ei:%ql:%tl:%qab:%qae:%tab:%tae:%C:%s\n';
85  my $shell_command = qq[%s \\\n| grep '^xref' \\\n> %s/%s];
86 
87  # Run exonerate for each job chunk
88  foreach( my $i=1; $i<=$num_jobs; $i++ ){
89  my $command = sprintf( $shell_command,
90  sprintf($exonerate_command, $i, $ryo_format),
91  $root_dir,
92  sprintf($outfile, $i) );
93  my $status = system( $command );
94  unless( $status == 0 ){ warn( "Bad exit status ($?) from:\n $command" )}
95  }
96 }
97 
98 sub submit_depend_job{
99  die;
100 }
101 
102 1;
XrefMapper::Methods::ExonerateBasic
Definition: ExonerateBasic.pm:5
XrefMapper::Methods::ExonerateBasic::calculate_num_jobs
public The calculate_num_jobs()