annot_object.cpp

来自「ncbi源码」· C++ 代码 · 共 606 行 · 第 1/2 页

CPP
606
字号
                ERR_POST(Warning << "Invalid 'scores' size in denseg");                numseg = min(numseg, (int)denseg.GetScores().size());            }            if (dim != (int)denseg.GetIds().size()) {                ERR_POST(Warning << "Invalid 'ids' size in denseg");                dim = min(dim, (int)denseg.GetIds().size());            }            if (dim*numseg != (int)denseg.GetStarts().size()) {                ERR_POST(Warning << "Invalid 'starts' size in denseg");                dim = min(dim*numseg, (int)denseg.GetStarts().size()) / numseg;            }            if (denseg.IsSetStrands()                && dim*numseg != (int)denseg.GetStrands().size()) {                ERR_POST(Warning << "Invalid 'strands' size in denseg");                dim = min(dim*numseg, (int)denseg.GetStrands().size()) / numseg;            }            if (hrmaps.size() < loc_index_shift + dim) {                hrmaps.resize(loc_index_shift + dim);            }            for (int seg = 0;  seg < numseg;  seg++) {                for (int row = 0;  row < dim;  row++) {                    if (denseg.GetStarts()[seg*dim + row] < 0 ) {                        continue;                    }                    CSeq_loc loc;                    loc.SetInt().SetId().Assign(*denseg.GetIds()[row]);                    loc.SetInt().SetFrom(denseg.GetStarts()[seg*dim + row]);                    loc.SetInt().SetTo(denseg.GetStarts()[seg*dim + row]                        + denseg.GetLens()[seg] - 1);                    if ( denseg.IsSetStrands() ) {                        loc.SetInt().SetStrand(denseg.GetStrands()[seg*dim + row]);                    }                    hrmaps[loc_index_shift + row].AddLocation(loc);                }            }            break;        }    case CSeq_align::C_Segs::e_Std:        {            const CSeq_align::C_Segs::TStd& std =                align.GetSegs().GetStd();            ITERATE ( CSeq_align::C_Segs::TStd, it, std ) {                if (hrmaps.size() < loc_index_shift + (*it)->GetDim()) {                    hrmaps.resize(loc_index_shift + (*it)->GetDim());                }                ITERATE ( CStd_seg::TLoc, it_loc, (*it)->GetLoc() ) {                    CSeq_loc_CI row_it(**it_loc);                    for (int row = 0; row_it; ++row_it, ++row) {                        if (loc_index_shift + row >= hrmaps.size()) {                            hrmaps.resize(loc_index_shift + row + 1);                        }                        CSeq_loc loc;                        loc.SetInt().SetId().Assign(row_it.GetSeq_id());                        loc.SetInt().SetFrom(row_it.GetRange().GetFrom());                        loc.SetInt().SetTo(row_it.GetRange().GetTo());                        if ( row_it.GetStrand() != eNa_strand_unknown ) {                            loc.SetInt().SetStrand(row_it.GetStrand());                        }                        hrmaps[loc_index_shift + row].AddLocation(loc);                    }                }            }            break;        }    case CSeq_align::C_Segs::e_Packed:        {            const CSeq_align::C_Segs::TPacked& packed =                align.GetSegs().GetPacked();            int dim    = packed.GetDim();            int numseg = packed.GetNumseg();            // claimed dimension may not be accurate :-/            if (dim * numseg > (int)packed.GetStarts().size()) {                dim = packed.GetStarts().size() / numseg;            }            if (dim * numseg > (int)packed.GetPresent().size()) {                dim = packed.GetPresent().size() / numseg;            }            if (dim > (int)packed.GetLens().size()) {                dim = packed.GetLens().size();            }            if (hrmaps.size() < loc_index_shift + dim) {                hrmaps.resize(loc_index_shift + dim);            }            for (int seg = 0;  seg < numseg;  seg++) {                for (int row = 0;  row < dim;  row++) {                    if ( packed.GetPresent()[seg*dim + row] ) {                        CSeq_loc loc;                        loc.SetInt().SetId().Assign(*packed.GetIds()[row]);                        loc.SetInt().SetFrom(packed.GetStarts()[seg*dim + row]);                        loc.SetInt().SetTo(packed.GetStarts()[seg*dim + row]                            + packed.GetLens()[seg] - 1);                        if ( packed.IsSetStrands() ) {                            loc.SetInt().SetStrand(packed.GetStrands()[seg*dim + row]);                        }                        hrmaps[loc_index_shift + row].AddLocation(loc);                    }                }            }            break;        }    case CSeq_align::C_Segs::e_Disc:        {            const CSeq_align::C_Segs::TDisc& disc =                align.GetSegs().GetDisc();            ITERATE ( CSeq_align_set::Tdata, it, disc.Get() ) {                x_ProcessAlign(hrmaps, **it, hrmaps.size());            }            break;        }    }}END_SCOPE(objects)END_NCBI_SCOPE/** ---------------------------------------------------------------------------* $Log: annot_object.cpp,v $* Revision 1000.3  2004/06/01 19:22:36  gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.39** Revision 1.39  2004/05/26 14:29:20  grichenk* Redesigned CSeq_align_Mapper: preserve non-mapping intervals,* fixed strands handling, improved performance.** Revision 1.38  2004/05/21 21:42:12  gorelenk* Added PCH ncbi_pch.hpp** Revision 1.37  2004/04/01 20:33:58  grichenk* One more m_MultiId initialization** Revision 1.36  2004/04/01 20:18:12  grichenk* Added initialization of m_MultiId member.** Revision 1.35  2004/03/31 20:43:29  grichenk* Fixed mapping of seq-locs containing both master sequence* and its segments.** Revision 1.34  2004/03/26 19:42:04  vasilche* Fixed premature deletion of SNP annot info object.* Removed obsolete references to chunk info.** Revision 1.33  2004/03/16 15:47:27  vasilche* Added CBioseq_set_Handle and set of EditHandles** Revision 1.32  2004/02/04 18:05:38  grichenk* Added annotation filtering by set of types/subtypes.* Renamed *Choice to *Type in SAnnotSelector.** Revision 1.31  2004/01/23 16:14:47  grichenk* Implemented alignment mapping** Revision 1.30  2004/01/22 20:10:40  vasilche* 1. Splitted ID2 specs to two parts.* ID2 now specifies only protocol.* Specification of ID2 split data is moved to seqsplit ASN module.* For now they are still reside in one resulting library as before - libid2.* As the result split specific headers are now in objects/seqsplit.* 2. Moved ID2 and ID1 specific code out of object manager.* Protocol is processed by corresponding readers.* ID2 split parsing is processed by ncbi_xreader library - used by all readers.* 3. Updated OBJMGR_LIBS correspondingly.** Revision 1.29  2003/11/26 17:55:56  vasilche* Implemented ID2 split in ID1 cache.* Fixed loading of splitted annotations.** Revision 1.28  2003/10/07 13:43:23  vasilche* Added proper handling of named Seq-annots.* Added feature search from named Seq-annots.* Added configurable adaptive annotation search (default: gene, cds, mrna).* Fixed selection of blobs for loading from GenBank.* Added debug checks to CSeq_id_Mapper for easier finding lost CSeq_id_Handles.* Fixed leaked split chunks annotation stubs.* Moved some classes definitions in separate *.cpp files.** Revision 1.27  2003/09/30 16:22:02  vasilche* Updated internal object manager classes to be able to load ID2 data.* SNP blobs are loaded as ID2 split blobs - readers convert them automatically.* Scope caches results of requests for data to data loaders.* Optimized CSeq_id_Handle for gis.* Optimized bioseq lookup in scope.* Reduced object allocations in annotation iterators.* CScope is allowed to be destroyed before other objects using this scope are* deleted (feature iterators, bioseq handles etc).* Optimized lookup for matching Seq-ids in CSeq_id_Mapper.* Added 'adaptive' option to objmgr_demo application.** Revision 1.26  2003/08/27 21:24:51  vasilche* Reordered member initializers.** Revision 1.25  2003/08/27 14:29:52  vasilche* Reduce object allocations in feature iterator.** Revision 1.24  2003/08/26 21:28:47  grichenk* Added seq-align verification** Revision 1.23  2003/07/18 16:58:23  grichenk* Fixed alignment coordinates** Revision 1.22  2003/07/17 20:07:55  vasilche* Reduced memory usage by feature indexes.* SNP data is loaded separately through PUBSEQ_OS.* String compression for SNP data.** Revision 1.21  2003/06/02 16:06:37  dicuccio* Rearranged src/objects/ subtree.  This includes the following shifts:*     - src/objects/asn2asn --> arc/app/asn2asn*     - src/objects/testmedline --> src/objects/ncbimime/test*     - src/objects/objmgr --> src/objmgr*     - src/objects/util --> src/objmgr/util*     - src/objects/alnmgr --> src/objtools/alnmgr*     - src/objects/flat --> src/objtools/flat*     - src/objects/validator --> src/objtools/validator*     - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.20  2003/04/24 16:12:38  vasilche* Object manager internal structures are splitted more straightforward.* Removed excessive header dependencies.** Revision 1.19  2003/03/11 15:51:06  kuznets* iterate -> ITERATE** Revision 1.18  2003/02/24 18:57:22  vasilche* Make feature gathering in one linear pass using CSeqMap iterator.* Do not use feture index by sub locations.* Sort features at the end of gathering in one vector.* Extracted some internal structures and classes in separate header.* Delay creation of mapped features.** Revision 1.17  2003/02/13 14:34:34  grichenk* Renamed CAnnotObject -> CAnnotObject_Info* + CSeq_annot_Info and CAnnotObject_Ref* Moved some members of CAnnotObject to CSeq_annot_Info* and CAnnotObject_Ref.* Added feat/align/graph to CAnnotObject_Info map* to CDataSource.** Revision 1.16  2003/02/04 18:53:36  dicuccio* Include file clean-up** Revision 1.15  2003/01/22 20:11:54  vasilche* Merged functionality of CSeqMapResolved_CI to CSeqMap_CI.* CSeqMap_CI now supports resolution and iteration over sequence range.* Added several caches to CScope.* Optimized CSeqVector().* Added serveral variants of CBioseqHandle::GetSeqVector().* Tried to optimize annotations iterator (not much success).* Rewritten CHandleRange and CHandleRangeMap classes to avoid sorting of list.** Revision 1.14  2002/09/13 15:20:30  dicuccio* Fix memory leak (static deleted before termination).** Revision 1.13  2002/09/11 16:08:26  dicuccio* Fixed memory leak in x_PrepareAlign().** Revision 1.12  2002/09/03 17:45:45  ucko* Avoid overrunning alignment data when the claimed dimensions are too high.** Revision 1.11  2002/07/25 15:01:51  grichenk* Replaced non-const GetXXX() with SetXXX()** Revision 1.10  2002/07/08 20:51:00  grichenk* Moved log to the end of file* Replaced static mutex (in CScope, CDataSource) with the mutex* pool. Redesigned CDataSource data locking.** Revision 1.9  2002/07/01 15:31:57  grichenk* Fixed 'enumeration value e_not_set...' warning** Revision 1.8  2002/05/29 21:21:13  gouriano* added debug dump** Revision 1.7  2002/05/24 14:57:12  grichenk* SerialAssign<>() -> CSerialObject::Assign()** Revision 1.6  2002/05/03 21:28:08  ucko* Introduce T(Signed)SeqPos.** Revision 1.5  2002/04/05 21:26:19  grichenk* Enabled iteration over annotations defined on segments of a* delta-sequence.** Revision 1.4  2002/02/21 19:27:04  grichenk* Rearranged includes. Added scope history. Added searching for the* best seq-id match in data sources and scopes. Updated tests.** Revision 1.3  2002/01/23 21:59:31  grichenk* Redesigned seq-id handles and mapper** Revision 1.2  2002/01/16 16:25:56  gouriano* restructured objmgr** Revision 1.1  2002/01/11 19:06:16  gouriano* restructured objmgr*** ===========================================================================*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?