示例#1
0
    void
    make_record_haploid(VcfRecord& vcfr) const {
        const char* gt(vcfr.GetSampleVal("GT"));
        if(NULL == gt)  return;
        parse_gt(gt,_gti);
            
        if(_gti.size() == 2) { // record is diploid
            if(_gti[0] == _gti[1]) {
                // change GT:
                static const char* unknown(".");
                const char* val(unknown);
                if(_gti[0]>=0) {
                    val=_intstr.get32(_gti[0]);
                }
                vcfr.SetSampleVal("GT",val);

                // move PL field to 'backup' OPL field:
                const char* pl(vcfr.GetSampleVal("PL"));
                if(NULL != pl) {
                    vcfr.SetSampleVal(_shopt.orig_pl_tag.c_str(),pl);
                    vcfr.DeleteSampleKeyVal("PL");
                }
            } else {
                vcfr.AppendFilter(_shopt.haploid_conflict_label.c_str());
            }
        }
    }