lib/rbbt/sources/organism.rb in rbbt-sources-3.0.10 vs lib/rbbt/sources/organism.rb in rbbt-sources-3.0.11
- old
+ new
@@ -4,14 +4,28 @@
module Organism
extend Resource
self.pkgdir = "rbbt"
self.subdir = "share/organisms"
- def self.installable_organisms
+ def self.organism_codes(organism = nil)
+ if organism
+ Rbbt.etc.allowed_biomart_archives.list.collect{|build| [organism, build] * "/" }
+ else
+ Rbbt.etc.organisms.list.collect{|organism|
+ organism =~ /\// ? organism : Rbbt.etc.allowed_biomart_archives.list.collect{|build| [organism, build] * "/" }
+ }.flatten.compact.uniq
+ end
+ end
+
+ def self.installed_organisms
Rbbt.share.install.Organism.find.glob('???').collect{|f| File.basename(f)}
end
+ def self.installable_organisms
+ self.installed_organisms
+ end
+
def self.allowed_biomart_archives
Rbbt.etc.allowed_biomart_archives.exists? ?
Rbbt.etc.allowed_biomart_archives.list :
nil
end
@@ -27,15 +41,22 @@
def self.hg_build(organism)
require 'rbbt/sources/ensembl_ftp'
raise "Only organism 'Hsa' (Homo sapiens) supported" unless organism =~ /^Hsa/
- return 'hg19' unless organism =~ /\//
+ return 'hg20' unless organism =~ /\//
date = organism.split("/")[1]
release = Ensembl.releases[date]
- release.sub(/.*-/,'').to_i > 54 ? 'hg19' : 'hg18'
+ release_number = release.sub(/.*-/,'').to_i
+ if release_number <= 54
+ 'hg18'
+ elsif release_number <= 70
+ 'hg19'
+ else
+ 'hg20'
+ end
end
def self.liftOver(positions, source, target)
source_hg = hg_build(source)