]> git.donarmstrong.com Git - bamtools.git/blobdiff - bamtools_convert.cpp
further cleanup of duplicate @RG tag warning reporting
[bamtools.git] / bamtools_convert.cpp
index e881d43c89a1d9dcff8685062902940b35a1f6b5..655c25a623013d9c95714cb954d087184aaa62ce 100644 (file)
@@ -187,7 +187,7 @@ void BamTools::PrintJSON(ostream& out, const BamAlignment& a) {
         for ( ; cigarIter != cigarEnd; ++cigarIter ) {
             const CigarOp& op = (*cigarIter);
             if (cigarIter != cigarBegin) out << ",";
-            out << "[\"" << op.Length << ",\"" << op.Type << "\"]";
+            out << "\"" << op.Length << op.Type << "\"";
         }
         out << "],";
     }
@@ -238,12 +238,12 @@ void BamTools::PrintJSON(ostream& out, const BamAlignment& a) {
                     break;
                 
                 case('C') : 
-                    out << atoi(&tagData[index])
+                    out << (int)tagData[index]
                     ++index; 
                     break;
                 
                 case('c') : 
-                    out << atoi(&tagData[index]);
+                    out << (int)tagData[index];
                     ++index; 
                     break;
                 
@@ -347,6 +347,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
     // write tag data
     const char* tagData = a.TagData.c_str();
     const size_t tagDataLength = a.TagData.length();
+    
     size_t index = 0;
     while ( index < tagDataLength ) {
 
@@ -365,12 +366,12 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 break;
             
             case('C') : 
-                out << "i:" << atoi(&tagData[index])
+                out << "i:" << (int)tagData[index]
                 ++index; 
                 break;
             
             case('c') : 
-                out << "i:" << atoi(&tagData[index]);
+                out << "i:" << (int)tagData[index];
                 ++index; 
                 break;
             
@@ -384,7 +385,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 index += 2; 
                 break;
             
-            case('I') : 
+            case('I') :
                 out << "i:" << BgzfData::UnpackUnsignedInt(&tagData[index]);
                 index += 4; 
                 break;
@@ -414,7 +415,7 @@ void BamTools::PrintSAM(ostream& out, const BamAlignment& a) {
                 ++index; 
                 break;      
         }
-        
+
         if ( tagData[index] == '\0') break;
     }