ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/GBam.cpp
(Generate patch)
# Line 32 | Line 32
32   GBamRecord::GBamRecord(const char* qname, int32_t gseq_tid,
33                   int pos, bool reverse, const char* qseq,
34                   const char* cigar, const char* quals):exons(1) {
35 <   //novel=true;
35 >   novel=true;
36     bam_header=NULL;
37     b=bam_init1();
38 <   b->core.tid=gseq_tid;
39 <   if (pos<=0) {
38 >   if (pos<=0 || gseq_tid<0) {
39                 b->core.pos=-1; //unmapped
41               //if (gseq_tid<0)
40                 b->core.flag |= BAM_FUNMAP;
41 +               gseq_tid=-1;
42                 }
43            else b->core.pos=pos-1; //BAM is 0-based
44 +   b->core.tid=gseq_tid;
45     b->core.qual=255;
46 +   b->core.mtid=-1;
47 +   b->core.mpos=-1;
48     int l_qseq=strlen(qseq);
49     //this may not be accurate, setting CIGAR is the correct way
50     //b->core.bin = bam_reg2bin(b->core.pos, b->core.pos+l_qseq-1);
# Line 58 | Line 60
60               int pos, int map_qual, const char* cigar, int32_t mg_tid, int mate_pos,
61               int insert_size, const char* qseq, const char* quals,
62               GVec<char*>* aux_strings):exons(1)  {
63 <  //novel=true;
63 >  novel=true;
64    bam_header=NULL;
65    b=bam_init1();
66    b->core.tid=g_tid;
# Line 168 | Line 170
170  
171   void GBamRecord::add_aux(const char* str) {
172       //requires: being called AFTER add_quals()
171     static char tag[2];
172     static uint8_t abuf[512];
173     //requires: being called AFTER add_quals()
173       int strl=strlen(str);
174       //int doff = b->core.l_qname + b->core.n_cigar*4 + (b->core.l_qseq+1)/2 + b->core.l_qseq + b->l_aux;
175       //int doff0=doff;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines