view_taxplot_ds.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: view_taxplot_ds.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:02:02 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: view_taxplot_ds.cpp,v 1000.1 2004/06/01 21:02:02 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Authors: Mike DiCuccio
- *
- * File Description:
- *
- */
- #include <ncbi_pch.hpp>
- #include "view_taxplot_ds.hpp"
- #include <memory>
- BEGIN_NCBI_SCOPE
- CTaxplotDataSource::CTaxplotDataSource(CShiReaderCache * cache, Int4 tax1, Int4 tax2, Int4 tax3):CTaxplot3dDataSource()
- {
- const IShiCache::TIdVector & giVect = cache->GetData();
- // init datasource
- clear();
- // fill it from cache
- for (IShiCache::TIdVector::const_iterator it=giVect.begin(); it!=giVect.end(); it++){
- IShiCache::TScoreMap::const_iterator itm;
- int score1 = ((itm=it->find(tax1))!=it->end()) ? itm->second : 0;
- int score2 = ((itm=it->find(tax2))!=it->end()) ? itm->second : 0;
- int score3 = ((itm=it->find(tax3))!=it->end()) ? itm->second : 0;
- int currgi = ((itm=it->find(0))!=it->end()) ? itm->second : 0;
- if ((score1!=score2!=score3) &&
- ((score1!=0 && score2!=0) || (score1!=0 && score3!=0) || (score2!=0 && score3!=0))){
- CGraph3DVertex<float, float> * newVertex = new CGraph3DVertex<float, float>(score1, score2, score3, currgi);
- if (score1!=0 && score2!=0 && score3!=0) newVertex->setRGB(0, 0.5, 0);
- else newVertex->setRGB(0, 0, 0.5);
- addVertex(newVertex);
- }
- }
- normalizeAll();
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: view_taxplot_ds.cpp,v $
- * Revision 1000.1 2004/06/01 21:02:02 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- *
- * Revision 1.5 2004/05/21 22:27:49 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.4 2004/01/28 16:01:42 tereshko
- * Changed datasource initialization
- *
- * Revision 1.3 2004/01/21 14:17:04 dicuccio
- * Adjusted API to be more coding standard compliant. Don't use auto_ptr<> for
- * local buffers
- *
- * Revision 1.2 2004/01/21 14:04:01 ucko
- * +<memory> for auto_ptr<>
- *
- * Revision 1.1 2004/01/14 16:37:08 tereshko
- * Taxplot viewer, initial revision
- *
- * Revision 1.2 2003/09/24 18:26:47 dicuccio
- * Large clean-ups to alignment viewers. Reimplemented data sources and alignment
- * generation mechanism to be more generic.
- *
- * Revision 1.1 2003/09/12 16:03:20 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */