-
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 many tests / Remove unused codes about slurp
fasta
#60
Add many tests / Remove unused codes about slurp
fasta
#60
Conversation
Codecov Report
@@ Coverage Diff @@
## master #60 +/- ##
=========================================
+ Coverage 73.87% 82.4% +8.53%
=========================================
Files 56 56
Lines 3288 3285 -3
Branches 334 363 +29
=========================================
+ Hits 2429 2707 +278
+ Misses 525 215 -310
- Partials 334 363 +29
Continue to review full report at Codecov.
|
(let [in-file test-sorted-bam-file | ||
out-file (str temp-dir "/deduped.bam")] | ||
(is (not-throw? (dedupe/dedupe in-file out-file))) | ||
;; TODO: check alignments of out-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.
Could you open issues for TODOs in this diff?
Coverage will be increased but almost no code semantics is tested here.
I think we need to track the problem to remind that.
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.
Yes, I will open issue for this, later.
Some tests needs to check result data certainly, but I cannot create those data.
test/cljam/t_bam.clj
Outdated
(with-before-after {:before (prepare-cache!) | ||
:after (clean-cache!)} | ||
(let [rdr (bam/reader test-sorted-bam-file :ignore-index false)] | ||
;; TODO: Does not works? |
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 open an issue for here, too.
I think representing entire region of a single chromosome by {:chr REFNAME}
will be useful.
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.
All right, I will open issue for this, too.
I guess I wrong something, but I didn't know this reason.
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.
Thank you for great contribution. I've added some comments. Awaiting for your fix or response.
test/cljam/t_bam.clj
Outdated
true | ||
(when (and (= (:rname aln1) (:rname aln2)) | ||
(= (:pos aln1) (:pos aln2))) | ||
(recur (rest alns1) (rest alns2)))))))) |
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.
This implementation using loop/recur
is complicated. I think
(defn- shallow= [alns1 alns2]
(= (map #(selece-keys % [:rname :pos]) alns1)
(map #(selece-keys % [:rname :pos]) alns2)))
is more simple. Or are there any reason? (memory usage?). Also pointer=
.
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.
Thanks for review.
I guess sure too, I fixed 88ff657 .
test/cljam/t_bam.clj
Outdated
(deftest bamreader | ||
(with-before-after {:before (do (prepare-cache!) | ||
(spit-bam-for-test temp-file test-sam)) | ||
:after (clean-cache!)} | ||
(let [rdr (bam/reader temp-file :ignore-index true)] | ||
(is (= (io/read-refs rdr) test-sam-refs))))) | ||
(let [rdr (bam/reader temp-file :ignore-index false)] |
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.
BAMReader will not be closed. with-open
should be used instead of let
. (I don't know why original code uses let
...)
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.
I agree, fixed 91ae96e .
test/cljam/t_bam_indexer.clj
Outdated
(is (= (count (io/read-alignments r {:chr "chr1" :start 23000000 :end 24000000 :depth :deep})) | ||
10010)) | ||
(is (= (count (io/read-alignments r {:chr "chr1" :start 23000000 :end 23500000 :depth :deep})) | ||
3806)) |
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.
are
is better than is
because similar codes are repeated.
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.
I fixed e566fee .
test/cljam/t_cli.clj
Outdated
|
||
(defmacro with-out-file | ||
[f & body] | ||
`(binding [*out* (clojure.java.io/writer ~f)] | ||
~@body)) | ||
`(let [os# (clojure.java.io/output-stream ~f) |
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.
io/output-stream
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.
Fixed cf24f13 .
test/cljam/t_cli.clj
Outdated
ps# (PrintStream. os#)] | ||
(try | ||
(System/setOut ps#) | ||
(binding [*out* (clojure.java.io/writer os#)] |
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.
io/writer
test/cljam/t_fasta.clj
Outdated
(is (thrown? java.io.IOException | ||
(let [rdr (fasta/reader test-tabix-file)] | ||
(fasta/read rdr)))) | ||
(let [rdr (fasta/reader test-fa-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.
with-open
instead of let
test/cljam/t_util.clj
Outdated
(is (= (util/str->int "-456") -456)) | ||
(is (= (util/str->int "+789") 789)) | ||
(is (= Integer (type (util/str->int "123")))) | ||
(is (= Long (type (util/str->int "12345678901")))) |
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.
I feel (instance? Long (util/str->int "12345678901"))
is better.
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.
Fixed 74f19e4 .
Thanks for your reviews!
I fixed above problems, are these OK ? |
Perfect, thanks. |
slurp
fn in fasta (Refer Activate cljam.fasta/slurp #58 (comment) )