3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/rbbt/sources/array_express.rb', line 3
def self.tpm(code, organism = Organism.default_code("Hsa"))
url = "https://www.ebi.ac.uk/gxa/experiments-content/#{code}/resources/ExperimentDownloadSupplier.RnaSeqBaseline/tpms.tsv"
io = TSV.traverse Open.open(url), :type => :line, :into => :stream do |line|
next if line =~ /^#/
parts = line.split("\t")
line = parts[0] << "\t" << parts[2..-1] * "\t"
line = "#" + line if line =~ /Gene ID/
line
end
tsv = TSV.open(io, :type => :list, :cast => :to_f)
tsv.key_field = "Ensembl Gene ID"
tsv.namespace = organism
tsv
end
|