当前位置: 首页>>代码示例>>C++>>正文


C++ CConstRef类代码示例

本文整理汇总了C++中CConstRef的典型用法代码示例。如果您正苦于以下问题:C++ CConstRef类的具体用法?C++ CConstRef怎么用?C++ CConstRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CConstRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: x_ValidateMoleculeType

    /// Performs sanity checks to make sure that the sequence requested is of
    /// the expected type. If the tests fail, an exception is thrown.
    /// @param id Sequence id for this sequence [in]
    void x_ValidateMoleculeType(CConstRef<CSeq_id> id) 
    {
        _ASSERT(m_BioseqMaker.NotEmpty());

        if (id.Empty())
        {
            NCBI_THROW(CInputException, eInvalidInput,
                       "Empty SeqID passed to the molecule type validation");
        }

        bool isProtein = m_BioseqMaker->IsProtein(id);
        if (!isProtein && m_ReadProteins)
        {
            NCBI_THROW(CInputException, eSequenceMismatch,
               "GI/accession/sequence mismatch: protein input required but nucleotide provided");
        }
        if (isProtein && !m_ReadProteins)
        {
            NCBI_THROW(CInputException, eSequenceMismatch,
               "GI/accession/sequence mismatch: nucleotide input required but protein provided");
        }

        if (!isProtein)  // Never seen a virtual protein sequence.
        {
             if (m_BioseqMaker->HasSequence(id) == false)
             {
                  string message = "No sequence available for " + id->AsFastaString();
                  NCBI_THROW(CInputException, eInvalidInput, message);
             }
        }
    }
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:34,代码来源:blast_fasta_input.cpp

示例2: bestLength

//	----------------------------------------------------------------------------
CConstRef<CSeq_feat> CFeatTableEdit::xGetMrnaParent(
    const CSeq_feat& feat)
//	----------------------------------------------------------------------------
{
    CConstRef<CSeq_feat> pMrna;
    CSeq_feat_Handle sfh = mpScope->GetSeq_featHandle(feat);
    CSeq_annot_Handle sah = sfh.GetAnnot();
    if (!sah) {
        return pMrna;
    }

    size_t bestLength(0);
    CFeat_CI findGene(sah, CSeqFeatData::eSubtype_mRNA);
    for ( ; findGene; ++findGene) {
        Int8 compare = sequence::TestForOverlap64(
                           findGene->GetLocation(), feat.GetLocation(),
                           sequence::eOverlap_Contained);
        if (compare == -1) {
            continue;
        }
        size_t currentLength = sequence::GetLength(findGene->GetLocation(), mpScope);
        if (!bestLength  ||  currentLength > bestLength) {
            pMrna.Reset(&(findGene->GetOriginalFeature()));
            bestLength = currentLength;
        }
    }
    return pMrna;
}
开发者ID:swuecho,项目名称:igblast,代码行数:29,代码来源:feattable_edit.cpp

示例3: GetScope

bool CBioseq_Handle::ContainsSegment(CSeq_id_Handle id,
                                     size_t resolve_depth,
                                     EFindSegment limit_flag) const
{
    CBioseq_Handle h = GetScope().GetBioseqHandle(id);
    CConstRef<CSynonymsSet> syns;
    if ( h ) {
        syns = h.GetSynonyms();
    }
    SSeqMapSelector sel;
    sel.SetFlags(CSeqMap::fFindRef);
    if ( limit_flag == eFindSegment_LimitTSE ) {
        sel.SetLimitTSE(GetTopLevelEntry());
    }
    sel.SetResolveCount(resolve_depth);
    CSeqMap_CI it = GetSeqMap().BeginResolved(&GetScope(), sel);
    for ( ; it; ++it) {
        if ( syns ) {
            if ( syns->ContainsSynonym(it.GetRefSeqid()) ) {
                return true;
            }
        }
        else {
            if (it.GetRefSeqid() == id) {
                return true;
            }
        }
    }
    return false;
}
开发者ID:swuecho,项目名称:igblast,代码行数:30,代码来源:bioseq_handle.cpp

示例4: x_ValidatePssmVsGi7450545

    void x_ValidatePssmVsGi7450545(CConstRef<CSeq_align> sa, int hsp_num) {
        BOOST_REQUIRE(sa->GetSegs().IsDenseg());

        const CDense_seg & denseg = sa->GetSegs().GetDenseg();

        if (hsp_num == 1)
        {
            // Validate the first HSP
            pair<TSeqRange, TSeqRange> first_hsp = 
                make_pair(TSeqRange(24, 29), TSeqRange(245, 250));
            TSeqRange hsp1_query = denseg.GetSeqRange(0);
            TSeqRange hsp1_subj = denseg.GetSeqRange(1);
            BOOST_REQUIRE_EQUAL(first_hsp.first.GetFrom(), hsp1_query.GetFrom());
            BOOST_REQUIRE_EQUAL(first_hsp.first.GetTo(), hsp1_query.GetTo());
            BOOST_REQUIRE_EQUAL(first_hsp.second.GetFrom(), hsp1_subj.GetFrom());
            BOOST_REQUIRE_EQUAL(first_hsp.second.GetTo(), hsp1_subj.GetTo());
        }
        else if (hsp_num == 2)
        {
            // Validate the second HSP
            const pair<TSeqRange, TSeqRange> second_hsp = 
                make_pair(TSeqRange(74, 86), TSeqRange(108, 120));
            TSeqRange hsp2_query = denseg.GetSeqRange(0);
            TSeqRange hsp2_subj = denseg.GetSeqRange(1);
            BOOST_REQUIRE_EQUAL(second_hsp.first.GetFrom(), hsp2_query.GetFrom());
            BOOST_REQUIRE_EQUAL(second_hsp.first.GetTo(), hsp2_query.GetTo());
            BOOST_REQUIRE_EQUAL(second_hsp.second.GetFrom(), hsp2_subj.GetFrom());
            BOOST_REQUIRE_EQUAL(second_hsp.second.GetTo(), hsp2_subj.GetTo());
        }

    }
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:31,代码来源:psibl2seq_unit_test.cpp

示例5: GetParent

CConstRef<CGC_Sequence> CGC_Sequence::GetTopLevelParent() const
{
    CConstRef<CGC_Sequence> top = GetParent();
    for ( ;  top  &&  top->GetParent();  top = top->GetParent()) {
    }
    return top;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: itGenes

//  ----------------------------------------------------------------------------
void CFeatTableEdit::GenerateLocusTags()
//  ----------------------------------------------------------------------------
{
    CRef<CGb_qual> pLocusTag;

    SAnnotSelector selGenes;
    selGenes.IncludeFeatSubtype(CSeqFeatData::eSubtype_gene);
    CFeat_CI itGenes(mHandle, selGenes);
    for ( ; itGenes; ++itGenes) {
        string locusTagVal = itGenes->GetNamedQual("locus_tag");
        if (!locusTagVal.empty()) {
            continue;
        }
        CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(
                                     (itGenes)->GetOriginalFeature()));
        feh.AddQualifier("locus_tag", xNextLocusTag());
    }
    SAnnotSelector selOther;
    selOther.ExcludeFeatSubtype(CSeqFeatData::eSubtype_gene);
    CFeat_CI itOther(mHandle, selOther);
    for ( ; itOther; ++itOther) {
        const CSeq_feat& feat = itOther->GetOriginalFeature();
        CSeq_feat_EditHandle feh(mpScope->GetObjectHandle(
                                     (itOther)->GetOriginalFeature()));
        feh.RemoveQualifier("locus_tag");
        CConstRef<CSeq_feat> pGeneParent = xGetGeneParent(feat);
        if (!pGeneParent) {
            continue;
        }
        string locusTag = pGeneParent->GetNamedQual("locus_tag");
        feh.AddQualifier("locus_tag", locusTag);
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:34,代码来源:feattable_edit.cpp

示例7: x_DoesBioseqMatchSequenceType

bool CLocation_constraint :: x_DoesBioseqMatchSequenceType(CConstRef <CBioseq> bioseq, const ESeqtype_constraint& seq_type) const
{
  if (seq_type == eSeqtype_constraint_any
        || (bioseq->IsNa() && seq_type == eSeqtype_constraint_nuc)
        || (bioseq->IsAa() && seq_type == eSeqtype_constraint_prot)) {
      return true;
  }
  else return false;
};
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:9,代码来源:Location_constraint.cpp

示例8: x_Push

void CSeqMap_CI::x_Push(const CConstRef<CSeqMap>& seqMap,
                        const CTSE_Handle& tse,
                        TSeqPos from, TSeqPos length,
                        bool minusStrand,
                        TSeqPos pos)
{
    TSegmentInfo push;
    push.m_SeqMap = seqMap;
    push.m_TSE = tse;
    push.m_LevelRangePos = from;
    push.m_LevelRangeEnd = from + length;
    if (push.m_LevelRangeEnd < push.m_LevelRangePos) {
        // Detect (from + length) overflow
        NCBI_THROW(CSeqMapException, eDataError,
                   "Sequence position overflow");
    }
    push.m_MinusStrand = minusStrand;
    TSeqPos findOffset = !minusStrand? pos: length - 1 - pos;
    push.m_Index = seqMap->x_FindSegment(from + findOffset, GetScope());
    if ( push.m_Index == size_t(-1) ) {
        if ( !m_Stack.empty() ) {
            return;
        }
        push.m_Index = !minusStrand?
            seqMap->x_GetLastEndSegmentIndex():
            seqMap->x_GetFirstEndSegmentIndex();
    }
    else {
        _ASSERT(push.m_Index > seqMap->x_GetFirstEndSegmentIndex() &&
                push.m_Index < seqMap->x_GetLastEndSegmentIndex());
        if ( pos >= length ) {
            if ( !minusStrand ) {
                if ( seqMap->x_GetSegmentPosition(push.m_Index, 0) <
                     push.m_LevelRangeEnd ) {
                    ++push.m_Index;
                    _ASSERT(seqMap->x_GetSegmentPosition(push.m_Index, 0) >=
                            push.m_LevelRangeEnd);
                }
            }
            else {
                if ( seqMap->x_GetSegmentEndPosition(push.m_Index, 0) >
                     push.m_LevelRangePos ) {
                    --push.m_Index;
                    _ASSERT(seqMap->x_GetSegmentEndPosition(push.m_Index, 0) <=
                            push.m_LevelRangePos);
                }
            }
        }
    }
    // update length of current segment
    seqMap->x_GetSegmentLength(push.m_Index, GetScope());
    m_Stack.push_back(push);
    // update position
    m_Selector.m_Position += x_GetTopOffset();
    // update length
    m_Selector.m_Length = push.x_CalcLength();
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例9: make_pair

pair<double, bool> CScoreUniqSeqCoverage::MakeScore(CBioseq_Handle const& query_handle, vector<CSeq_align const*>::const_iterator begin, vector<CSeq_align const*>::const_iterator end)
{
    CConstRef<CBioseq> bioseq = query_handle.GetCompleteBioseq();

    unsigned int qlen = 0;
    if ( !bioseq.Empty() && bioseq->IsSetLength()) {
        qlen = bioseq->GetLength();
    }

    if ( !qlen ) {
        return make_pair(0, false);
    }

    bool isDenDiag = ( (*begin)->GetSegs().Which() == CSeq_align::C_Segs::e_Dendiag) ?
                              true : false;

    CRangeCollection<TSeqPos> subj_rng_coll((*begin)->GetSeqRange(1));
    CRange<TSeqPos> q_rng((*begin)->GetSeqRange(0));
    
    CRangeCollection<TSeqPos> query_rng_coll(s_FixMinusStrandRange(q_rng));
    
    for( ++begin; begin != end; ++begin ) {
        const CRange<TSeqPos> align_subj_rng((*begin)->GetSeqRange(1));
        // subject range should always be on the positive strand
        assert(align_subj_rng.GetTo() > align_subj_rng.GetFrom());
        CRangeCollection<TSeqPos> coll(align_subj_rng);
        coll.Subtract(subj_rng_coll);

        if ( coll.empty() ) {
            continue;
        }

        if(coll[0] == align_subj_rng) {
            CRange<TSeqPos> query_rng ((*begin)->GetSeqRange(0));
            query_rng_coll += s_FixMinusStrandRange(query_rng);
            subj_rng_coll += align_subj_rng;
        }
        else {
            ITERATE (CRangeCollection<TSeqPos>, uItr, coll) {
                CRange<TSeqPos> query_rng;
                const CRange<TSeqPos> & subj_rng = (*uItr);
                CRef<CSeq_align> densegAln;
                if ( isDenDiag) {
                    densegAln = CreateDensegFromDendiag(**begin);
                }

                CAlnMap map( (isDenDiag) ? densegAln->GetSegs().GetDenseg() : (*begin)->GetSegs().GetDenseg());
                TSignedSeqPos subj_aln_start =  map.GetAlnPosFromSeqPos(1,subj_rng.GetFrom());
                TSignedSeqPos subj_aln_end =  map.GetAlnPosFromSeqPos(1,subj_rng.GetTo());
                query_rng.SetFrom(map.GetSeqPosFromAlnPos(0,subj_aln_start));
                query_rng.SetTo(map.GetSeqPosFromAlnPos(0,subj_aln_end));

                query_rng_coll += s_FixMinusStrandRange(query_rng);
                subj_rng_coll += subj_rng;
            }
        }
    }
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:57,代码来源:named_collection_score_impl.cpp

示例10: sx_GetReadId

static TReadId sx_GetReadId(const CSeq_id_Handle& idh)
{
    if ( idh.Which() != CSeq_id::e_General ) {
        return TReadId();
    }
    CConstRef<CSeq_id> id = idh.GetSeqId();
    const CDbtag& general = id->GetGeneral();
    if ( general.GetDb() != "SRA") {
        return TReadId();
    }
    return sx_GetReadId(general.GetTag().GetStr(), true);
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:12,代码来源:sraloader.cpp

示例11:

void
CCmdLineBlastXML2ReportData::x_InitSubjects(CConstRef<IBlastSeqInfoSrc> subjectsInfo)
{
	if(subjectsInfo->Size() == 0) {
		NCBI_THROW(CException, eUnknown, "blastxml2: Empty seq info src");
	}

	for(unsigned int i =0; i < subjectsInfo->Size(); i++) {
		list<CRef<objects::CSeq_id> > ids = subjectsInfo->GetId(i);
		m_SubjectIds.push_back(CAlignFormatUtil::GetSeqIdString(ids, true));
	}
}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:12,代码来源:data4xml2format.cpp

示例12:

int 
CLocalBlastDbAdapter::GetTaxId(const CSeq_id_Handle& idh)
{
    int retval = static_cast<int>(kInvalidSeqPos);
    CConstRef<CSeq_id> id = idh.GetSeqId();
    if (id.NotEmpty()) {
        int oid = 0;
        if (SeqidToOid(*id, oid)) {
            map<int, int> gi_to_taxid;
            m_SeqDB->GetTaxIDs(oid, gi_to_taxid);
            if (idh.IsGi()) {
                retval = gi_to_taxid[GI_TO(int, idh.GetGi())];
            } else {
开发者ID:swuecho,项目名称:igblast,代码行数:13,代码来源:local_blastdb_adapter.cpp

示例13: x_ValidatePssmVsGi129295

    void x_ValidatePssmVsGi129295(CConstRef<CSeq_align> sa) {
        BOOST_REQUIRE(sa->GetSegs().IsDenseg());

        const CDense_seg & denseg = sa->GetSegs().GetDenseg();

        // Validate the first (and only) HSP, which is a self hit
        const TSeqRange hsp(0, 231);
        TSeqRange hsp1_query = denseg.GetSeqRange(0);
        TSeqRange hsp1_subj = denseg.GetSeqRange(1);
        BOOST_REQUIRE_EQUAL(hsp.GetFrom(), hsp1_query.GetFrom());
        BOOST_REQUIRE_EQUAL(hsp.GetTo(), hsp1_query.GetTo());
        BOOST_REQUIRE_EQUAL(hsp.GetFrom(), hsp1_subj.GetFrom());
        BOOST_REQUIRE_EQUAL(hsp.GetTo(), hsp1_subj.GetTo());

    }
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:15,代码来源:psibl2seq_unit_test.cpp

示例14: CreateBioseqFromId

CRef<CBioseq> CBlastBioseqMaker::
        CreateBioseqFromId(CConstRef<CSeq_id> id, bool retrieve_seq_data)
{
    _ASSERT(m_scope.NotEmpty());

    // N.B.: this call fetches the Bioseq into the scope from its
    // data sources (should be BLAST DB first, then Genbank)
    TSeqPos len = sequence::GetLength(*id, m_scope);
    if (len == numeric_limits<TSeqPos>::max()) {
        NCBI_THROW(CInputException, eSeqIdNotFound,
                    "Sequence ID not found: '" + 
                    id->AsFastaString() + "'");
    }

    CBioseq_Handle bh = m_scope->GetBioseqHandle(*id);

    CRef<CBioseq> retval;
    if (retrieve_seq_data) {
        retval.Reset(const_cast<CBioseq*>(&*bh.GetCompleteBioseq()));
    } else {
        retval.Reset(new CBioseq());
        CRef<CSeq_id> idToStore(new CSeq_id);
        idToStore->Assign(*id);
        retval->SetId().push_back(idToStore);
        retval->SetInst().SetRepr(CSeq_inst::eRepr_raw);
        retval->SetInst().SetMol(bh.IsProtein() 
                                    ? CSeq_inst::eMol_aa
                                    : CSeq_inst::eMol_dna);
        retval->SetInst().SetLength(len);
    }
    return retval;
}
开发者ID:jackgopack4,项目名称:pico-blast,代码行数:32,代码来源:blast_input.cpp

示例15: x_Select

void CSeqMap_CI::x_Select(const CConstRef<CSeqMap>& seqMap,
                          const SSeqMapSelector& selector,
                          TSeqPos pos)
{
    m_Selector = selector;
    if ( m_Selector.m_Length == kInvalidSeqPos ) {
        TSeqPos len = seqMap->GetLength(GetScope());
        len -= min(len, m_Selector.m_Position);
        m_Selector.m_Length = len;
    }
    if ( pos < m_Selector.m_Position ) {
        pos = m_Selector.m_Position;
    }
    else if ( pos > m_Selector.m_Position + m_Selector.m_Length ) {
        pos = m_Selector.m_Position + m_Selector.m_Length;
    }
    x_Push(seqMap, m_Selector.m_TopTSE,
           m_Selector.m_Position,
           m_Selector.m_Length,
           m_Selector.m_MinusStrand,
           pos - m_Selector.m_Position);
    while ( !x_Found() && GetPosition() < m_SearchEnd ) {
        if ( !x_Push(pos - m_Selector.m_Position) ) {
            x_SettleNext();
            break;
        }
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:


注:本文中的CConstRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。