ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gffread/gff_utils.cpp
(Generate patch)
# Line 325 | Line 325
325    GMessage("\n");
326   }
327  
328 < void preserveCDS(GffObj* t, GffObj* tfrom) {
329 < //transfer CDS info to the container t if it doesn't have any
330 < if (t->CDstart>0 || tfrom->CDstart<=0) return;
331 < if (tfrom->CDstart>=t->start) t->CDstart=tfrom->CDstart;
328 > void preserveContainedCDS(GffObj* t, GffObj* tfrom) {
329 > //transfer CDS info to the container t if it's a larger protein
330 > if (tfrom->CDstart==0) return;
331 > if (t->CDstart) {
332 >   if (tfrom->CDstart<t->CDstart && tfrom->CDstart>=t->start)
333 >      t->CDstart=tfrom->CDstart;
334 >   if (tfrom->CDend>t->CDend && tfrom->CDend<=t->end)
335 >      t->CDend=tfrom->CDend;
336 >   }
337 >  else { //no CDS info on container, just copy it from the contained
338 >   if (tfrom->CDstart>=t->start) t->CDstart=tfrom->CDstart;
339                            else t->CDstart=t->start;
340 < if (tfrom->CDend<=t->end) t->CDend=tfrom->CDend;
340 >   if (tfrom->CDend<=t->end) t->CDend=tfrom->CDend;
341                        else t->CDend=t->end;
342 +   }
343 +  
344  
345   }
346  
# Line 396 | Line 405
405                        (container=redundantTranscripts(*t, *(loc.rnas[ti]), matchAllIntrons, fuzzSpan))!=NULL) {
406                       if (container==t) {
407                          odata->replaced_by=t;
408 <                        preserveCDS(t, loc.rnas[ti]);
408 >                        preserveContainedCDS(t, loc.rnas[ti]);
409                          }
410                       else {
411                          tdata->replaced_by=loc.rnas[ti];
412 <                        preserveCDS(loc.rnas[ti], t);
412 >                        preserveContainedCDS(loc.rnas[ti], t);
413                          }
414                       }
415                }//for each transcript in the exon-overlapping locus

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines