Skip to content
Snippets Groups Projects
Commit 74cfb2db authored by Dan Sheppard's avatar Dan Sheppard
Browse files

VEGA haplotype slices are non-reference now:

1. add predicate for haplotype slices;
2. workaround for issue with API where haplotype slices are non-reference
    but have no assembly exceptions;
3. fix map_assembly.pl so that it doesn't assume non-reference is a patch.

The other half of this commit is in ensembl-otter git.
parent 66e29249
No related branches found
No related tags found
No related merge requests found
......@@ -862,6 +862,7 @@ sub dynamic_use {
Arg[2] : (optional) String $version - coord_system version
Arg[3] : (optional) String $type - type of region eg chromsome (defaults to 'toplevel')
Arg[4] : (optional) Boolean - return non reference slies as well (required for haplotypes eq 6-COX)
Arg[5] : (optional) Override chromosome parameter filtering with this array reference. Empty denotes all.
Example : my $chr_length = $support->get_chrlength($dba);
Description : Get all chromosomes and their length from the database. Return
chr_name/length for the chromosomes the user requested (or all
......@@ -873,7 +874,7 @@ sub dynamic_use {
=cut
sub get_chrlength {
my ($self, $dba, $version,$type,$include_non_reference) = @_;
my ($self, $dba, $version,$type,$include_non_reference,$chroms) = @_;
$dba ||= $self->dba;
$type ||= 'toplevel';
throw("get_chrlength should be passed a Bio::EnsEMBL::DBSQL::DBAdaptor\n")
......@@ -883,9 +884,12 @@ sub get_chrlength {
my @chromosomes = map { $_->seq_region_name }
@{ $sa->fetch_all($type,$version,$include_non_reference) };
print "886: ".join(" ",@chromosomes);
my %chr = map { $_ => $sa->fetch_by_region($type, $_, undef, undef, undef, $version)->length } @chromosomes;
my @wanted = $self->param('chromosomes');
@wanted = @$chroms if defined $chroms and ref($chroms) eq 'ARRAY';
if (@wanted) {
# check if user supplied invalid chromosome names
foreach my $chr (@wanted) {
......@@ -1607,8 +1611,7 @@ sub get_wanted_chromosomes {
my $export_mode = $self->param('release_type');
my $release = $self->param('vega_release');
my $names;
my $chroms = $self->fetch_non_hidden_slices($aa,$sa,$cs,$cv);
CHROM:
my $chroms = $self->fetch_non_hidden_slices($aa,$sa,$cs,$cv); CHROM:
foreach my $chrom (@$chroms) {
my $attribs = $aa->fetch_all_by_Slice($chrom);
my $vals = $self->get_attrib_values($attribs,'vega_export_mod');
......@@ -1632,6 +1635,29 @@ sub get_wanted_chromosomes {
return $names;
}
=head2 is_haplotype
Arg[1] : B::E::Slice
Arg[2]: : B::E::DBAdaptor (optional, if you don't supply one then the *first* one you generated is returned, which may or may not be what you want!)
Description : Is the slice a Vega haplotype? At the moment this is
implemented by testing for presence of vega_ref_chrom but non_ref
which is correct in practice, but really misses the prupose of
vega_ref_chrom, so this might bite us if that changes.
Return type : boolean
=cut
sub is_haplotype {
my ($self,$slice,$dba) = @_;
$dba ||= $self->dba;
my $aa = $dba->get_adaptor('Attribute');
my $attribs = $aa->fetch_all_by_Slice($slice);
return (@{$self->get_attrib_values($attribs,'vega_ref_chrom')} and
@{$self->get_attrib_values($attribs,'non_ref',1)});
}
=head2 get_unique_genes
Arg[1] : B::E::Slice
......@@ -1655,7 +1681,7 @@ sub get_unique_genes {
my $ga = $dba->get_adaptor('Gene');
my $patch = 0;
my $genes = [];
if ( ! $slice->is_reference() ) {
if ( ! $slice->is_reference() and ! $self->is_haplotype($slice,$dba) ) {
# if ( 0 ) {
$patch = 1;
my $slices = $sa->fetch_by_region_unique( $slice->coord_system_name(),$slice->seq_region_name() );
......
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