Commit 1843ade5 authored by Blaise Li's avatar Blaise Li
Browse files

Fix empty BedTool: need to pass file name, not fh.

parent 519923a0
......@@ -189,19 +189,18 @@ def id_list_gtf2bed(identifiers, gtf_filename, feature_type="transcript", id_kwd
in the feature annotations in the gtf_file. These feature IDs will be
matched against the elements in *identifiers*.
"""
with open(gtf_filename, "r") as gtf_file:
gtf = BedTool(gtf_file)
if identifiers:
ids = set(identifiers)
def feature_filter(feature):
return feature[2] == feature_type and feature[id_kwd] in ids
return gtf.filter(feature_filter)
else:
# https://stackoverflow.com/a/13243870/1878788
def empty_bed_generator():
return
yield
return empty_bed_generator()
if identifiers:
ids = set(identifiers)
def feature_filter(feature):
return feature[2] == feature_type and feature[id_kwd] in ids
gtf = BedTool(gtf_filename)
return gtf.filter(feature_filter)
else:
# https://stackoverflow.com/a/13243870/1878788
def empty_bed_generator():
return
yield
return empty_bed_generator()
def make_empty_bigwig(filename, chrom_sizes):
......
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