Skip to content

Commit 26e6a17

Browse files
committed
Fix skipping of empty lines in gtf_filter_by_attribute_values_list tool
Introduced in #11365 .
1 parent bafa6de commit 26e6a17

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/filters/gff/gtf_filter_by_attribute_values_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ def gff_filter(gff_file, attribute_name, ids_file, output_file):
5555
# Filter GFF file using ids.
5656
with open(output_file, "w") as output, open(gff_file) as ingff:
5757
for line in ingff:
58-
if not line or line.startswith("#"):
58+
if not line.rstrip() or line.startswith("#"):
5959
output.write(line)
6060
continue
6161
fields = line.split("\t")
62+
assert len(fields) == 9, f"Line should have exactly 9 fields: {line}"
6263
attributes = parse_gff_attributes(fields[8])
6364
if attribute_name in attributes and attributes[attribute_name] in ids_dict:
6465
output.write(line)

0 commit comments

Comments
 (0)