diff --git a/modules/t/assemblyException.t b/modules/t/assemblyException.t index 45279f990577d3091c7a08a457c62e4cefb7f06a..d45c4d5de576e43f740bf0d6b37fd0640fcf4aad 100644 --- a/modules/t/assemblyException.t +++ b/modules/t/assemblyException.t @@ -12,31 +12,27 @@ our $verbose = 0; my $multi = Bio::EnsEMBL::Test::MultiTestDB->new(); ok(1); -my $db = $multi->get_DBAdaptor('core'); +my $db = $multi->get_DBAdaptor('patch'); my $sfa = $db->get_SimpleFeatureAdaptor(); my $aexc_adaptor = $db->get_AssemblyExceptionFeatureAdaptor(); my $slice_adaptor = $db->get_SliceAdaptor(); -##chromosome Y is a fake 'PAR' linked to chromosome 20 -my $slice = $slice_adaptor->fetch_by_region('chromosome', 'Y',8e6,13e6); +my $slice = $slice_adaptor->fetch_by_region('chromosome', 'Y', 1, 400000); my $feats = $sfa->fetch_all_by_Slice($slice); -debug("Got " . scalar(@$feats)); -ok( @$feats ==58 ); +is( @$feats, 94, "Returned 58 features" ); print_features($feats); -#HAP_1 is a fake haplotype on chromosome 20 -$slice = $slice_adaptor->fetch_by_region('chromosome', '20_HAP1', - 30_399_998,30_600_002); -my $org_slice = $slice_adaptor->fetch_by_region('chromosome', '20', - 30_430_000,30_500_000 ); +$slice = $slice_adaptor->fetch_by_region('chromosome', 'Y', + 1, 200000); +my $org_slice = $slice_adaptor->fetch_by_region('chromosome', 'X', + 1, 200000); $feats = $sfa->fetch_all_by_Slice($slice); -debug("Got " . scalar(@$feats)); -is( @$feats, 9 , "Fetched 9 features"); +is( @$feats, 24 , "Fetched 24 features"); print_features($feats); @@ -56,13 +52,13 @@ for my $f ( @$feats ) { } -$slice = $slice_adaptor->fetch_by_region('chromosome', '20_HAP1', - 30_400_000,30_600_000); +$slice = $slice_adaptor->fetch_by_region('chromosome', 'Y', + 1, 200000); $feats = $sfa->fetch_all_by_Slice( $slice ); debug( "After storing retrieval" ); print_features($feats); -is(@$feats, 14, "Fetched 14 features"); +is(@$feats, 24, "Fetched 24 features"); @@ -70,28 +66,27 @@ is(@$feats, 14, "Fetched 14 features"); # sequence getting tests # -my $hap_slice = $slice_adaptor->fetch_by_region('chromosome', '20_HAP1', - 30_400_000,30_700_000 ); +my $hap_slice = $slice_adaptor->fetch_by_region('chromosome', 'Y', + 10001, 400000); -$org_slice = $slice_adaptor->fetch_by_region('chromosome', '20', - 30_400_000,30_800_000 ); +$org_slice = $slice_adaptor->fetch_by_region('chromosome', 'X', + 60001, 400000); my ( $fhs, $bhs, $fos, $bos ); debug( "Front hap seq: ".($fhs = $hap_slice->subseq( 99_991, 100_000 ))); -debug( "Back hap seq: ".($bhs = $hap_slice->subseq( 200_001, 200_010 ))); +debug( "Back hap seq: ".($bhs = $hap_slice->subseq( 400_001, 400_010 ))); debug( "Front org seq: ".( $fos = $org_slice->subseq( 99_991, 100_000 ))); -debug( "Back org seq: ".( $bos = $org_slice->subseq( 300_001, 300_010 ))); +debug( "Back org seq: ".( $bos = $org_slice->subseq( 400_001, 400_010 ))); -ok( $fhs eq $fos ); -ok( $bhs eq $bos ); +is( $fhs, $fos, "Front sequences for haplotype and reference are the same" ); +is( $bhs, $bos, "Back sequences for haplotype and reference are the same" ); -$slice = $slice_adaptor->fetch_by_region('chromosome', '20_HAP1', - 30_499_998,30_500_002); +$slice = $slice_adaptor->fetch_by_region('chromosome', 'Y', + 299_998, 300_002); -debug($slice->seq); -is( $slice->seq(), "GTNNN", "Fetched haplotype subslice"); +is( $slice->seq(), "ACAGA", "Fetched haplotype subslice"); $multi->restore(); diff --git a/modules/t/assemblyExceptionFeature.t b/modules/t/assemblyExceptionFeature.t index 24638dc9351a3d76150ca0c6bcf24d31b99549e0..497c38a39e5e41432c41465070e6c6aea485ddbe 100644 --- a/modules/t/assemblyExceptionFeature.t +++ b/modules/t/assemblyExceptionFeature.t @@ -13,7 +13,7 @@ my $multi = Bio::EnsEMBL::Test::MultiTestDB->new; # get a core DBAdaptor # -my $dba = $multi->get_DBAdaptor("core"); +my $dba = $multi->get_DBAdaptor("patch"); my $aefa = $dba->get_AssemblyExceptionFeatureAdaptor(); ok($aefa); @@ -42,10 +42,19 @@ is(ref($aef->adaptor), 'Bio::EnsEMBL::DBSQL::AssemblyExceptionFeatureAdaptor', " # fetch all my $chr_slice = $dba->get_SliceAdaptor->fetch_by_region('chromosome', - '20_HAP1'); + 'Y'); +my $ref_slice = $dba->get_SliceAdaptor->fetch_by_region('chromosome', '6'); +my $patch_slice = $dba->get_SliceAdaptor->fetch_by_region('supercontig', 'HG1304_PATCH'); + my @features = @{$aefa->fetch_all_by_Slice($chr_slice)}; -is(@features, 1, "Fetched one assembly exception feature for 20_HAP1"); +is(@features, 2, "Fetched one assembly exception feature for Y"); + +my @ref_features = @{$aefa->fetch_all_by_Slice($ref_slice)}; +is(@ref_features, 1, "Fetched one assembly exception features for chromosome 6"); + +my @patch_features = @{ $aefa->fetch_all_by_Slice($patch_slice) }; +is(@patch_features, 1, "Fetched one assembly exception for HG1304_PATCH"); foreach my $f (@features) { debug( "Feature: " . $f->slice->seq_region_name . " " . @@ -55,6 +64,22 @@ foreach my $f (@features) { $as->start . " " . $as->end); } +foreach my $f (@ref_features) { + debug( "Feature: " . $f->slice->seq_region_name . " " . + $f->start . " " . $f->end . " " . $f->type); + my $as = $f->alternate_slice(); + debug(" Alternate slice: " . $as->seq_region_name . " " . + $as->start . " " . $as->end); +} + +foreach my $f (@patch_features) { + debug( "Feature: " . $f->slice->seq_region_name . " " . + $f->start . " " . $f->end . " " . $f->type); + my $as = $f->alternate_slice(); + debug(" Alternate slice: " . $as->seq_region_name . " " . + $as->start . " " . $as->end); +} + my ($f) = @features; is($f->display_id, $f->alternate_slice->seq_region_name, "Feature display id matches feature's alternate slice name"); @@ -67,7 +92,7 @@ is($feat->dbID(), 1, "Feature dbID is 1"); my $aef_store = new Bio::EnsEMBL::AssemblyExceptionFeature(); my $aef_store2 = new Bio::EnsEMBL::AssemblyExceptionFeature(); #get ref slice -my $ref_slice = $dba->get_SliceAdaptor->fetch_by_region('chromosome',20); +my $ref_slice = $dba->get_SliceAdaptor->fetch_by_region('chromosome', 6); #prepare first object, the haplotype $aef_store->start(1500); $aef_store->end(35000);