None available.
sub new
{ my $caller = shift;
my $class = ref($caller) || $caller;
my $self = $class->SUPER::new(@_);
$self->{'feature_types'} = {(
'VISTA Target' => {
name => 'VISTA Target',
class => 'Region',
description => 'VISTA target region',
},
'VISTA Enhancer' => {
name => 'VISTA Enhancer',
class => 'Enhancer',
description => 'Enhancer identified by positive VISTA assay',
},
'VISTA Target - Negative' => {
name => 'VISTA Target - Negative',
class => 'Region',
description => 'Enhancer negative region identified by VISTA assay',
},
)};
$self->{feature_sets} = {
'VISTA enhancer set' => {
feature_type =>\$ self->{'feature_types'}{'VISTA Target'},
display_label => 'VISTA Enhancers',
analysis =>
{
-logic_name => 'VISTA',
-description => 'VISTA Enhancer Assay (http://enhancer.lbl.gov/)',
-display_label => 'VISTA',
-displayable => 1,
},
},
};
$self->validate_and_store_feature_types;
$self->set_feature_sets;
return $self;
}
} |
sub parse_and_load
{ my ($self, $file, $old_assembly, $new_assembly) = @_;
my %result;
$self->log_header("Parsing and loading LBNL VISTA enhancer data from:\t$file");
my $extfeat_adaptor = $self->db->get_ExternalFeatureAdaptor;
my @features;
my %feature_objects;
my %anal;
my $dummy_analysis = new Bio::EnsEMBL::Analysis(-logic_name => 'EnhancerProjection');
my $feature_positive = $self->{'feature_types'}{'VISTA Enhancer'};
my $feature_negative = $self->{'feature_types'}{'VISTA Target - Negative'};
open (FILE, "<$file") || die "Can't open $file";
my $cnt = 0;
my $skipped = 0;
while (<FILE>) {
next if ($_ !~ /^>/o);
my %feature;
my ($coords, $element, $posneg, @stuff) = split /\s+\|\s+/o;
my ($chr, $start, $end) = $coords =~ /chr([^:]+):(\d+)-(\d+)/o;
my ($element_number) = $element =~ /\s*element\s*(\d+)/o;
my $chr_slice;
if ($old_assembly) {
$chr_slice = $self->slice_adaptor->fetch_by_region('chromosome', $chr, undef, undef, undef, $old_assembly);
} else {
$chr_slice = $self->slice_adaptor->fetch_by_region('chromosome', $chr);
}
if (!$chr_slice) {
warn "Can't get slice for chromosme $chr\n";
next;
}
my $seq_region_id = $chr_slice->get_seq_region_id;
throw("Can't get seq_region_id for chromosome $chr") if (!$seq_region_id);
my $strand = 1;
my $feature = Bio::EnsEMBL::Funcgen::ExternalFeature->new
(
-start => $start, -end => $end, -strand => $strand,
-feature_type => $posneg eq 'positive' ? $feature_positive : $feature_negative,
-slice => $self->slice_adaptor->fetch_by_region('chromosome', $chr, undef, undef, $strand, $old_assembly),
-display_label => "LBNL-$element_number",
-feature_set => $self->{'feature_sets'}{'VISTA enhancer set'},
);
if ($new_assembly) {
$feature = $self->project_feature($feature, $dummy_analysis, $new_assembly);
if(! defined $feature){
$skipped ++;
next;
}
}
$cnt ++;
$extfeat_adaptor->store($feature);
}
close FILE;
$self->log('Parsed '.($cnt+$skipped).' features');
$self->log("Loaded $cnt features");
$self->log("Skipped $skipped features");
return;
}
1; } |