my $seqstream = Bio::SeqIO->new ( -file => $queryfile,
-fmt => 'Fasta',
);
$seq = $seqstream->next_seq;
my $seg = Bio::EnsEMBL::Analysis::Runnable::ProteinAnnotation::Seg->new ( -QUERY => $seq);
$seg->workdir ($workdir);
$seg->run;
my @results = $seg->output;
sub get_low_complexity_length
{ my ($self) = @_;
if ($self->query->length > 0) {
my $lc_length = 0;
foreach my $feat (@{$self->output}) {
$lc_length += abs($feat->end - $feat->start) + 1;
}
my $low_complexity = ($lc_length)/($self->query->length);
$low_complexity *= 100;
return $low_complexity;
}
else {
return 0;
}
}
1; } |
sub parse_results
{ my ($self) = @_;
my ($fh);
my $resfile = $self->resultsfile;
if (-e $resfile) {
if (-z $resfile) {
return;
}else {
open($fh, "<$resfile") or throw ("Error opening $resfile");
}
} else {
$fh = $resfile;
}
my @pfs;
while (<$fh>) {
chomp;
next if /^$/;
if (/^\>/) {
/^\>(\S+)?\((\d+)\-(\d+)\)\s*complexity=(\S+)/;
my $tid = $1;
my $start = $2;
my $end = $3;
my $score = $4;
my $fp = $self->create_protein_feature($start, $end, $score, $tid,
0, 0, 'Seg',
$self->analysis, 0, 0);
push @pfs, $fp;
}
}
close($fh);
$self->output(\@pfs); } |
sub run_analysis
{ my ($self) = @_;
throw ("Error running ".$self->program." on ".$self->queryfile)
unless ((system ($self->program." ".$self->queryfile." -l > ".
$self->resultsfile)) == 0); } |