-
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 support for generating CSI file from BCF. #196
Conversation
Codecov Report
@@ Coverage Diff @@
## master #196 +/- ##
==========================================
+ Coverage 86.85% 86.90% +0.04%
==========================================
Files 77 77
Lines 6223 6246 +23
Branches 520 519 -1
==========================================
+ Hits 5405 5428 +23
- Misses 298 299 +1
+ Partials 520 519 -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.
Thanks for the update!!
src/cljam/algo/bcf_indexer.clj
Outdated
@@ -0,0 +1,18 @@ | |||
(ns cljam.algo.bcf-indexer |
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.
Merge this with cljam.algo.vcf-indexer
and make create-index
work with both VCF/BCF
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.
Thankyou,I merged bcf-indexer and vcf-indexer.
d85bc3e
to
e03fd13
Compare
e03fd13
to
a4e482c
Compare
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.
It seems like the linter action is not working. Please check it later 🙏
src/cljam/algo/vcf_indexer.clj
Outdated
names (->> (map :chr offsets) | ||
(concat (->> (.meta-info ^VCFReader r) | ||
(concat (->> (.meta-info r) |
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 causes a reflection. Use cljam.io.vcf/meta-info
instead.
src/cljam/algo/vcf_indexer.clj
Outdated
(:require [cljam.io.csi :as csi] | ||
[cljam.io.util :as io-util] | ||
[cljam.io.vcf :as vcf]) | ||
(:import cljam.io.vcf.reader.VCFReader)) |
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.
Unused
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 use "io-util/vcf-reader?" to get variant-file-type.
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.
So, it’s okay to remove the line..?
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.
Sorry. I misunderstood that io-util is unnecessary.
src/cljam/io/bcf/reader.clj
Outdated
(map-indexed (fn [index contig] | ||
[(:id contig) index])) | ||
(into {})) | ||
kws (mapv keyword (drop 8 (.header rdr))) |
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.
Unused
src/cljam/io/bcf/reader.clj
Outdated
(when (pos? (.available input-stream)) | ||
(when-let [line (read-data-line-buffer input-stream)] | ||
(let [end-pointer (.getFilePointer input-stream)] | ||
(let [{:keys [chr pos ref info]} (parse-fn line) |
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.
Redundant let
test/cljam/algo/vcf_indexer_test.clj
Outdated
(do (vcf-indexer/create-index test-bcf-complex-file | ||
tmp-csi-file {:shift 14 :depth 5}) | ||
(let [computed ^CSI (csi/read-index tmp-csi-file) | ||
csi ^CSI (csi/read-index tmp-csi-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.
csi ^CSI (csi/read-index tmp-csi-file)] | |
csi ^CSI (csi/read-index test-bcf-complex-csi-file)] |
I'm sorry. I fix sources that are pointed. |
208e0cd
to
12e2dbc
Compare
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.
LGTM 👍
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 the PR! Your code basically looks good 👍
Just added a comment on type hints.
test/cljam/algo/vcf_indexer_test.clj
Outdated
(testing "bcf" | ||
(with-open [r (vcf/reader test-bcf-changed-chr-order-file)] | ||
(let [file-offsets (vcf/read-file-offsets r) | ||
computed |
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.
Add a type hint ^CSI
to the declaration of computed
, and you won't need to type hint every subsequent use-site of the name. Try not to use type hints too much and keep your code concise 💪 The same goes for some of the test cases below.
Thank you for pointing. I fixed them. |
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.
LGTM 👍 I will merge it now. Thank you for working on the PR!
Thank you for the reviewing. |
This PR is to add function that creates a CSI from BCF.
It is almost the same as #190 (creating CSI from VCF).