Skip to content

Commit

Permalink
use regex to check first line of gff to be more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMainguy committed Mar 6, 2024
1 parent 2e24890 commit ab10eec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ppanggolin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import tempfile
import time
from itertools import zip_longest
import re

import networkx as nx
from importlib.metadata import distribution
Expand Down Expand Up @@ -318,7 +319,7 @@ def detect_filetype(filename: Path) -> str:
first_line = f.readline()
if first_line.startswith("LOCUS "): # then this is probably a gbff/gbk file
return "gbff"
elif first_line.startswith("##gff-version 3") or first_line.startswith("##gff-version 3"): # prodigal gff header has two spaces betwene gff-version and 3...
elif re.match(r"##gff-version\s{1,3}3", first_line): # prodigal gff header has two spaces betwene gff-version and 3... some gff user can have a tab
return 'gff'
elif first_line.startswith(">"):
return 'fasta'
Expand Down

0 comments on commit ab10eec

Please sign in to comment.