sub ambiguity_code
{ my $alleles = shift;
my %duplicates; map {$duplicates{$_}++} split /[\|\/\\]/, $alleles;
$alleles = uc( join '', sort keys %duplicates );
my %ambig = qw(AC M ACG V ACGT N ACT H AG R AGT D AT W CG S CGT B CT Y
GT K C C A A T T G G - -); return $ambig{$alleles}; } |
sub sequence_with_ambiguity
{ my ($dbCore,$dbVar,$chr,$start,$end,$strand) = @_;
my $slice;
if (ref($dbCore) ne 'Bio::EnsEMBL::DBSQL::DBAdaptor'){
warning('You need to provide a Bio::EnsEMBL::DBSQL::DBAdaptor as a first argument');
return $slice;
}
if (ref($dbVar) ne 'Bio::EnsEMBL::Variation::DBSQL::DBAdaptor'){
warning('You need to provide a Bio::EnsEMBL::Variation::DBSQL::DBAdaptor object as second argument');
return $slice;
}
my $slice_adaptor = $dbCore->get_SliceAdaptor();
my $vf_adaptor = $dbVar->get_VariationFeatureAdaptor;
$slice = $slice_adaptor->fetch_by_region('chromosome',$chr,$start,$end,$strand); my $seq = $slice->seq;
foreach my $vf (@{$vf_adaptor->fetch_all_by_Slice($slice)}){
substr($seq,$vf->start-1,1,$vf->ambig_code);
}
$slice->{'seq'} = $seq;
return $slice;
}
1; } |
sub unambiguity_code
{ my $ambiguity_code = shift;
my %unambig = qw(M AC V ACG N ACGT H ACT R AG D AGT W AT S CG B CGT Y CT K
GT C CC A AA T TT G GG - --); return $unambig{$ambiguity_code}; } |
sub variation_class
{ my $alleles = shift;
return 'snp' if $alleles =~ /^[ACGT]([\|\\\/][ACGT])+$/i;
return 'cnv' if (($alleles eq 'cnv') || ($alleles eq 'CNV'));
my @alleles = split /[\|\/\\]/, $alleles;
if (@alleles == 1){
return 'het'
}
elsif(@alleles == 2){
if ((($alleles[0] =~ tr/ACTGN//)== length($alleles[0]) && ($alleles[1] =~ tr/-//) == 1) || (($alleles[0] =~ tr/-//) == 1 && ($alleles[1] =~ tr/ACTGN//) == length($alleles[1]))){
return 'in-del'
}
elsif (($alleles[0] =~ /LARGE/) || ($alleles[1] =~ /LARGE/)){
return 'named'
}
elsif (($alleles[0] =~ tr/ACTG//) > 1 || ($alleles[1] =~ tr/ACTG//) > 1){
return 'mnp'
}
else{
warning("not possible to determine class for @alleles");
return '';
}
}
elsif(@alleles > 2){
if ($alleles[0] =~ /\d+/){
return 'microsat'
}
elsif ((grep {/-/} @alleles) > 0){
return 'mixed'
}
else{
return '';
}
}
else{
warning("no alleles available ");
return '';
} } |