Skip to content
Snippets Groups Projects
Commit 91f1f289 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

From Paul Derwent for type_variation(): Make sure $attribute is defined

before using it.
parent b2797f60
No related branches found
No related tags found
No related merge requests found
......@@ -271,42 +271,51 @@ sub type_variation {
}
if (!$tr->translation()) {#for other biotype rather than coding/IG genes
# check if the variation is completely outside the transcript:
if ( !defined( $tr->translation() ) )
{ # for other biotype rather than coding/IG genes
# check if the variation is completely outside the transcript:
if($var->end < $tr->start()) {
$var->type( ($tr->strand() == 1) ? 'UPSTREAM' : 'DOWNSTREAM' );
if ( $var->end() < $tr->start() ) {
$var->type( ( $tr->strand() == 1 ) ? 'UPSTREAM' : 'DOWNSTREAM' );
return [$var];
}
if($var->start > $tr->end()) {
$var->type( ($tr->strand() == 1) ? 'DOWNSTREAM' : 'UPSTREAM' );
if ( $var->start() > $tr->end() ) {
$var->type( ( $tr->strand() == 1 ) ? 'DOWNSTREAM' : 'UPSTREAM' );
return [$var];
}
if ($var->start >= $tr->start() and $var->end <= $tr->end()) {#within the transcript
if ($tr->biotype() eq "miRNA") {
my ($attribute) = @{$tr->get_all_Attributes('miRNA')};
#the value is the mature miRNA coordinate within miRNA transcript
if ( $attribute->value =~ /(\d+)-(\d+)/ ) {
my @mapper_objs = $tr->cdna2genomic($1, $2, $tr->strand);#transfer cdna value to genomic coordinates
foreach my $obj ( @mapper_objs ){#Note you can get more than one mature seq per miRNA
if( $obj->isa("Bio::EnsEMBL::Mapper::Coordinate")){
if ($var->start >= $obj->start() and $var->end <= $obj->end()) {
$var->type("WITHIN_MATURE_miRNA");
return [$var];
}
}
}
}
if ( $var->start() >= $tr->start() and $var->end() <= $tr->end() )
{ # within the transcript
if ( $tr->biotype() eq "miRNA" ) {
my ($attribute) = @{ $tr->get_all_Attributes('miRNA') };
# the value is the mature miRNA coordinate within miRNA
# transcript
if ( defined($attribute)
&& $attribute->value() =~ /(\d+)-(\d+)/ )
{
# transfer cdna value to genomic coordinates
my @mapper_objs = $tr->cdna2genomic( $1, $2, $tr->strand() );
foreach my $obj (@mapper_objs)
{ #Note you can get more than one mature seq per miRNA
if ( $obj->isa("Bio::EnsEMBL::Mapper::Coordinate") ) {
if ( $var->start() >= $obj->start()
and $var->end() <= $obj->end() )
{
$var->type("WITHIN_MATURE_miRNA");
return [$var];
}
}
}
}
}
$var->type("WITHIN_NON_CODING_GENE");
return [$var];
}
}
} ## end if ( $var->start() >= ...)
} ## end if ( !defined( $tr->translation...))
# get a transcript mapper object
my $tm = $tr->get_TranscriptMapper();
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment