diff --git a/misc-scripts/density_feature/percent_gc_calc.pl b/misc-scripts/density_feature/percent_gc_calc.pl index d2d968e29e3b0558bb0ac0e922d1fbb702226110..8b320de55cea38077bc4aad47844873a02161107 100644 --- a/misc-scripts/density_feature/percent_gc_calc.pl +++ b/misc-scripts/density_feature/percent_gc_calc.pl @@ -6,8 +6,21 @@ # big regions genomesize / 4000 for 4000 features on the genome -use strict; +use FindBin qw($Bin); +use File::Path; +use File::Basename qw( dirname ); +BEGIN { + $SERVERROOT = dirname( $Bin ); + $SERVERROOT =~ s#/ensembl/misc-scripts##; + $SERVERROOT; unshift @INC, "$SERVERROOT/conf"; + eval{ require SiteDefs }; + if ($@){ die "Can't use SiteDefs.pm - $@\n"; } + map{ unshift @INC, $_ } @SiteDefs::ENSEMBL_LIB_DIRS; +} ; + + +use strict; #use dbi; use Bio::EnsEMBL::DBSQL::DBAdaptor; use Bio::EnsEMBL::DBSQL::SliceAdaptor; diff --git a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm index 3a43f8519144f0f79893e2cc78d22219f0637e06..6d1615594125706b057fa4f8aad8faf539fefdbb 100644 --- a/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm +++ b/modules/Bio/EnsEMBL/Utils/TranscriptAlleles.pm @@ -94,31 +94,31 @@ sub get_all_ConsequenceType { ### The rest don't work anyway until we have a AlignStrainSlice ### MUST BE SORTED.... - #we have to consider het alleles - my $reverse_string; - my $allele_string; - if ($allele->allele_string =~ /[\|\\\/]/){ - my @alleles = split /[\|\\\/]/,$allele->allele_string; - if ($alleles[0] ne $allele->ref_allele_string){ - $allele_string = $alleles[0]; + #we have to consider het alleles + my $allele_string; + if ($allele->allele_string =~ /[\|\\\/]/){ + my @alleles = split /[\|\\\/]/,$allele->allele_string; + if ($alleles[0] ne $allele->ref_allele_string){ + $allele_string = $alleles[0]; } - else{ - $allele_string = $alleles[1]; - } - } else{ - $allele_string = $allele->allele_string; - } + $allele_string = $alleles[1]; + } + } + else{ + $allele_string = $allele->allele_string; + } my $opposite_strand = 0; #to indicate wether transcript and allele and in different strands + my $transcript_allele = $allele_string; if( $transcript->strand != $allele->strand ) { - $reverse_string = $allele_string; - $reverse_string =~tr/ACGT/TGCA/; + $transcript_allele =~tr/ACGT/TGCA/; $opposite_strand = 1; } - my $consequence_type = Bio::EnsEMBL::Variation::ConsequenceType->new($transcript->dbID(),'',$allele->start, $allele->end, $transcript->strand, [$allele_string]); + my $consequence_type = Bio::EnsEMBL::Variation::ConsequenceType->new($transcript->dbID(),'',$allele->start, $allele->end, $transcript->strand, [$transcript_allele]); #calculate the consequence type of the Allele if different from the reference Allele - if (($opposite_strand && $allele->ref_allele_string eq $allele_string) || (!$opposite_strand && $allele->ref_allele_string eq $reverse_string)){ #same allele as reference, there is no consequence, called SARA + #if (($opposite_strand && $allele->ref_allele_string eq $allele_string) || (!$opposite_strand && $allele->ref_allele_string eq $allele_string)){ #same allele as reference, there is no consequence, called SARA + if ($allele->ref_allele_string eq $allele_string) { #same allele as reference, there is no consequence, called SARA #same allele as reference, there is no consequence, called SARA #we have to calculate if there are more than 2 in the same codon empty_codon(\@out,\@same_codon);