G::Tools
GlimmerM
Globals (from use vars definitions) |
$AUTOLOAD |
@INC |
@EXPORT |
$VERSION |
@EXPORT_OK |
Annotates the genome sequence.
|
DESTROY | No description | Code |
annotate_with_glimmerM | No description | Code |
run_glimmerM | No description | Code |
Methods description
Methods code
sub DESTROY
{ my $self = shift;
undef %{$self};
}
sub annotate_with_glimmerM
{ my $file = shift;
my $out = shift;
my $this = new G::Skyline("blessed");
open (FASTA, $file);
while(<FASTA>){
if (/^\>/){
s/\>//;
my @hoge = split;
$this->{LOCUS}->{id} = $hoge[0];
next;
}else{
s/[^a-zA-Z]//g;
$this->{SEQ} .= lc($_);
}
}
close(FASTA);
$this->{"CDS0"}->{dummy} = 1;
$this->{"FEATURE0"}->{dummy} = 1;
my $count = 0;
my $first = 0;
open (GLIMMER, $out) || die();
while(<GLIMMER>){last if (/\#/);}
while(<GLIMMER>){
chomp;
s/^\s+//g;
if ($_ eq ''){
$count ++;
$first = 1;
}else{
my @line = split;
if ($first){
$first = 0;
$this->{"CDS$count"}->{feature} = $count;
$this->{"FEATURE$count"}->{cds} = $count;
$this->{"FEATURE$count"}->{type} = 'CDS';
$this->{"CDS$count"}->{on} = 1;
$this->{"FEATURE$count"}->{on} = 1;
$this->{"FEATURE$count"}->{direction} = 'direct';
$this->{"CDS$count"}->{direction} = 'direct';
$this->{"FEATURE$count"}->{gene} = sprintf "gene%05d", $count;
$this->{"CDS$count"}->{gene} = sprintf "gene%05d", $count;
if($line[2] eq '-'){
$this->{"FEATURE$count"}->{direction} = 'complement';
$this->{"CDS$count"}->{direction} = 'complement';
}
}
if ($line[3] eq 'Initial' || $line[3] eq 'Single'){
$this->{"CDS$count"}->{start} = $line[4];
$this->{"FEATURE$count"}->{start} = $line[4];
}
if ($line[3] eq 'Terminal' || $line[3] eq 'Single'){
$this->{"CDS$count"}->{end} = $line[5];
$this->{"FEATURE$count"}->{end} = $line[5];
}
$this->{"CDS$count"}->{join} .= sprintf "%d..%d,", $line[4], $line[5]
unless($line[3] eq 'Single');
$this->{"FEATURE$count"}->{join} .= sprintf "%d..%d,", $line[4], $line[5]
unless($line[3] eq 'Single');
}
}
close(GLIMMER);
return $this;
}
sub run_glimmerM
{ my $this = shift;
my $file = shift;
my $out = shift;
my $program = shift || 'bin/glimmer_linux';
my $train = shift || 'train/';
system("./$program $file orfs -d $train > $out");
}
General documentation