ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/GBam.h
(Generate patch)
# Line 82 | Line 82
82        b->core.flag=flags;
83        }
84  
85
86
85      //creates a new record from 1-based alignment coordinate
86      //quals should be given as Phred33
87      //Warning: pos and mate_pos must be given 1-based!
# Line 121 | Line 119
119   bool isMapped() { return ((b->core.flag & BAM_FUNMAP) == 0); }
120   bool isPaired() { return ((b->core.flag & BAM_FPAIRED) != 0); }
121   const char* name() { return bam1_qname(b); }
122 < int mateNum() {
122 > int pairOrder() {
123 >    //which read in the pair: 0 = unpaired, 1=first read, 2=second read
124      int r=0;
125      if ((b->core.flag & BAM_FREAD1) != 0) r=1;
126      else if ((b->core.flag & BAM_FREAD2) != 0) r=2;
127      return r;
128      }
129 < bool revStrand() { return ((b->core.flag & BAM_FREVERSE) != 0); }
130 < const char* refName() {
131 <     return (bam_header!=NULL) ? bam_header->target_name[b->core.tid] : NULL;
132 <     }
129 > bool revStrand() {
130 >   //this is the raw alignment strand, NOT the transcription (XS) strand
131 >   return ((b->core.flag & BAM_FREVERSE) != 0);
132 >   }
133 > const char* refName() {
134 >   return (bam_header!=NULL) ?
135 >         ((b->core.tid<0) ? "*" : bam_header->target_name[b->core.tid]) : NULL;
136 >   }
137   int32_t refId() { return b->core.tid; }
138 + int32_t mate_refId() { return b->core.mtid; }
139 + const char* mate_refName() {
140 +    return (bam_header!=NULL) ?
141 +       ((b->core.mtid<0) ? "*" : bam_header->target_name[b->core.mtid]) : NULL;
142 +    }
143 + int32_t insertSize() { return b->core.isize; }
144 + int32_t mate_start() { return b->core.mpos<0? 0 : b->core.mpos+1; }
145  
146   int find_tag(const char tag[2], uint8_t* & s, char& tag_type);
147 + //position s at the beginning of tag data, tag_type is set to the found tag type
148 + //returns length of tag data, or 0 if tag not found
149 +
150   char* tag_str(const char tag[2]); //return tag value for tag type 'Z'
151   int tag_int(const char tag[2]); //return numeric value of tag (for numeric types)
152   char tag_char(const char tag[2]); //return char value of tag (for type 'A')
153   char spliceStrand(); // '+', '-' from the XS tag, or '.' if no XS tag
154 < char* sequence(); //user must free this after use
155 < char* qualities();//user must free this after use
156 < char* cigar(); //returns text version of the CIGAR string; must be freed by user
154 >
155 > char* sequence(); //user should free after use
156 > char* qualities();//user should free after use
157 > char* cigar(); //returns text version of the CIGAR string; user must free
158   };
159  
160  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines