]> git.donarmstrong.com Git - bamtools.git/commitdiff
Purely cosmetic udpate. Cleaned up some commented blocks, added file header informati...
authorDerek <derekwbarnett@gmail.com>
Tue, 13 Jul 2010 16:00:42 +0000 (12:00 -0400)
committerDerek <derekwbarnett@gmail.com>
Tue, 13 Jul 2010 16:00:42 +0000 (12:00 -0400)
BamIndex.cpp
BamIndex.h
bamtools_fasta.cpp
bamtools_fasta.h
bamtools_pileup.cpp
bamtools_pileup.h

index 282326f9f79a20049b8b262c28adaccebc39ed36..787995b7e3823d5f2f6810abe729cd2b75ceb8fe 100644 (file)
@@ -1,3 +1,15 @@
+// ***************************************************************************
+// BamIndex.cpp (c) 2009 Derek Barnett
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010 (DB)
+// ---------------------------------------------------------------------------
+// Provides index functionality - both for the default (standardized) BAM 
+// index format (.bai) as well as a BamTools-specific (nonstandard) index 
+// format (.bti).
+// ***************************************************************************
+
 #include <cstdio>
 #include <cstdlib>
 #include <algorithm>
@@ -747,15 +759,6 @@ bool BamToolsIndex::Build(void) {
         // if block is full, get offset for next block, reset currentBlockCount
         if ( currentBlockCount == d->m_blockSize ) {
           
-//             cerr << "-------------------------------" << endl;
-//             cerr << "BlockCount = " << currentBlockCount << endl;
-//             cerr << endl;
-//             cerr << "Storing entry: " << endl;
-//             cerr << "\trefID  : " << blockStartId << endl;
-//             cerr << "\tpos    : " << blockStartPosition << endl;
-//             cerr << "\toffset : " << blockStartOffset << endl;
-//             
-          
             d->m_indexData.push_back( BamToolsIndexEntry(blockStartOffset, blockStartId, blockStartPosition) );
             blockStartOffset = m_BGZF->Tell();
             currentBlockCount = 0;
@@ -796,7 +799,6 @@ bool BamToolsIndex::GetOffsets(const BamRegion& region, const bool isRightBoundS
         return false;
     
     // store offset & return success
-/*    cerr << "BTI::GetOffsets() : calculated offset = " << previousOffset << endl;*/
     offsets.push_back(previousOffset);
     return true; 
 }
index 99dd095c473511aec389b9262ca04d06f729e10c..aeecefb77a8bd75fe289bb60193a8563c965e81a 100644 (file)
@@ -1,3 +1,15 @@
+// ***************************************************************************
+// BamIndex.h (c) 2009 Derek Barnett
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010 (DB)
+// ---------------------------------------------------------------------------
+// Provides index functionality - both for the default (standardized) BAM 
+// index format (.bai) as well as a BamTools-specific (nonstandard) index 
+// format (.bti).
+// ***************************************************************************
+
 #ifndef BAM_INDEX_H
 #define BAM_INDEX_H
 
index 74cde03a7e88d5bbb9c56465057c343b3b4d32cf..7e94a52b5e8a3e541986fb14938bf1c355f7be55 100644 (file)
@@ -1,3 +1,13 @@
+// ***************************************************************************
+// bamtools_fasta.cpp (c) 2010 Derek Barnett, Erik Garrison
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010
+// ---------------------------------------------------------------------------
+// Provides FASTA reading/indexing functionality.
+// ***************************************************************************
+
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
@@ -157,12 +167,26 @@ bool Fasta::FastaPrivate::CreateIndex(const string& indexFilename) {
     string sequence = "";
     while ( GetNextHeader(header) ) {
         
+        // ---------------------------
         // build index entry data
         FastaIndexData data;
-        GetNameFromHeader(header, data.Name);
+        
+        // store file offset of beginning of DNA sequence (after header)
         data.Offset = ftello(Stream);
         
-        GetNextSequence(sequence);
+        // parse header, store sequence name in data.Name
+        if ( !GetNameFromHeader(header, data.Name) ) {
+            cerr << "FASTA error : could not parse read name from FASTA header" << endl;
+            return false;
+        }
+        
+        // retrieve FASTA sequence
+        if ( !GetNextSequence(sequence) ) {
+            cerr << "FASTA error : could not read in next sequence from FASTA file" << endl;
+            return false;
+        }
+        
+        // store sequence length & line/byte lengths
         data.Length = sequence.length();
         data.LineLength = lineLength;
         data.ByteLength = byteLength;
@@ -305,7 +329,7 @@ bool Fasta::FastaPrivate::GetNameFromHeader(const string& header, string& name)
     }
 
     if ( start == stop ) {
-        cout << "FASTA error : could not parse read name from FASTA header." << endl;
+        cerr << "FASTA error : could not parse read name from FASTA header" << endl;
         return false;
     }
 
@@ -582,7 +606,7 @@ Fasta::~Fasta(void) {
     d = 0;
 }
 
-bool Fasta::Close(void) {
+bool Fasta::Close(void) { 
     return d->Close();
 }
 
@@ -600,4 +624,4 @@ bool Fasta::GetSequence(const int& refId, const int& start, const int& stop, str
 
 bool Fasta::Open(const string& filename, const string& indexFilename) {
     return d->Open(filename, indexFilename);
-}
\ No newline at end of file
+}
index 43c262bcfe79a744f70154052caa2b2ec938de49..f64a0876a0913721a58791411bf86764dd43c46b 100644 (file)
@@ -1,3 +1,13 @@
+// ***************************************************************************
+// bamtools_fasta.h (c) 2010 Derek Barnett, Erik Garrison
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010
+// ---------------------------------------------------------------------------
+// Provides FASTA reading/indexing functionality.
+// ***************************************************************************
+
 #ifndef BAMTOOLS_FASTA_H
 #define BAMTOOLS_FASTA_H
 
index 5b84ead2e37a1bd6bab8bf4e287ddb6a90c9bca1..1862289ff70a08bb5dc96617175810a4db57f19e 100644 (file)
@@ -1,3 +1,16 @@
+// ***************************************************************************
+// bamtools_pileup.cpp (c) 2010 Derek Barnett, Erik Garrison
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010
+// ---------------------------------------------------------------------------
+// Provides pileup conversion functionality.  
+// 
+// The 'assembly' aspect of pileup makes this more complicated than the 
+// simpler one-to-one conversion methods for other formats.
+// ***************************************************************************
+
 #include <vector>
 #include "BamMultiReader.h"
 #include "bamtools_pileup.h"
index b28059ca9dd23aad1ba8f64560214a9d4c0b4198..3ffb03090ed336cbbc0e977c9df2a75b29a773cc 100644 (file)
@@ -1,3 +1,16 @@
+// ***************************************************************************
+// bamtools_pileup.h (c) 2010 Derek Barnett, Erik Garrison
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 13 July 2010
+// ---------------------------------------------------------------------------
+// Provides pileup conversion functionality.  
+// 
+// The 'assembly' aspect of pileup makes this more complicated than the 
+// simpler one-to-one conversion methods for other formats.
+// ***************************************************************************
+
 #ifndef BAMTOOLS_PILEUP_H
 #define BAMTOOLS_PILEUP_H