This file is indexed.

/usr/lib/perl5/TFBS/ConservationProfile.pm is in libtfbs-perl 0.5.svn.20100421-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
package TFBS::ConservationProfile;

use strict;

use Bio::Root::Root;

use vars qw'@ISA';
@ISA = qw'Bio::Root::Root';

sub new {
    my ($caller, %args) = @_;
    my $self = bless {parameters=>{},
                        alignment => undef,
                        ref_sequence => undef,
                        %args
                     } ,ref $caller || $caller;

    if (!defined($self->{conservation}) or ref($self->{conservation}) ne "ARRAY") {
        $self->throw("conservation: argument missing or wrong object type");
    }

    return $self;

}

sub param  {
    my ($self, $param, $value) = @_;
    if (!defined $param)  {
        return keys %{$self->{parameters}};
    }
    elsif (defined $value)  {
        $self->{parameters}->{$param} = $value;
    }
    return $self->{parameters}->{$param};

}

sub alignment {
    $_[0]->{alignment}
}

sub ref_sequence {
    $_[0]->{ref_sequence}
}

sub conserved_regions_as_gff {
    my ($self,  %args) = @_;
    my @features = $self->conserved_regions_as_features;
    my $output = "";
    foreach my $f (@features) {
        $output .= $f->gff_string."\n";
    }
    return $output;
}

sub conserved_regions_as_features {
    my ($self,  %args) = @_;
    my ($excl_feature_ref, $cutoff) =
        $self->_rearrange([qw(exclude_features cutoff)], %args);
    $cutoff = ($cutoff or $self->param("cutoff") or 0.7);

    print STDERR "CURRENT CUTOFF $cutoff\n";

    my @conservation = $self->conservation;
    my ($START, $END);
    if ($self->ref_sequence and $self->ref_sequence->isa("Bio::LocatableSeq"))  {
        $START = $self->ref_sequence->start;
        $END   = $self->ref_sequence->end;
    }
    else {
        $START = $self->alignment->get_seq_by_pos($self->param("ref_seq_nr" or 1))->start;
        $END   = $self->alignment->get_seq_by_pos($self->param("ref_seq_nr" or 1))->end;
    }
    if ($excl_feature_ref and ref($excl_feature_ref) eq "ARRAY") {
        foreach my $f (@$excl_feature_ref)  {
            my ($s, $e) = ($f->start, $f->end);
            next if ($e<$START or $s>$END);
            $s = $START if $s<$START;
            $e = $END   if $e>$END;
            map { $conservation[$_] = 0 }  ($s-$START..$e-$START);
        }
    }
    # obtain a list of positions with threshold
    my @cons_positions = ( (grep {$conservation[$_-$START]>=$cutoff} ($START..$#conservation+$START)), $END+1000);
                          # $END+1000 is a dummy position that simplifies the procedure

    my @features;
    my $region_start = $cons_positions[0];
    my $counter = 0;
    foreach my $i (0..$#cons_positions )  {
        if ($cons_positions[$i+1]-$cons_positions[$i]>10) { # 10 can be changed to max allowed gap in a conserved region
            $counter++;
            my $f = Bio::SeqFeature::Generic->new(-start=>$region_start,
                                                  -end  =>$cons_positions[$i],
                                                  -primary => "CR$counter",
                                                  -score => $cons_positions[$i]-$region_start+1
                                                 );

            push @features, $f;
            print STDERR $features[-1]->gff_string."\n";
            $region_start = $cons_positions[$i+1];
        }
    }
    return @features;
}

sub conserved_regions_as_feature_pairs  {


}

sub conservation {
    my ($self, $start, $end) = @_;

    if (!defined $start) {
        return @{$self->{conservation}}
    }
    else  {
        my ($START, $END);
        if ($self->alignment) {
            my $ref_seq_nr = ($self->param("ref_seq_nr") or 1);
            $START = $self->alignment->get_seq_by_pos($ref_seq_nr)->start;
            $END = $self->alignment->get_seq_by_pos($ref_seq_nr)->end;
        }
        else  {
            $START = 1;
        }
        if (defined $end)  {
            my ($pad_start, $pad_end) = (0, 0);
            if ($start < $START)  { $pad_start = $START-$start; $start = $START; }
            if ($end   > $END)    { $pad_end   = $end-$END;     $end = $END }
            return (_blank_array($pad_start),
                    @{$self->{conservation}}[$start-$START, $end-$START],
                    _blank_array($pad_end)
                   );
        }
        elsif ($start< $START) {
            return undef;
        }
        else {
            return $self->{conservation}->[$start-$START];
        }
    }
}


sub _blank_array {
    my ($length) = @_;
    my @arr = map {undef} (0..$length);
    pop @arr;
    return @arr
}




sub conserved_sequences {

}

sub conserved_subalignments  {

}

1;