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 file reader/writer #20
Conversation
Is "zero-based index" a typo for "one-based index"? This change is destructive as you say. I think this PR should be merged after release of v0.1.6 (and bump up to v0.2.0-SNAPSHOT). |
Sorry about the mistake 🙇 It's fixed now.
LGTM:+1: I have some projects depending on v0.1.6-SHAPSHOT.. |
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've added some comments for code format. Functions of BED I/O have no problems.
@@ -0,0 +1,135 @@ | |||
(ns cljam.bed | |||
(:require [clojure.string :as str] |
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 cstr
as an aliase of clojure.string
in cljam project.
(defn- normalize [m] | ||
"Normalize BED fields. | ||
BED fields are stored in format: 0-origin and inclusive-start / exclusive-end. | ||
This function converts the coordinate into cljam style: 1-origin and inclusice-start / inclusive-end." |
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.
arg vec and docstring are reverse.
|
||
(defn- denormalize [m] | ||
"De-normalize BED fields. | ||
This is an inverse function of normalize." |
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.
arg vec and docstring are reverse.
75f9b3e
to
3d331b5
Compare
3d331b5
to
d4f2ba0
Compare
Thank you for your advice. I've fixed them and rebased. |
Thank you for the fixes. I've just merged this PR. |
BED file reader/writer
Added BED file reader.
Format of BED file is based on https://genome.ucsc.edu/FAQ/FAQformat#format1
e.g.
Range-based query
BED file uses zero-based index and end index is exclusive,
which means that
chr1 0 3
represents first three bases of chromosome 1.Currently, cljam uses one-based index and inclusive end for BAM APIs,
zero-based index and exclusive end for FASTA and pileup APIs.
To provide consistent APIs, this PR unifies the APIs as
zero-basedone-based index and inclusive end.Thus,
{:chr "chr1" :start 1 :end 3}
represents first three bases of chromosome 1.Please be aware that this is a destructive change!