Five hand-written GTF readers disagree on attribute parsing and malformed rows

Đang mở
#192 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data

Hướng nghiên cứu

Start by reading orfdata/gtf.py and the five reader loops named in the issue, along with the existing GTF tests. Compare their row validation, attribute parsing, and header handling, then check how PyEnsembl provides gtfparse. Done means the five readers use one shared reader and tests cover malformed rows and quoted attribute values consistently.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem

ORFdata reads GTF files with five separate hand-written loops, each with its own attribute regex, row validation and header handling. They disagree on malformed input. A row without nine tab-separated fields is an error in three of them and is silently skipped in two. Attribute parsing uses three different patterns. A fix to any of them (for example the quote handling from #179) lands in one reader only. This is the GTF counterpart of #182 for FASTA. The stack's GTF reader, gtfparse, is already installed through PyEnsembl.

Evidence

Read at d8ab958.

Reader Rows read Attribute pattern Row with ≠ 9 fields
orfdata/gtf.py:145 read_exons (used by viral_installed.py:73) exon (\w+) "([^"]*)" (gtf.py:19) raises
orfdata/ensembl.py:69 _annotation transcript, CDS; reads #!genome-build-accession (\w+) "([^"]*)" raises
orfdata/sources/wang.py:115 _annotation all; reads #! headers (\w+) "([^\"]*)"; (needs the ;) raises
orfdata/sources/ncorf_mammals.py:61 _transcripts (also used by sources/riborf.py:135,201) exon (\S+) "([^"]*)" (ncorf_mammals.py:33) skipped (len(fields) < 9)
orfdata/sources/riborf_native.py:23 _annotations exon imports ncorf_mammals._ATTRIBUTE skipped (len(fields) != 9)

Each loop also opens the file itself: gzip.open in the three source modules, plain open in gtf.read_exons, and ensembl._source in ensembl.py.

Suggested fix

  • Add one public reader to orfdata/gtf.py. For example, read_gtf_rows(path, features=None) would yield (seqname, feature, start, end, strand, attributes) plus the #! header mapping, open plain or gzipped files, use one attribute parser (the inverse of gtf.attributes), and raise on malformed rows with path and line number. Alternatively, build it on gtfparse.read_gtf(..., features=...) and read the #! header lines separately.
  • Rewrite the five loops on top of it, keeping only their source-specific grouping and checks.
  • Add a test with one malformed row and one quoted attribute value that every caller must handle the same way.

https://claude.ai/code/session_01JHJhwj29oDqoeu7TYd34Pi

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
10 giờ 11 phút
Pull request đã merge (30 ngày)
51

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openvax/orfdata

Tất cả issue của openvax/orfdata

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.