gnABISource.cpp Source File

Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# gnABISource.cpp

Go to the documentation of this file.

    00001
    00002 // File:            gnABISource.h
    00003 // Purpose:         Implements gnBaseSource for .ABI files
    00004 // Description:
    00005 // Changes:
    00006 // Version:         libGenome 0.1.0
    00007 // Author:          Aaron Darling
    00008 // Last Edited:     April 15, 2001, 11:13:00pm
    00009 // Modified by:
    00010 // Copyright:       (c) Aaron Darling
    00011 // Licenses:        Proprietary
    00013 #include "gn/gnABISource.h"
    00014
    00015 gnABISource::gnABISource()
    00016 {
    00017         m_openString = "";
    00018         m_pFilter = gnFilter::fullDNASeqFilter();
    00019 }
    00020 gnABISource::gnABISource( const gnABISource& s ) : gnFileSource(s)
    00021 {
    00022         vector< gnFileContig* >::const_iterator iter = s.m_contigList.begin();
    00023         for( ; iter != s.m_contigList.end(); ++iter )
    00024         {
    00025                 m_contigList.push_back( *iter );
    00026         }
    00027 }
    00028 gnABISource::~gnABISource()
    00029 {
    00030         m_ifstream.close();
    00031         vector< gnFileContig* >::iterator iter = m_contigList.begin();
    00032         for( ; iter != m_contigList.end(); ++iter )
    00033         {
    00034                 gnFileContig* fg = *iter;
    00035                 *iter = 0;
    00036                 delete fg;
    00037         }
    00038 }
    00039
    00040 // Contig Access methods
    00041 boolean gnABISource::HasContig( const string& name ) const
    00042 {
    00043         vector< gnFileContig* const>::iterator iter = m_contigList.begin();
    00044         for( ; iter != m_contigList.end(); ++iter )
    00045         {
    00046                 if( name == (*iter)->GetName() )
    00047                         return true;
    00048         }
    00049         return false;
    00050 }
    00051 uint32 gnABISource::GetContigID( const string& name ) const
    00052 {
    00053         vector< gnFileContig* const>::iterator iter = m_contigList.begin();
    00054         for( ; iter != m_contigList.end(); ++iter )
    00055         {
    00056                 if( name == (*iter)->GetName() )
    00057                         return iter - m_contigList.begin();
    00058         }
    00059         return ALL_CONTIGS;
    00060 }
    00061
    00062 string gnABISource::GetContigName( uint32 i ) const{
    00063         if( i < m_contigList.size() ){
    00064                 return m_contigList[i]->GetName();
    00065         }
    00066         return "";
    00067 }
    00068
    00069 gnSeqI gnABISource::GetContigSeqLength( uint32 i ) const{
    00070         if( i < m_contigList.size() )
    00071         {
    00072                 return m_contigList[i]->GetSeqLength();
    00073         }else if( i == ALL_CONTIGS){
    00074                 gnSeqI seqlen = 0;
    00075                 for(int j=0; j < m_contigList.size(); j++)
    00076                         seqlen += m_contigList[j]->GetSeqLength();
    00077                 return seqlen;
    00078         }
    00079         return GNSEQI_ERROR;
    00080 }
    00081
    00082 boolean gnABISource::SeqRead( const gnSeqI start, char* buf, uint32& bufLen, const uint32 contigI )
    00083 {
    00084         return false;
    00085 }
    00086
    00087 boolean gnABISource::SeqSeek( const gnSeqI start, const uint32& contigI, uint64& startPos, uint64& readableBytes ){
    00088         return SeqStartPos( start, *(m_contigList[contigI]), startPos, readableBytes );
    00089 }
    00090
    00091 boolean gnABISource::SeqStartPos( const gnSeqI start, gnFileContig& contig, uint64& startPos, uint64& readableBytes )
    00092 {
    00093         return false;
    00094 }
    00095
    00096 gnFileContig* gnABISource::GetFileContig( const uint32 contigI ) const{
    00097         if(m_contigList.size() > contigI)
    00098                 return m_contigList[contigI];
    00099         return NULL;
    00100 }
    00101
    00102 boolean gnABISource::ParseStream( istream& fin )
    00103 {
    00104         return false;
    00105 }