Example #1
0
TGi CAsnCache_DataLoader::GetGi(const CSeq_id_Handle& idh)
{
    SCacheInfo& index = x_GetIndex();
    CFastMutexGuard LOCK(index.cache_mtx);

    CAsnIndex::TGi gi = 0;
    time_t timestamp = 0;
    if (index.cache->GetIdInfo(idh, gi, timestamp)) {
        //LOG_POST(Error << "CAsnCache_DataLoader::GetGi(): " << idh << " -> " << gi);
        return GI_FROM(CAsnIndex::TGi, gi);
    }
    return ZERO_GI;
}
Example #2
0
/// not yet in SC-6.0...
void CAsnCache_DataLoader::GetGis(const TIds& ids, TLoaded& loaded, TIds& ret)
{
    SCacheInfo& index = x_GetIndex();
    CFastMutexGuard LOCK(index.cache_mtx);

    ret.clear();
    ret.resize(ids.size());

    loaded.clear();
    loaded.resize(ids.size());
    for (size_t i = 0;  i < ids.size();  ++i) {
        CAsnIndex::TGi gi = 0;
        time_t timestamp = 0;
        if (index.cache->GetIdInfo(ids[i], gi, timestamp)) {
            ret[i] = CSeq_id_Handle::GetHandle(GI_FROM(CAsnIndex::TGi, gi));
            loaded[i] = true;
        }
    }
}
Example #3
0
void CSeqTableLocColumns::ParseDefaults(void)
{
    if ( !m_Is_set ) {
        return;
    }
    if ( m_Loc ) {
        m_Is_real_loc = true;
        if ( m_Id || m_Gi || m_From || m_To || m_Strand ||
             !m_ExtraColumns.empty() ) {
            NCBI_THROW_FMT(CAnnotException, eBadLocation,
                           "Conflicting "<<m_FieldName<<" columns");
        }
        return;
    }

    if ( !m_Id && !m_Gi ) {
        NCBI_THROW_FMT(CAnnotException, eBadLocation,
                       "No "<<m_FieldName<<".id column");
    }
    if ( m_Id && m_Gi ) {
        NCBI_THROW_FMT(CAnnotException, eBadLocation,
                       "Conflicting "<<m_FieldName<<" columns");
    }
    if ( m_Id ) {
        if ( m_Id->IsSetDefault() ) {
            m_DefaultIdHandle =
                CSeq_id_Handle::GetHandle(m_Id->GetDefault().GetId());
        }
    }
    if ( m_Gi ) {
        if ( m_Gi->IsSetDefault() ) {
            m_DefaultIdHandle =
                CSeq_id_Handle::GetGiHandle(
                GI_FROM(CSeqTable_single_data::TInt, m_Gi->GetDefault().GetInt()));
        }
    }

    if ( m_To ) {
        // interval
        if ( !m_From ) {
            NCBI_THROW_FMT(CAnnotException, eBadLocation,
                           "column "<<m_FieldName<<".to without "<<
                           m_FieldName<<".from");
        }
        m_Is_simple_interval = true;
    }
    else if ( m_From ) {
        // point
        m_Is_simple_point = true;
    }
    else {
        // whole
        if ( m_Strand || !m_ExtraColumns.empty() ) {
            NCBI_THROW_FMT(CAnnotException, eBadLocation,
                           "extra columns in whole "<<m_FieldName);
        }
        m_Is_simple_whole = true;
    }
    if ( m_ExtraColumns.empty() ) {
        m_Is_simple = true;
    }
    else {
        m_Is_probably_simple = true;
    }
}