None available.
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my $self = $class->SUPER::new(@_);
$self->{'feature_types'} = {
'miRanda' => {
name => 'miRanda Target',
class => 'RNA',
description => 'miRanda microRNA target',
},
};
$self->{feature_sets} = {
'miRanda miRNA targets' =>
{
feature_type =>\$ self->{'feature_types'}{'miRanda'},
display_name => 'miRanda Targets',
analysis =>
{
-logic_name => 'miRanda',
-description => 'miRanda microRNA target prediction (http://microrna.sanger.ac.uk/targets)',
-display_label => 'miRanda Target',
-displayable => 1,
},
xrefs => 1,
},
};
$self->validate_and_store_feature_types;
$self->set_feature_sets;
return $self; } |
sub parse_and_load
{
my ($self, $file, $old_assembly, $new_assembly) = @_;
$self->log_header("Parsing miRanda data from:\t$file");
my $analysis_adaptor = $self->db->get_AnalysisAdaptor();
my $ftype_adaptor = $self->db->get_FeatureTypeAdaptor();
my $extf_adaptor = $self->db->get_ExternalFeatureAdaptor;
my $dbentry_adaptor = $self->db->get_DBEntryAdaptor;
my %features_by_name; my %slice_cache;
my $dummy_analysis = new Bio::EnsEMBL::Analysis(-logic_name => 'miRandaProjection');
my $skipped = 0;
my $cnt = 0;
my $skipped_xref = 0;
my $species = $self->db->species;
if(! $species){
throw('Must define a species to define the external_db');
}
($species = lc($species)) =~ s/ /_/;
open (FILE, "<$file") || die "Can't open $file";
while (<FILE>) {
next if ($_ =~ /^\s*\#/o || $_ =~ /^\s*$/o);
my ($group, $seq, $method, $feature, $chr, $start, $end, $strand, undef, undef, undef, $ens_id, $display_name) = split;
$strand = ($strand =~ /\+/o) ? 1 : -1;
my $id = $ens_id.':'.$seq;
if(! exists $slice_cache{$chr}){
if($old_assembly){
$slice_cache{$chr} = $self->slice_adaptor->fetch_by_region('chromosome',
$chr,
undef,
undef,
undef,
$old_assembly);
}else{
$slice_cache{$chr} = $self->slice_adaptor->fetch_by_region('chromosome', $chr);
}
if(! defined $slice_cache{$chr}){
warn "Can't get slice $chr for sequence $id\n";
$skipped++;
next;
}
}
if(! exists $features_by_name{$seq}){
$features_by_name{$seq} = $ftype_adaptor->fetch_by_name($seq);
if(! defined $features_by_name{$seq}){
($features_by_name{$seq}) = @{$ftype_adaptor->store(Bio::EnsEMBL::Funcgen::FeatureType->new
(
-name => $seq,
-class => 'RNA',
-description => $method.' '.$feature,
))};
}
}
$feature = Bio::EnsEMBL::Funcgen::ExternalFeature->new
(
-display_label => $id,
-start => $start,
-end => $end,
-strand => $strand,
-feature_type => $features_by_name{$seq},
-feature_set => $self->{'feature_sets'}{'miRanda miRNA'},
-slice => $slice_cache{$chr},
);
if ($new_assembly) {
$feature = $self->project_feature($feature, $new_assembly);
if(! defined $feature){
$skipped ++;
next;
}
}
($feature) = @{$extf_adaptor->store($feature)};
$cnt++;
if (! $ens_id) {
warn("No xref available for miRNA $id\n");
$skipped_xref++;
next;
}
if(! defined $display_name){
$display_name = $self->get_core_display_name_by_stable_id($self->db->dnadb, $ens_id, 'transcript');
}
my $dbentry = Bio::EnsEMBL::DBEntry->new(
-dbname => $species.'_core_Transcript',
-status => 'KNOWNXREF',
-db_display_name => 'EnsemblTranscript',
-type => 'MISC',
-primary_id => $ens_id,
-display_id => $display_name,
-info_type => 'MISC',
-info_text => 'TRANSCRIPT',
-linkage_annotation => 'miRanda target - negative influence',
);
$dbentry_adaptor->store($dbentry, $feature->dbID, 'ExternalFeature', 1); }
close FILE;
$self->log("Stored $cnt miRanda miRNA ExternalFeatures");
$self->log("Skipped $skipped miRanda miRNA imports");
$self->log("Skipped an additional $skipped_xref DBEntry imports");
return;
}
1; } |