Skip to content

Commit

Permalink
Merge branch 'hotfix/reader'
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranOMara committed Dec 15, 2018
2 parents c836486 + 3745ff9 commit 97f67ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/reader.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Check if the record data is in the four column BED format.
function isLikeRecord(line::String) :: Bool
return occursin(r"^\s*\S*(?=[A-Za-z])\S*\s+(\d+)\s+(\d+)\s+(\S*\d)\s*$", line) # Note: is like a record.
return occursin(r"^\s*\S*(?=[A-Za-z0-9])\S*\s+(\d+)\s+(\d+)\s+(\S*\d)\s*$", line) # Note: is like a record.
end

function isBrowser(line::String) :: Bool
Expand Down
5 changes: 4 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const line9 = "chr19 49304400 49304700 1.00"
const line_other_space = "2R 8225773 8226043 -0.426032509896305"
const line_other = "2R 8225773 8226043 -0.426032509896305"

const line_other_chrom = "1 3006665 3006673 2"

# Varaiations of line 1.
const line1_2 = "chr19 49302000 49302300 -1.0" # tab separated.
const line1_3 = "chr19 49302000 49302300 -1.0" # mix of tabs and spaces.
Expand Down Expand Up @@ -157,7 +159,7 @@ end #testset I/O
@test Bedgraph.isComment(Bag.comment1)
@test Bedgraph.isBrowser(Bag.browser3)

@test Bedgraph.isLikeRecord("1 2 3 4") == false
@test Bedgraph.isLikeRecord("1 2 3 4") == true
@test Bedgraph.isLikeRecord(Bag.parameter_line) == false
@test Bedgraph.isLikeRecord(Bag.parameter_line_4) == false
@test Bedgraph.isLikeRecord(Bag.parameter_line_min) == false
Expand All @@ -173,6 +175,7 @@ end #testset I/O

@test Bedgraph.isLikeRecord(Bag.line_other_space) == true
@test Bedgraph.isLikeRecord(Bag.line_other) == true
@test Bedgraph.isLikeRecord(Bag.line_other_chrom) == true

end #testset Matching

Expand Down

0 comments on commit 97f67ba

Please sign in to comment.