sub new
{ my ($class,@args) = @_;
my $self = $class->SUPER::new(@args);
$self->program('genscan') if(!$self->program);
$self->matrix('HumanIso.smat') if(!$self->matrix);
return $self; } |
sub parse_results
{ my ($self, $results) = @_;
if(!$results){
$results = $self->resultsfile;
}
open(OUT, "<".$results) or throw("FAILED to open ".$results.
"Genscan:parse_results");
my $ff = $self->feature_factory;
LINE:while(<OUT>){
chomp;
if(m|NO EXONS/GENES PREDICTED IN SEQUENCE|i){ print "No genes predicted\n"; last LINE;
}
if(/init|intr|term|sngl/i){
my @elements = split;
if(@elements != 13){
throw("Can't parse ".$_." splits into wrong number of elements ".
"Genscan:parse_results");
}
my ($name, $strand, $start, $end, $pvalue, $score)
= @elements[0, 2, 3, 4, 11, 12];
if($strand eq '+'){
$strand = 1;
}else{
$strand = -1;
my $temp_start = $end;
$end = $start;
$start = $temp_start;
}
if($pvalue !~ /\d+/){
warning("Genscan has reported ".$pvalue." rather ".
"than a number setting p value to 0");
$pvalue = 0;
}
my ($group, $exon_name) = split(/\./, $name);
my $exon = $ff->create_prediction_exon($start, $end, $strand,
$score, $pvalue, 0,
$name, $self->query,
$self->analysis);
$self->exon_groups($group, $exon);
}elsif(/predicted peptide/i){
last LINE;
}else{
next LINE;
}
}
my $group;
my $hash = {};
PEP:while(<OUT>){
chomp;
if(/predicted peptide/i){
next;
}
if(/^>/){
my @values = split(/\|/, $_);
($group) = ($values[1] =~ /GENSCAN_predicted_peptide_(\d+)/);
}elsif(/(\S+)/ and defined $group) {
$hash->{$group} .= $1;
}
}
$self->peptides($hash);
close(OUT) or throw("FAILED to close ".$results.
"Genscan:parse_results");
$self->create_transcripts;
$self->calculate_phases;
}
1; } |