This script will parse tRNAscan-SE output. Just the tabular output of
the tRNA locations in the genome for now.
sub _initialize
{ my($self,@args) = @_;
$self->SUPER::_initialize(@args);
my ($genetag,$exontag,$srctag) = $self->SUPER::_rearrange([qw(GENETAG
SRCTAG
EXONTAG)],
@args);
$self->gene_tag(defined $genetag ? $genetag : $GeneTag);
$self->source_tag(defined $srctag ? $srctag : $SrcTag);
$self->exon_tag(defined $exontag ? $exontag : $ExonTag);
$self->{'_seen'} = {};} |
sub next_prediction
{ my ($self) = @_;
my ($genetag,$srctag,$exontag) = ( $self->gene_tag,
$self->source_tag,
$self->exon_tag);
while( defined($_ = $self->_readline) ) {
if( m/^(\S+)\s+ # sequence name (\d+)\s+ # tRNA # (\d+)\s+(\d+)\s+ # tRNA start,end (\w{3})\s+ # tRNA type ([CAGT]{3})\s+ # Codon (\d+)\s+(\d+)\s+ # Intron Begin End (\d+\.\d+)/ox ) {
my ($seqid,$tRNAnum,$start,$end,$type,
$codon,$intron_start,$intron_end,
$score) = ($1,$2,$3,$4,$5,$6,$7,$8,$9);
my $strand = 1;
if( $start > $end ) {
($start,$end,$strand) = ($end,$start,-1);
}
if( $self->{'_seen'}->{"$seqid.$type"}++ ) {
$type .= "-".$self->{'_seen'}->{"$seqid.$type"};
}
my $gene = Bio::SeqFeature::Generic->new
( -seq_id => $seqid,
-start => $start,
-end => $end,
-strand => $strand,
-score => $score,
-primary_tag => $genetag,
-source_tag => $srctag,
-tag => {
'ID' => "tRNA:$type",
'AminoAcid' => $type,
'Codon' => $codon,
});
if( $intron_start ) {
if( $intron_start > $intron_end ) {
($intron_start,$intron_end) = ($intron_end,$intron_start);
}
$gene->add_SeqFeature(Bio::SeqFeature::Generic->new
( -seq_id=> $seqid,
-start => $start,
-end => $intron_start-1,
-strand=> $strand,
-primary_tag => $exontag,
-source_tag => $srctag,
-tag => {
'Parent' => "tRNA:$type"
}));
$gene->add_SeqFeature(Bio::SeqFeature::Generic->new
( -seq_id=> $seqid,
-start => $intron_end+1,
-end => $end,
-strand=> $strand,
-primary_tag => $exontag,
-source_tag => $srctag,
-tag => {
'Parent' => "tRNA:$type"
}));
} else {
$gene->add_SeqFeature(Bio::SeqFeature::Generic->new
( -seq_id=> $seqid,
-start => $start,
-end => $end,
-strand=> $strand,
-primary_tag => $exontag,
-source_tag => $srctag,
-tag => {
'Parent' => "tRNA:$type"
}));
}
return $gene;
}
}} |
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _