// ---------------------------------------------------------------------------- bool CVcfReader::xAssignVariantIns( 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]); 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->SetAction(CDelta_item::eAction_ins_before); pItem->SetSeq().SetLiteral(*pLiteral); CVariation_inst& instance = pVariant->SetData().SetInstance(); instance.SetType(CVariation_inst::eType_ins); instance.SetDelta().push_back(pItem); }} variants.push_back(pVariant); return true; }
// ---------------------------------------------------------------------------- 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]); 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(); //Let's try to smartly set the Type. if( data.m_Alt[index].size() == 1 && data.m_strRef.size() == 1) { instance.SetType(CVariation_inst::eType_snv); } else { instance.SetType(CVariation_inst::eType_delins); } instance.SetDelta().push_back(pItem); }} variants.push_back(pVariant); return true; }
// ---------------------------------------------------------------------------- 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; }
// ---------------------------------------------------------------------------- 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; }
// ---------------------------------------------------------------------------- bool CVcfReader::xAssignVariationAlleles( const CVcfData& data, unsigned int index, CRef<CSeq_feat> pFeature ) // ---------------------------------------------------------------------------- { if (data.IsSnv(index)) { return xAssignVariantSnv(data, index, pFeature); } if (data.IsDel(index)) { return xAssignVariantDel(data, index, pFeature); } if (data.IsIns(index)) { return xAssignVariantIns(data, index, pFeature); } if (data.IsDelins(index)) { return xAssignVariantDelins(data, index, pFeature); } CVariation_ref::TData::TSet::TVariations& variants = pFeature->SetData().SetVariation().SetData().SetSet().SetVariations(); CRef<CVariation_ref> pVariant(new CVariation_ref); string note("Warning: Could not place variation for record \"" + NStr::Replace(data.m_strLine.substr(0, 40), "\t", " ")); if (data.m_strLine.size() > 40) { note += "..."; } note += "\". Offending values: ref=\"" + data.m_strRef + "\", alt=\"" + data.m_Alt[index] + "\""; pVariant->SetData().SetNote(note); variants.push_back(pVariant); return true; }
// ---------------------------------------------------------------------------- bool CVcfReader::xAssignVariantMnv( 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->SetMNP(variant, CVariation_ref::eSeqType_na); }} variants.push_back(pVariant); return true; }
// ---------------------------------------------------------------------------- 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); return true; }