コード例 #1
0
//  ----------------------------------------------------------------------------
bool
CVcfReader::xAssignVariantDel(
    const CVcfData& data,
    unsigned int index,
    CRef<CSeq_feat> pFeature )
//  ----------------------------------------------------------------------------
{
    CVariation_ref::TData::TSet::TVariations& variants =
        pFeature->SetData().SetVariation().SetData().SetSet().SetVariations();

    CRef<CVariation_ref> pVariant(new CVariation_ref);
    {{
        //pVariant->SetData().SetNote("DEL");
        pVariant->SetDeletion();
        CVariation_inst& instance =  pVariant->SetData().SetInstance();
        CRef<CDelta_item> pItem(new CDelta_item);
        pItem->SetAction(CDelta_item::eAction_del_at);
        pItem->SetSeq().SetThis();
        instance.SetDelta().push_back(pItem);
    }}
    variants.push_back(pVariant);

    CRef<CVariation_ref> pIdentity(new CVariation_ref);
    {{
        //pIdentity->SetData().SetNote("IDENTITY");
        vector<string> variant;
        variant.push_back(data.m_strRef);
        pIdentity->SetSNV(variant, CVariation_ref::eSeqType_na);
        CVariation_inst& instance =  pIdentity->SetData().SetInstance();
        instance.SetType(CVariation_inst::eType_identity);
        instance.SetObservation(CVariation_inst::eObservation_asserted);
    }}
    variants.push_back(pIdentity);
    return true;
}
コード例 #2
0
//  ----------------------------------------------------------------------------
bool
CVcfReader::xAssignVariantSnv(
    const CVcfData& data,
    unsigned int index,
    CRef<CSeq_feat> pFeature )
//  ----------------------------------------------------------------------------
{
    CVariation_ref::TData::TSet::TVariations& variants =
        pFeature->SetData().SetVariation().SetData().SetSet().SetVariations();

    CRef<CVariation_ref> pVariant(new CVariation_ref);
    {{
        vector<string> variant;
        variant.push_back(data.m_Alt[index]);
        pVariant->SetSNV(variant, CVariation_ref::eSeqType_na);
    }}
    variants.push_back(pVariant);

    CRef<CVariation_ref> pIdentity(new CVariation_ref);
    {{
        vector<string> variant;
        variant.push_back(data.m_strRef);
        pIdentity->SetSNV(variant, CVariation_ref::eSeqType_na);
        CVariation_inst& instance =  pIdentity->SetData().SetInstance();
        instance.SetType(CVariation_inst::eType_identity);
        instance.SetObservation(CVariation_inst::eObservation_asserted);
    }}
    variants.push_back(pIdentity);

    return true;
}
コード例 #3
0
//  ----------------------------------------------------------------------------
bool
CVcfReader::xAssignVariantDelins(
    const CVcfData& data,
    unsigned int index,
    CRef<CSeq_feat> pFeature )
//  ----------------------------------------------------------------------------
{
    CVariation_ref::TData::TSet::TVariations& variants =
        pFeature->SetData().SetVariation().SetData().SetSet().SetVariations();

    CRef<CVariation_ref> pVariant(new CVariation_ref);
    {{
        string insertion(data.m_Alt[index].substr(1));
        CRef<CSeq_literal> pLiteral(new CSeq_literal);
        pLiteral->SetSeq_data().SetIupacna().Set(insertion);
        pLiteral->SetLength(insertion.size());
        CRef<CDelta_item> pItem(new CDelta_item);
        pItem->SetSeq().SetLiteral(*pLiteral); 
        CVariation_inst& instance =  pVariant->SetData().SetInstance();
        instance.SetType(CVariation_inst::eType_mnp);
        instance.SetDelta().push_back(pItem);       
    }}
    variants.push_back(pVariant);

    CRef<CVariation_ref> pIdentity(new CVariation_ref);
    {{
        string insertion(data.m_strRef.substr(1));
        CRef<CSeq_literal> pLiteral(new CSeq_literal);
        pLiteral->SetSeq_data().SetIupacna().Set(insertion);
        pLiteral->SetLength(insertion.size());
        CRef<CDelta_item> pItem(new CDelta_item);
        pItem->SetSeq().SetLiteral(*pLiteral); 
        CVariation_inst& instance =  pIdentity->SetData().SetInstance();
        instance.SetType(CVariation_inst::eType_identity);
        instance.SetDelta().push_back(pItem);       
        instance.SetObservation(CVariation_inst::eObservation_asserted);
    }}
    variants.push_back(pIdentity);
    return true;
}
コード例 #4
0
ファイル: vcf_reader.cpp プロジェクト: swuecho/igblast
//  ----------------------------------------------------------------------------
bool
CVcfReader::xAssignVariationAlleleSet(
    const CVcfData& data,
    CRef<CSeq_feat> pFeature )
//  ----------------------------------------------------------------------------
{
    CVariation_ref::TData::TSet::TVariations& variants =
        pFeature->SetData().SetVariation().SetData().SetSet().SetVariations();

    //make one variation for the reference
    CRef<CVariation_ref> pIdentity(new CVariation_ref);
    vector<string> variant;
 
    switch(data.m_SetType) {
    case CVcfData::ST_ALL_INS:
        pIdentity->SetDeletion();
        break;
    default: 
        variant.push_back(data.m_strRef);
        pIdentity->SetSNV(variant, CVariation_ref::eSeqType_na);
        break;
    }
    CVariation_inst& instance = pIdentity->SetData().SetInstance();
    instance.SetType(CVariation_inst::eType_identity);
    instance.SetObservation(CVariation_inst::eObservation_reference);
    if (data.m_SetType != CVcfData::ST_ALL_INS) {
        variants.push_back(pIdentity);
    }

    //add additional variations, one for each alternative
    for (unsigned int i=0; i < data.m_Alt.size(); ++i) {
        switch(data.m_SetType) {
        default:
            if (!xAssignVariantDelins(data, i, pFeature)) {
                return false;
            }
            break;
        case CVcfData::ST_ALL_SNV:
            if (!xAssignVariantSnv(data, i, pFeature)) {
                return false;
            }
            break;
        case CVcfData::ST_ALL_MNV:
            if (!xAssignVariantMnv(data, i, pFeature)) {
                return false;
            }
            break;
        case CVcfData::ST_ALL_INS:
            if (!xAssignVariantIns(data, i, pFeature)) {
                return false;
            }
            break;
        case CVcfData::ST_ALL_DEL:
            if (!xAssignVariantDel(data, i, pFeature)) {
                return false;
            }
            break;
        }
    }
    return true;
}