Module: EBChromatin

Defined in:
lib/rbbt/sources/wgEncodeBroadHmm.rb

Constant Summary collapse

BASE_URL =
'http://hgdownload-test.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeBroadHmm/'
TISSUES =
%w(Gm12878 H1hesc Hmec Hsmm Huvec Hepg2 K562 Nhek Nhlf)

Class Method Summary collapse

Class Method Details

.chromosome(tissue, chr, positions) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rbbt/sources/wgEncodeBroadHmm.rb', line 18

def self.chromosome(tissue, chr, positions)
  list = Array === positions ? positions : [positions]

  file = Rbbt.share.databases.EBChromatin[tissue]
  chromosome_bed = Persistence.persist(file, "EBChromatin[#{tissue}][#{chr}]", :fwt, :chromosome => chr, :range => true) do |file, options|
    chromosome = options[:chromosome]
    tsv = file.tsv(:persist => false, :type => :list, :grep => "^#{chromosome}:\\|^#")
    if tsv.size > 0
      tsv.collect do |gene, values|
        [gene, values.values_at("Start", "End").collect{|p| p.to_i}]
      end
    else
      raise "No chromatin information for chromosome #{ chr } in tissue #{ tissue }"
    end
  end

  list.collect do |pos| chromosome_bed[pos] end
end