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

BED reader/writer #73

Merged
merged 4 commits into from
May 10, 2017
Merged

BED reader/writer #73

merged 4 commits into from
May 10, 2017

Conversation

alumi
Copy link
Member

@alumi alumi commented May 9, 2017

Added reader/writer for BED file format.
We can now read/write BED file compressed with gzip and bzip2.

@codecov
Copy link

codecov bot commented May 9, 2017

Codecov Report

Merging #73 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #73      +/-   ##
==========================================
+ Coverage    82.8%   82.92%   +0.12%     
==========================================
  Files          59       59              
  Lines        3774     3795      +21     
  Branches      410      409       -1     
==========================================
+ Hits         3125     3147      +22     
  Misses        239      239              
+ Partials      410      409       -1
Impacted Files Coverage Δ
src/cljam/bed.clj 96.58% <100%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c159e0...7b683d7. Read the comment docs.

@alumi alumi requested a review from totakke May 9, 2017 09:27
Copy link
Member

@totakke totakke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Please fix a few trivial matters.

@@ -67,6 +86,25 @@
(defn- serialize-bed
"Serialize bed fields into string."
[m]
{:pre [(and (:chr m) (:start m) (:end m))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and is not needed because all items in :pre vector are combined with and.

(if-let [xs (:block-starts m)] (= (+ (last xs) (last (:block-sizes m))) (- (:end m) (:start m))) true)
;; The final blockStart position plus the final blockSize value must equal chromEnd.
(if-let [xs (:block-starts m)] (apply <= (mapcat (fn [a b] [a (+ a b)]) xs (:block-sizes m))) true)
;; Blocks may not overlap.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a comment should be placed just before a related predicate.

{:pre [;; First 3 fields are required.
       (:chr m) (:start m) (:end m)
       ;; The chromEnd base is not included in the display of the feature.
       (< (:start m) (:end m))
       ...
       ]}

(close [this]
(.close ^Closeable (.writer this))))

(defn ^BEDReader reader [f]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add docstring. Also writer.

@alumi alumi force-pushed the feature/bed-reader-writer branch from 567b21b to 7b683d7 Compare May 10, 2017 04:30
@alumi
Copy link
Member Author

alumi commented May 10, 2017

Thank you for the review! I've added a commit.

@alumi alumi merged commit 76c315e into master May 10, 2017
@alumi alumi deleted the feature/bed-reader-writer branch May 10, 2017 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants