1109
1108
my ($self,@args) = @_;
1111
1110
my($seq, $resolver_method, $group_tag, $partonomy,
1112
$structure_type, $resolver_tag, $use_magic) =
1111
$structure_type, $resolver_tag, $use_magic, $noinfer) =
1113
1112
$self->_rearrange([qw(SEQ
1114
1113
RESOLVER_METHOD
1409
$need_to_infer_exons = 0 if $noinfer; #NML
1406
1411
if ($need_to_infer_exons) {
1407
1412
# remove exons and introns from group -
1408
1413
# we will infer exons later, and we
1526
1531
if ($self->verbose > 0) {
1527
1532
printf STDERR "** INFERRING mRNA from CDS\n";
1529
$self->infer_mRNA_from_CDS(-seq=>$seq);
1534
$self->infer_mRNA_from_CDS(-seq=>$seq, -noinfer=>$noinfer);
1532
1537
# INFERRING exons
2402
# SPECIAL CASE FOR /ribosomal_slippage
2403
# See: http://www.ncbi.nlm.nih.gov/collab/FT/
2404
if (!$inside && $sf->has_tag('ribosomal_slippage')) {
2405
if ($self->verbose > 0) {
2406
printf STDERR " Checking for ribosomal_slippage\n";
2408
my @transcript_splice_sites = @container_coords;
2409
my @cds_splice_sites = @coords;
2410
# find the the first splice site within the CDS
2411
while (scalar(@transcript_splice_sites) &&
2412
$transcript_splice_sites[0] < $cds_splice_sites[0]) {
2413
shift @transcript_splice_sites;
2416
if ($transcript_splice_sites[0] == $cds_splice_sites[0]) {
2419
$inside = 1; # innocent until proven guilty..
2420
while (@cds_splice_sites) {
2421
if (!@transcript_splice_sites) {
2422
$inside = 0; # guilty!
2425
if ($cds_splice_sites[0] == $transcript_splice_sites[0]) {
2426
shift @cds_splice_sites;
2427
shift @transcript_splice_sites;
2431
if ($cds_splice_sites[0] < $transcript_splice_sites[0]) {
2432
# potential slippage
2437
my $p1 = shift @cds_splice_sites;
2438
my $p2 = shift @cds_splice_sites;
2439
if ($self->verbose > 0) {
2440
printf STDERR " Found the ribosomal_slippage: $p1..$p2\n";
2442
push(@slips, ($p2-$p1)-1);
2445
# not a potential ribosomal slippage
2446
$inside = 0; # guilty!
2452
# TODO: this is currently completely arbitrary. How many ribosomal slippages do we allow?
2453
# perhaps we need some mini-statistical model here....?
2457
# TODO: this is currently completely arbitrary. What is the maximum size of a ribosomal slippage?
2458
# perhaps we need some mini-statistical model here....?
2459
if (grep {$_ > 2} @slips) {
2465
# not a ribosomal_slippage, sorry
2396
2468
if ($self->verbose > 0) {
2397
2469
printf STDERR " Checking containment:[$inside] (@container_coords) IN ($splice_uniq_str)\n";
2648
2722
-strand=>$cdsexonloc->strand);
2649
2723
$loc->add_sub_Location($subloc);
2651
# share the same location
2653
Bio::SeqFeature::Generic->new(-location=>$loc,
2654
-primary_tag=>'mRNA');
2656
## Provide seq_id to new feature:
2657
$mrna->seq_id($cds->seq_id) if $cds->seq_id;
2658
$mrna->source_tag($cds->source_tag) if $cds->source_tag;
2660
$self->_check_order_is_consistent($mrna->location->strand,$mrna->location->each_Location);
2662
# make the mRNA hold the CDS; no EXPAND option,
2663
# the CDS cannot be wider than the mRNA
2664
$mrna->add_SeqFeature($cds);
2666
# mRNA steals children of CDS
2667
foreach my $subsf ($cds->get_SeqFeatures) {
2668
$mrna->add_SeqFeature($subsf);
2670
$cds->remove_SeqFeatures;
2671
push(@mrnas, $mrna);
2729
# share the same location
2731
Bio::SeqFeature::Generic->new(-location=>$loc,
2732
-primary_tag=>'mRNA');
2734
## Provide seq_id to new feature:
2735
$mrna->seq_id($cds->seq_id) if $cds->seq_id;
2736
$mrna->source_tag($cds->source_tag) if $cds->source_tag;
2738
$self->_check_order_is_consistent($mrna->location->strand,$mrna->location->each_Location);
2740
# make the mRNA hold the CDS; no EXPAND option,
2741
# the CDS cannot be wider than the mRNA
2742
$mrna->add_SeqFeature($cds);
2744
# mRNA steals children of CDS
2745
foreach my $subsf ($cds->get_SeqFeatures) {
2746
$mrna->add_SeqFeature($subsf);
2748
$cds->remove_SeqFeatures;
2749
push(@mrnas, $mrna);
2673
# change gene/CDS to gene/mRNA
2752
# change gene/CDS to gene/mRNA
2674
2753
$sf->remove_SeqFeatures;
2675
2754
$sf->add_SeqFeature($_) foreach (@mrnas, @children);
2760
2839
my $rangeP = $ranges[$i-1];
2761
2840
my $range = $ranges[$i];
2762
2841
if ($rangeP->start > $range->end) {
2763
# failed - but still get one more chance..
2765
$self->problem(2,"Ranges not in correct order. Strange ensembl genbank entry? Range: $rangestr");
2842
if ($self->seq->is_circular) {
2843
# see for example NC_006578.gbk
2844
# we make exceptions for circular genomes here.
2845
# see Re: [Gmod-ajax] flatfile-to-json.pl error with GFF
2849
# failed - but still get one more chance..
2851
$self->problem(2,"Ranges not in correct order. Strange ensembl genbank entry? Range: $rangestr");