Example #1
0
def LoadCondition(vcffile, condition, sample_order):
    reader2 = VCF(vcffile)
    #reader2 = vcf.Reader(open(vcffile, "rb"))
    chrom, start = condition.split(":")
    region = "%s:%s-%s" % (chrom, start, int(start) + 1)
    reader2.fetch(region)
    reader2 = reader2(region)
    for record in reader2:
        print(record.start, int(start), record.ID)
        if record.POS == int(start):
            is_str = True
            if len(record.REF) == 1 and len(record.ALT) == 1 and len(
                    record.ALT[0]) == 1:
                is_str = False
            return LoadGT(record,
                          sample_order,
                          is_str=is_str,
                          vcf_samples=reader2.samples)
    common.ERROR("Could not find SNP to condition on")