Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow bed format to contain browser/track headers #698

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions jcvi/formats/bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ def __init__(self, filename=None, key=None, sorted=True, juncs=False, include=No

for line in must_open(filename):
if (
line[0] == "#"
or (juncs and line.startswith("track name"))
or line.strip() == ""
line.strip() == ""
or line[0] == "#"
or line.startswith("browser ")
or line.startswith("track name")
):
continue
b = BedLine(line)
Expand Down
10 changes: 10 additions & 0 deletions tests/formats/data/custom.bed
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
browser position chr7:4499924-4500043
track name="Covered" description="Agilent SureSelect DNA - Custom Exome_1 - Genomic regions expected to be sequenced" color=0,128,0 visibility=dense db=hg38
chr7 4499923 4500043 7P22.1
chr7 4500475 4501075 7P22.1
chr7 4501706 4501844 7P22.1
chr7 4503679 4503919 7P22.1
chr7 4504362 4505023 7P22.1
chr7 4505688 4505990 7P22.1
chr7 4506376 4506496 7P22.1
chr7 4506928 4507768 7P22.1
10 changes: 10 additions & 0 deletions tests/formats/test_bed.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import os
import os.path as op

from jcvi.formats.bed import summary

def test_summary():
cwd = os.getcwd()
os.chdir(op.join(op.dirname(__file__), "data"))
summary(["custom.bed"])
os.chdir(cwd)
Loading