Skip to content
Snippets Groups Projects
Commit c6dd98be authored by Magali Ruffier's avatar Magali Ruffier
Browse files

Merge branch 'master' of https://github.com/Ensembl/ensembl

parents a7aab0be 1c1d66f6
No related branches found
No related tags found
No related merge requests found
......@@ -361,10 +361,10 @@ sub checksum {
my @files = sort { $a cmp $b } readdir($dh);
closedir($dh) or die "Cannot close directory $dir";
my $checksum = $self->file('CHECKSUMS.gz');
my $checksum = $self->file('CHECKSUMS');
unlink $checksum if -f $checksum;
my $fh = IO::Compress::Gzip->new($checksum) or croak "Cannot create gzip stream to $checksum: $GzipError";
open my $fh, '>', $checksum or croak "Cannot open filehandle to $checksum: $!";
foreach my $file (@files) {
next if $file =~ /^\./; #hidden file or up/current dir
next if $file =~ /^CHECKSUM/;
......
......@@ -564,24 +564,13 @@ sub fetch_all_by_Slice_and_external_dbname_link {
foreach my $local_external_db_id (@{$external_db_ids}) {
my @linked_genes = $dbentry_adaptor->list_gene_ids_by_external_db_id($local_external_db_id);
foreach my $gene_id (@linked_genes) {
$linked_genes{$gene_id} = 1;
}
}
# Get all the genes on the slice.
my $genes = $self->SUPER::fetch_all_by_Slice_constraint($slice, 'g.is_current = 1', $logic_name);
# Create a list of those that are in the gene_ids list.
my @genes_passed;
foreach my $gene (@$genes) {
if (exists($linked_genes{$gene->dbID()})) {
push(@genes_passed, $gene);
}
$linked_genes{$_} = 1 for @linked_genes;
}
# Return the list of those that passed.
return \@genes_passed;
# Get all the genes on the slice and filter by the gene ids list
my $genes = $self->fetch_all_by_Slice($slice, $logic_name, $load_transcripts);
my $genes_passed = [ grep { exists $linked_genes{$_->dbID()} } @{$genes} ];
return $genes_passed;
} ## end sub fetch_all_by_Slice_and_external_dbname_link
=head2 fetch_all_by_Slice
......
......@@ -1100,7 +1100,7 @@ sub seq_region_start {
if ( defined($slice) ) {
return $self->_seq_region_boundary_from_db('start')
if $slice->is_circular() and $self->adaptor->dbc;
if $slice->is_circular() and $self->adaptor() and $self->adaptor->dbc();
my $start;
if ( $slice->strand() == 1 ) {
......@@ -1142,7 +1142,7 @@ sub seq_region_end {
if ( defined($slice) ) {
return $self->_seq_region_boundary_from_db('end')
if $slice->is_circular() and $self->adaptor->dbc;
if $slice->is_circular() and $self->adaptor() and $self->adaptor->dbc();
my $end;
if ( $slice->strand() == 1 ) {
......
......@@ -946,4 +946,14 @@ SKIP: {
dies_ok { $gene->get_all_homologous_Genes(); } 'No Compara DBAdaptor has been configured. No way to retrieve data';
}
# Fetching by slice and an external DB
{
$ga->clear_cache(); # have to clear the cache because otherwise it gets the wrong values back!
my $local_slice = $sa->fetch_by_region("chromosome", "20", 30_249_935, 31_254_640);
my $genes = $ga->fetch_all_by_Slice_and_external_dbname_link($local_slice, undef, undef, 'HUGO'); # yes HUGO. Not HGNC. Old data
is(scalar(@{$genes}), 13, 'Expect 13 genes with HUGO/HGNC links');
# assume this will be the display xref
is($_->display_xref()->dbname(), 'HUGO', $_->stable_id().' has a display HUGO') for @{$genes};
}
done_testing();
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