Exemple #1
0
//  ============================================================================
bool CGtfRecord::x_FeatureToPartial(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetPartial()  &&  mapped_feature.GetPartial() ) {
        return true;
    }
    return false;
}
Exemple #2
0
//  ============================================================================
string CGtfRecord::x_CdsToProteinId(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetProduct() ) {
        return mapped_feature.GetProduct().GetId()->GetSeqIdString( true );
    }
    return "";
}
Exemple #3
0
//  ============================================================================
string CGtfRecord::x_FeatureToNote(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetComment() ) {
        return mapped_feature.GetComment();
    }
    return "";
}
Exemple #4
0
//  ============================================================================
bool CGtfRecord::x_CdsToRibosomalSlippage(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetExcept_text() ) {
        if ( mapped_feature.GetExcept_text() == "ribosomal slippage" ) {
            return true;
        }
    }
    return false;
}
Exemple #5
0
//  =============================================================================
string CGtfRecord::x_MrnaToTranscriptId(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetProduct() ) {
        return mapped_feature.GetProduct().GetId()->GetSeqIdString( true );
    }
    else { 
        return x_GenericTranscriptId( mapped_feature );
    }
}
CAnnotCompare::TCompareFlags
CAnnotCompare::CompareFeats(const CMappedFeat& feat1,
                            CScope& scope1,
                            const CMappedFeat& feat2,
                            CScope& scope2,
                            vector<ECompareFlags>* complex_flags,
                            list<string>* comments)
{
    return CompareFeats(feat1.GetOriginalFeature(),
                        feat1.GetLocation(), scope1,
                        feat2.GetOriginalFeature(),
                        feat2.GetLocation(), scope2,
                        complex_flags, comments);
}
Exemple #7
0
//  ----------------------------------------------------------------------------
bool CGtfRecord::x_AssignAttributesFromAsnCore(
    CMappedFeat mapped_feature )
//  ----------------------------------------------------------------------------
{
    const CSeq_feat& feature = mapped_feature.GetOriginalFeature();

    if ( feature.CanGetQual() ) {
        const vector< CRef< CGb_qual > >& quals = feature.GetQual();
        vector< CRef< CGb_qual > >::const_iterator it = quals.begin();
        for ( /*NOOP*/; it != quals.end(); ++it ) {
            if ( (*it)->CanGetQual() && (*it)->CanGetVal() ) {
                if ( (*it)->GetQual() == "ID" ) {
                    continue;
                }
                if ( (*it)->GetQual() == "Parent" ) {
                    continue;
                }
                if ( (*it)->GetQual() == "gff_type" ) {
                    continue;
                }
                if ( (*it)->GetQual() == "transcript_id" ) {
                    continue;
                }
                if ( (*it)->GetQual() == "gene_id" ) {
                    continue;
                }
                SetAttribute((*it)->GetQual(), (*it)->GetVal());
            }
        }
    }

    return true;
}
Exemple #8
0
//  ============================================================================
string CGtfRecord::x_FeatureToDbxref(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( mapped_feature.IsSetDbxref() ) {
        const CSeq_feat::TDbxref& dbxrefs = mapped_feature.GetDbxref();
        if ( dbxrefs.size() > 0 ) {
            string value = s_GtfDbtag( *dbxrefs[ 0 ] );
            for ( size_t i=1; i < dbxrefs.size(); ++i ) {
                value += ";";
                value += s_GtfDbtag( *dbxrefs[ i ] );
            }
            return value;
        }
    }
    return "";
}
Exemple #9
0
//  ============================================================================
string CGtfRecord::x_MrnaToProduct(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    const CRNA_ref& rna = mapped_feature.GetData().GetRna();
    if ( rna.IsSetExt() && rna.GetExt().IsName() ) {
        return rna.GetExt().GetName();
    }
    return "";
}
Exemple #10
0
//  ============================================================================
string CGtfRecord::x_CdsToCode(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    const CCdregion& cdr = mapped_feature.GetData().GetCdregion();
    if ( cdr.IsSetCode() ) {
        return NStr::IntToString( cdr.GetCode().GetId() );
    }
    return "";
}
Exemple #11
0
//  ============================================================================
string CGtfRecord::x_CdsToProduct(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    if ( ! mapped_feature.IsSetXref() ) {
        return "";
    }
    const vector< CRef< CSeqFeatXref > > xref = mapped_feature.GetXref();
    vector< CRef< CSeqFeatXref > >::const_iterator it = xref.begin();
    for ( ; it != xref.end(); ++it ) {
        const CSeqFeatXref& ref = **it;
        if ( ref.IsSetData() && ref.GetData().IsProt() && 
            ref.GetData().GetProt().IsSetName() ) 
        {
            return ref.GetData().GetProt().GetName().front();
        }
    }
    return "";
}
Exemple #12
0
//  ============================================================================
string CGtfRecord::x_GenericTranscriptId(
    CMappedFeat mapped_feat )
//  ============================================================================
{
    static unsigned int uId = 1;
    string strTranscriptId = string( "unknown_transcript_" ) + 
        NStr::UIntToString( uId );
    if ( mapped_feat.GetData().GetSubtype() == CSeq_feat::TData::eSubtype_cdregion ) {
        uId++;
    }
    return strTranscriptId;
}
Exemple #13
0
//  ============================================================================
string CGtfRecord::x_GenericGeneId(
    CMappedFeat mapped_feat )
//  ============================================================================
{
    static unsigned int uId = 1;
    string strGeneId = string( "unknown_gene_" ) + 
        NStr::UIntToString( uId );
    if ( mapped_feat.GetData().GetSubtype() == CSeq_feat::TData::eSubtype_gene ) {
        uId++;
    }
    return strGeneId;
}
Exemple #14
0
//  ============================================================================
string CGtfRecord::x_GeneToGeneId(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    const CGene_ref& gene = mapped_feature.GetData().GetGene();
    if ( gene.IsSetLocus_tag() ) {
        return gene.GetLocus_tag();
    }
    if ( gene.IsSetSyn() ) {
        return gene.GetSyn().front();
    }
    return x_GenericGeneId( mapped_feature ); 
}                        
Exemple #15
0
//  ============================================================================
string CGtfRecord::x_GeneToGeneSyn(
    CMappedFeat mapped_feature )
//  ============================================================================
{
    const CGene_ref& gene = mapped_feature.GetData().GetGene();
    if ( ! gene.IsSetSyn() ) {
        return "";
    }
    if ( gene.IsSetLocus_tag() ) {
        return gene.GetSyn().front();
    }
    CGene_ref::TSyn::const_iterator it = gene.GetSyn().begin();
    ++it;
    if ( it != gene.GetSyn().end() ) {
        return *it;
    }
    return "";
}
Exemple #16
0
//  ----------------------------------------------------------------------------
bool CGtfRecord::x_AssignAttributesFromAsnExtended(
    CMappedFeat mapped_feature )
//  ----------------------------------------------------------------------------
{
    const CSeq_feat& feature = mapped_feature.GetOriginalFeature();

    string strDbxref = x_FeatureToDbxref( mapped_feature );
    if ( ! strDbxref.empty() ) {
        SetAttribute("db_xref", strDbxref);
    }

    string strNote = x_FeatureToNote( mapped_feature );
    if ( ! strNote.empty() ) {
        SetAttribute("note", strNote);
    }
    
    if ( x_FeatureToPseudo( mapped_feature ) ) {    
        SetAttribute("pseudo", "");
    }

    if ( x_FeatureToPartial( mapped_feature ) ) {    
        SetAttribute("partial", "");
    }

    switch ( feature.GetData().GetSubtype() ) {
    default:
        break;

    case CSeq_feat::TData::eSubtype_cdregion: {

            m_strGeneId = x_CdsToGeneId( mapped_feature );
            m_strTranscriptId = x_CdsToTranscriptId( mapped_feature );

            string strProteinId = x_CdsToProteinId( mapped_feature );
            if ( ! strProteinId.empty() ) {
                SetAttribute("protein_id", strProteinId);
            }

            if ( x_CdsToRibosomalSlippage( mapped_feature ) ) {
                SetAttribute("ribosomal_slippage", "");
            }

            string strProduct = x_CdsToProduct( mapped_feature );
            if ( ! strProduct.empty() ) {
                SetAttribute("product", strProduct); 
            }

            string strCode = x_CdsToCode( mapped_feature );
            if ( ! strCode.empty() ) {
                SetAttribute("transl_table", strCode);
            }
         }
        break;

    case CSeq_feat::TData::eSubtype_mRNA: {

            m_strGeneId = x_MrnaToGeneId( mapped_feature );
            m_strTranscriptId = x_MrnaToTranscriptId( mapped_feature );

            string strProduct = x_MrnaToProduct( mapped_feature );
            if ( ! strProduct.empty() ) {
                SetAttribute("product", strProduct); 
            }
         }
        break;

    case CSeq_feat::TData::eSubtype_gene: {

            m_strGeneId = x_GeneToGeneId( mapped_feature );

            string strGeneSyn = x_GeneToGeneSyn( mapped_feature );
            if ( ! strGeneSyn.empty() ) {
                SetAttribute("gene_synonym", strGeneSyn);
            }                             
        }
        break;
    }
    return true;
}