root/lib/polisher.pm

Revision 127, 1.6 kB (checked in by cholt, 10 months ago)

major maker update, gff passthrough, evaluator integration, tblastx, ncbi, error control

Line 
1 #------------------------------------------------------------------------
2 #----                            polisher                            ----
3 #------------------------------------------------------------------------
4 package polisher;
5 use strict;
6 use vars qw(@ISA @EXPORT $VERSION);
7 use Exporter;
8 use PostData;
9 use FileHandle;
10 use PostData;
11 use Exporter;
12 use Fasta;
13 use FastaFile;
14 use PhatHit_utils;
15 use Iterator::Fasta;
16 @ISA = qw(
17        );
18 #------------------------------------------------------------------------
19 #--------------------------- FUNCTIONS ----------------------------------
20 #------------------------------------------------------------------------
21 sub prep {
22         my $g_file = shift;
23         my $p_file = shift;
24
25         my $g_iterator = new Iterator::Fasta($g_file);
26         my $g_fasta = $g_iterator->nextEntry();
27         my $g_seq   = Fasta::getSeqRef($g_fasta);
28
29         my $p_iterator = new Iterator::Fasta($p_file);
30         my $p_fasta = $p_iterator->nextEntry();
31         my $p_seq   = Fasta::getSeqRef($p_fasta);
32
33         my $g_len = length($$g_seq);
34         my $p_len = length($$p_seq);
35
36
37         return ($p_len, $g_len);       
38 }
39 #------------------------------------------------------------------------
40 sub add_offset {
41         my $offset = shift;
42         my $f      = shift;
43
44        foreach my $hsp ($f->hsps){
45                 my $new_start = $offset + $hsp->start('query');
46                 my $new_end   = $offset + $hsp->end('query');
47        
48                 $hsp->query->location->start($new_start);
49                 $hsp->query->location->end($new_end);
50                 $hsp->{'_sequenceschanged'} = 1;
51       }
52       $f->{'_sequenceschanged'} = 1;
53
54 }
55 #------------------------------------------------------------------------
56 1;
57
58
Note: See TracBrowser for help on using the browser.