// ---------------------------------------------------------------------------- bool CGff3Reader::x_UpdateFeatureCds( const CGff2Record& gff, CRef<CSeq_feat> pFeature) // ---------------------------------------------------------------------------- { CRef<CSeq_feat> pAdd = CRef<CSeq_feat>(new CSeq_feat); if (!x_FeatureSetLocation(gff, pAdd)) { return false; } pFeature->SetLocation().Add(pAdd->GetLocation()); return true; }
// ---------------------------------------------------------------------------- bool CGtfReader::x_MergeFeatureLocationSingleInterval( const CGff2Record& record, CRef< CSeq_feat > pFeature ) // ---------------------------------------------------------------------------- { const CSeq_interval& gene_int = pFeature->GetLocation().GetInt(); if ( gene_int.GetFrom() > record.SeqStart() -1 ) { pFeature->SetLocation().SetInt().SetFrom( record.SeqStart() ); } if ( gene_int.GetTo() < record.SeqStop() - 1 ) { pFeature->SetLocation().SetInt().SetTo( record.SeqStop() ); } if (record.Type() == "CDS" && pFeature->GetData().IsCdregion()) { return x_FeatureTrimQualifiers(record, pFeature); } return true; }
// ---------------------------------------------------------------------------- bool CGtfReader::x_UpdateAnnotCds( const CGff2Record& gff, CRef< CSeq_annot > pAnnot ) // ---------------------------------------------------------------------------- { // // If there is no gene feature to go with this CDS then make one. Otherwise, // make sure the existing gene feature includes the location of the CDS. // CRef< CSeq_feat > pGene; if ( ! x_FindParentGene( gff, pGene ) ) { if ( ! x_CreateParentGene( gff, pAnnot ) ) { return false; } } else { if ( ! x_MergeParentGene( gff, pGene ) ) { return false; } } // // If there is no CDS feature with this gene_id|transcript_id then make one. // Otherwise, fix up the location of the existing one. // CRef< CSeq_feat > pCds; if ( ! x_FindParentCds( gff, pCds ) ) { // // Create a brand new CDS feature: // if ( ! x_CreateParentCds( gff, pAnnot ) ) { return false; } x_FindParentCds( gff, pCds ); } else { // // Update an already existing CDS features: // if ( ! x_MergeFeatureLocationMultiInterval( gff, pCds ) ) { return false; } if (!x_FeatureTrimQualifiers(gff, pCds)) { return false; } } if ( x_CdsIsPartial( gff ) ) { CRef<CSeq_feat> pParent; if ( x_FindParentMrna( gff, pParent ) ) { CSeq_loc& loc = pCds->SetLocation(); size_t uCdsStart = gff.SeqStart(); size_t uMrnaStart = pParent->GetLocation().GetStart( eExtreme_Positional ); if ( uCdsStart == uMrnaStart ) { loc.SetPartialStart( true, eExtreme_Positional ); // cerr << "fuzzed down: " << gff.SeqStart() << " " << gff.SeqStop() << " vs. " << uMrnaStart << endl; } size_t uCdsStop = gff.SeqStop(); size_t uMrnaStop = pParent->GetLocation().GetStop( eExtreme_Positional ); if ( uCdsStop == uMrnaStop && gff.Type() != "stop_codon" ) { loc.SetPartialStop( true, eExtreme_Positional ); // cerr << "fuzzed up : " << gff.SeqStart() << " " << gff.SeqStop() << " vs. " << uMrnaStop << endl; } } } return true; }