G::IO
Annotation
Globals (from use vars definitions) |
$AUTOLOAD |
@INC |
@EXPORT |
$VERSION |
@EXPORT_OK |
use G::IO::Annotation; G::IO::Annotation::annotate_with_glimmer(); G::IO::Annotation::annotate_with_LORF();
|
Annotates the genome sequence. Only serves immature functions only. Intended for internal use only.
|
DESTROY | No description | Code |
annotate_with_LORF | No description | Code |
annotate_with_glimmer | No description | Code |
run_glimmer | No description | Code |
Methods description
Methods code
sub DESTROY
{ my $self = shift;
undef %{$self};
}
sub annotate_with_LORF
{ my $this = shift;
my $gb = shift;
my $seq = $gb->{SEQ};
my ($start,$end,$i);
my $count = 0;
$this->{"LOCUS"} = $gb->{"LOCUS"};
$this->{"HEADER"} = $gb->{"HEADER"};
$this->{"COMMENT"} = $gb->{"COMMENT"};
$this->{"CDS0"}->{dummy} = 1;
$this->{"FEATURE0"} = $gb->{"FEATURE0"};
$this->{"SEQ"} = $seq;
for ($i = 0; $i <= 1; $i ++){
$seq = complement($gb->{SEQ}) if ($i);
$start = 0;
$end = 0;
while(0 <= ($start = index($seq, 'atg', $start + 1))){
next if ($start < $end && ($start - $end + 1) % 3 == 0);
my $tmp = $start;
my $stopcodon = '';
while(0 <= ($tmp = index($seq, 'tag', $tmp +1))){
if (($tmp - $start + 1) % 3 == 0 && $tmp - $start > 49){
$count ++;
$end = $tmp;
$stopcodon = 'tag';
last;
}
}
$tmp = $start;
while(0 <= ($tmp = index($seq, 'taa', $tmp +1))){
if (($tmp - $start + 1) % 3 == 0 && $tmp - $start > 49){
if ($tmp < $end){
$count ++;
$end = $tmp;
$stopcodon = 'taa';
last;
}else{
last;
}
}
}
$tmp = $start;
while(0 <= ($tmp = index($seq, 'tga', $tmp +1))){
if (($tmp - $start + 1) % 3 == 0 && $tmp - $start > 49){
if ($tmp < $end){
$count ++;
$end = $tmp;
$stopcodon = 'tga';
last;
}else{
last;
}
}
}
if ($i){
if ($end > 0 && ($end - $start + 1) / 3 > opt::val("length")){
$this->{"CDS$count"}->{start} = length($gb->{SEQ}) - $end + 1;
$this->{"CDS$count"}->{end} = length($gb->{SEQ}) - $start + 1;
$this->{"CDS$count"}->{feature} = $count;
$this->{"CDS$count"}->{direction} = "complement";
$this->{"FEATURE$count"}->{type} = "CDS";
$this->{"FEATURE$count"}->{start} = length($gb->{SEQ}) - $end + 1;
$this->{"FEATURE$count"}->{end} = length($gb->{SEQ}) - $start + 1;
$this->{"FEATURE$count"}->{feature} = $count;
$this->{"FEATURE$count"}->{direction} = "complement";
}
}else{
if ($end > 0 && ($end - $start + 1) / 3 > opt::val("length")){
$this->{"CDS$count"}->{start} = $start + 1;
$this->{"CDS$count"}->{end} = $end + 1;
$this->{"CDS$count"}->{feature} = $count;
$this->{"CDS$count"}->{direction} = "direct";
$this->{"FEATURE$count"}->{type} = "CDS";
$this->{"FEATURE$count"}->{start} = $start + 1;
$this->{"FEATURE$count"}->{end} = $end + 1;
$this->{"FEATURE$count"}->{feature} = $count;
$this->{"FEATURE$count"}->{direction} = "direct";
}
}
}
sub annotate_with_glimmer
{ my $this = shift;
my $file = shift;
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;
open (GLIMMER, 'g2.coord') || die();
while(<GLIMMER>){
$count ++;
my @line = split;
$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;
if ($line[1] > $line[2]){
$this->{"CDS$count"}->{start} = $line[2];
$this->{"CDS$count"}->{end} = $line[1];
$this->{"CDS$count"}->{direction} = "complement";
$this->{"FEATURE$count"}->{start} = $line[2];
$this->{"FEATURE$count"}->{end} = $line[1];
$this->{"FEATURE$count"}->{direction} = "complement";
}else{
$this->{"CDS$count"}->{start} = $line[1];
$this->{"CDS$count"}->{end} = $line[2];
$this->{"CDS$count"}->{direction} = "direct";
$this->{"FEATURE$count"}->{start} = $line[1];
$this->{"FEATURE$count"}->{end} = $line[2];
$this->{"FEATURE$count"}->{direction} = "direct";
}
}
close(GLIMMER);
}
sub run_glimmer
{ my $this = shift;
my $file = shift;
system("./run-glimmer2 $file");
}
General documentation