Sha256: 320d93396a49827f003c038f67070d6b63f3b2e002dd032037b88dc310a71cef

Contents?: true

Size: 1.54 KB

Versions: 36

Compression:

Stored size: 1.54 KB

Contents

require 'rbbt-util'
require 'rbbt/resource'

module Intogen
  extend Resource
  self.subdir = 'share/databases/Intogen'

  #def self.organism(org="Hsa")
  #  Organism.default_code(org)
  #end

  #self.search_paths = {}
  #self.search_paths[:default] = :lib


  Intogen.claim Intogen['.source']["intogen_driver_mutations_catalog.zip"], :proc do |filename|
    raise "Download the fila at 'https://www.intogen.org/downloads?file=/repository/downloads/intogen_driver_mutations_catalog-2016.5.zip' into '#{filename}'"
  end

  Intogen.claim Intogen.driver_mutations_catalog, :proc do |filaname|
    all_tsv = nil
    TmpFile.with_file do |tmpdir|
      Open.mkdir tmpdir
      Misc.in_dir tmpdir do 
        `unzip '#{Intogen['.source']["intogen_driver_mutations_catalog.zip"].produce.find}'`
        Dir.glob("./*/mutation_analysis.tsv").each do |file|
          cohort = File.basename(File.dirname(file))

          parser = TSV::Parser.new file, :header_hash => '', :type => :list
          if all_tsv.nil?
            all_tsv = TSV.setup({}, :key_field => 'Mutation ID', :fields => ["Sample", "Cohort", "Genomic Mutation"] + parser.fields, :type => :list) 
          end

          TSV.traverse parser, :into => all_tsv do |sample, values|
            chr, strand, pos, ref, alt, *rest = values
            mutation = [chr, pos, alt] * ":"
            id = [sample, mutation] * "_"
            [id, [sample, cohort, mutation] + values]
          end
        end
      end
    end
    all_tsv.to_s
  end
end

iif Intogen.driver_mutations_catalog.produce.find if __FILE__ == $0

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
rbbt-sources-3.4.2 lib/rbbt/sources/intogen.rb
rbbt-sources-3.4.1 lib/rbbt/sources/intogen.rb
rbbt-sources-3.3.0 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.16 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.15 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.14 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.13 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.12 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.11 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.10 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.9 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.8 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.6 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.4 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.3 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.2 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.1 lib/rbbt/sources/intogen.rb
rbbt-sources-3.2.0 lib/rbbt/sources/intogen.rb
rbbt-sources-3.1.52 lib/rbbt/sources/intogen.rb
rbbt-sources-3.1.51 lib/rbbt/sources/intogen.rb