Functions to read and write the BED (Browser Extensible Data) format. See http://genome.ucsc.edu/FAQ/FAQformat#format1 for the detail BED specifications.
Functions to read and write the BED (Browser Extensible Data) format. See http://genome.ucsc.edu/FAQ/FAQformat#format1 for the detail BED specifications.
(complement-fields refs xs)
Takes a sequence of maps containing :name and :len keys (representing chromosome's name and length, resp.) and a sequence of BED fields, and returns a lazy sequence that is the complement of the BED sequence.
The input sequence will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the BED sequence contains only valid regions, and thus :start <= :end holds for each region. Make sure yourself the BED sequence meets the condition, or the function may return a wrong result.
Takes a sequence of maps containing :name and :len keys (representing chromosome's name and length, resp.) and a sequence of BED fields, and returns a lazy sequence that is the complement of the BED sequence. The input sequence will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the BED sequence contains only valid regions, and thus :start <= :end holds for each region. Make sure yourself the BED sequence meets the condition, or the function may return a wrong result.
(intersect-fields xs ys)
Returns a lazy sequence that is the intersection of the two BED sequences.
The input sequences will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the input sequences contain only valid regions, and thus :start <= :end holds for each region. Make sure yourself the input sequences meet the condition, or the function may return a wrong result.
Returns a lazy sequence that is the intersection of the two BED sequences. The input sequences will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the input sequences contain only valid regions, and thus :start <= :end holds for each region. Make sure yourself the input sequences meet the condition, or the function may return a wrong result.
(merge-fields xs)
Sort and merge overlapped regions. Currently, this function affects only :end and :name fields.
Sort and merge overlapped regions. Currently, this function affects only :end and :name fields.
(read-fields rdr)
Returns a lazy sequence of normalized BED fields.
Returns a lazy sequence of normalized BED fields.
(reader f)
Returns an open cljam.io.bed.BEDReader of f. Should be used inside with-open to ensure the reader is properly closed.
Returns an open cljam.io.bed.BEDReader of f. Should be used inside with-open to ensure the reader is properly closed.
(sort-fields xs)
Sort BED fields based on :chr, :start and :end. :chr with common names come first, in order of (chr1, chr2, ..., chrX, chrY, chrM). Other chromosomes follow after in lexicographic order.
Sort BED fields based on :chr, :start and :end. :chr with common names come first, in order of (chr1, chr2, ..., chrX, chrY, chrM). Other chromosomes follow after in lexicographic order.
(subtract-fields xs ys)
Returns a lazy sequence that is the result of subtracting the BED fields in the sequence ys from the sequence xs.
The input sequences will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the input sequences contain only valid regions, and thus :start <= :end holds for each region. Make sure yourself the input sequences meet the condition, or the function may return a wrong result.
Returns a lazy sequence that is the result of subtracting the BED fields in the sequence ys from the sequence xs. The input sequences will first be sorted with sort-fields, which may cause an extensive memory use for ones with a large number of elements. Note also that this function assumes the input sequences contain only valid regions, and thus :start <= :end holds for each region. Make sure yourself the input sequences meet the condition, or the function may return a wrong result.
(write-fields wtr xs)
Write sequence of BED fields to writer.
Write sequence of BED fields to writer.
(writer f)
Returns an open cljam.io.bed.BEDWriter of f. Should be used inside with-open to ensure the writer is properly closed.
Returns an open cljam.io.bed.BEDWriter of f. Should be used inside with-open to ensure the writer is properly closed.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close