-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add protocols for I/O APIs. #78
Conversation
Codecov Report
@@ Coverage Diff @@
## master #78 +/- ##
==========================================
- Coverage 82.76% 82.07% -0.69%
==========================================
Files 59 59
Lines 3840 3922 +82
Branches 422 423 +1
==========================================
+ Hits 3178 3219 +41
- Misses 240 280 +40
- Partials 422 423 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! It's better abstraction. I've added some comments about format. Please check them.
src/cljam/io.clj
Outdated
(reader-path [this] | ||
"Returns the file's absolute path.") | ||
(read [this] [this option] | ||
"Sequentially reads cotents of the file.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cotents
-> contents
src/cljam/io.clj
Outdated
"Returns the file's absolute path.")) | ||
|
||
(defprotocol IRandomReader | ||
(read-in-region [this {:keys [chr start end]}] [this {:keys [chr start end]} option] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use region
consistently instead of {:keys [chr start end]}
in protocol definition.
src/cljam/util.clj
Outdated
|
||
(defn divide-region | ||
"Divides a region [start end] into several chunks with maximum length 'step'. | ||
Returns a lazy sequence of vector." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indent of the second line is incorrect.
(defn divide-region
"Divides a region [start end] into several chunks with maximum length 'step'.
Returns a lazy sequence of vector."
...)
is correct.
Readers w/o index should not implement
|
Oh, I forgot to add one comment. Please unstage change of |
b708d1d
to
60f08b0
Compare
Thank you for your review! For
Commits are rebased so that |
Thanks! Please wait merge until v0.3.1 release because of breaking changes. |
This PR includes breaking changes
Summary
This PR adds new protocols for I/O classes for the sake of
Changes
cljam.io
{:chr "chr1", :start 1, :end 3}
and option as another map if required.cio
forclojure.java.io
andio
forcljam.io
[& {:keys [...]}]
with map[{:keys [...]}]
Problems
read-in-region
reads contents in certain region.In current implementation, readers without index (SAM, VCF...) are still supporting the function by
filter
.Even though they will warn about performance, I'm still thinking if we should disable this.