Commit 86cbe6d0 authored by Sander Bollen's avatar Sander Bollen
Browse files

fix read mode on region reeader.

parent 204024b5
......@@ -14,7 +14,6 @@ Furthermore, the following python packages are required:
* biopython >= 1.66
* lxml >= 3.4.4
* pyfaidx >= 0.4.4
* fastools >= 0.12.0
* pyvcf >= 0.6.7
......
......@@ -278,12 +278,17 @@ def find_snps(primer, db_snp=None, field="AF"):
except:
return None
if db_snp is None:
return None
reader = vcf.Reader(filename=db_snp)
left_end = int(primer.left_pos) + len(primer.left)
right_end = int(primer.right_pos) + len(primer.right)
contigs = list(reader.contigs.keys())
if len(contigs) == 0:
raise ValueError("The VCF file does not contain contigs in the header.")
if "chr" in contigs[0] and not "chr" in primer.chromosome:
chrom = "chr" + primer.chromosome
elif "chr" in primer.chromosome and not "chr" in contigs[0]:
......
......@@ -56,7 +56,7 @@ def primers_from_region(bed_path, padding, product_size, n_prims, reference,
"""**prim_args will be passed on to primer3"""
regions = []
primers = []
with open(bed_path, "rb") as bed:
with open(bed_path, "r") as bed:
for line in bed:
if line.startswith("track"): # ignore tracklines
continue
......@@ -273,6 +273,3 @@ def main():
if __name__ == '__main__':
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment