rbbt-study 0.2.18 → 0.2.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODQxZGJlNDBmN2M4N2E3MDcwYzAyZDQwNTlhYjZkYmRjNTBmZDY2ZQ==
4
+ ODg5YzNlNzAzMDA4NjUzNzNlYTc0MTIxMzI3MmZiNzI4N2VhZjg0Yw==
5
5
  data.tar.gz: !binary |-
6
- NmVlODQ5ZWFiNGE3NDBiOGNmMTI3Mzc4NDgzZWFhYTQ3M2Q5ZmY4Yw==
6
+ ZWNmM2VjZjJhY2FkMGYzM2JlOWMxYjBiYTEwNjA1YjVlYzM2N2Y0Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Njc1NDhmMzQ5NDc0ZTA0YjRjMGEzMzRiNzk1OGI3YjZmMGFlMzkyYTk4ZGFj
10
- ZjQ3Y2Y5NWVjMDZhZjY5YjE4YzczZWVhYjZmYmI1ZjViZDQ4ZjVkM2E0Nzc4
11
- NTllMDE4ODFiYWRjYzAxYjUxYzgyYzI5YjY4YWExNzQxYzk1NDU=
9
+ MmU0NjNlZGY0YzM3ZTBkYjQ1YWEyNjNkNzE0ODdkYTE4OWE1MzUxZjg4Y2Ji
10
+ NzRjOGZmODI5MTUxMzJlYzMyOWZlOTA0MjBmNmQyZDM1MDhiMzA4MTc1ZDgx
11
+ ZmJjZTYwMzM4ZTU3NzQzMzQ5ZWNiNTIwZTk1NjhjNzM0ZDYxMWQ=
12
12
  data.tar.gz: !binary |-
13
- MDI0YmVlZmE4NDJhOTFmMWJiOWM0ZWE5ZWQ2NmM5NTZiYjk0N2UxM2YyZTRj
14
- NGI2YzIzMzhmODZiYzVkNDdjYzQyODQxMzlhZjY4Njc3NGZhNDM3ZDM0OTE4
15
- ZWY1MWEyZTU3ODkxMDdiNGMyZTc5YzA5Yjc4MTllMjExOWIwOGY=
13
+ MzUwNzIzYWM0MDE1MjNhNTFjMGZkYTdjNzU5ZjVhNDcwZGNiY2NlZGUwYTBj
14
+ ODY5ODZhMzMxMDUzOGFhM2M4ZDU4YzM2MzVhMTZkN2QyN2I1YzEwOTg1ZDJk
15
+ ZDNiYmM0OTExOWZhMjJmOGYxMmRlMDJmZTYxYTMyMDRkMWMzOTA=
@@ -0,0 +1,39 @@
1
+ require 'rbbt/knowledge_base'
2
+ require 'rbbt/workflow'
3
+ Workflow.require_workflow "Genomics"
4
+ require 'rbbt/entity/study'
5
+ require 'rbbt/entity/study/cnv'
6
+ require 'rbbt/entity/gene'
7
+ require 'rbbt/entity/genomic_mutation'
8
+
9
+ module Study
10
+
11
+ self.study_registry[:sample_cnv_genes] = Proc.new{|study,database|
12
+ tsv = TSV.setup({}, :key_field => "Sample", :fields => ["Ensembl Gene ID", "CNV Variation"], :type => :double, :namespace => study.organism)
13
+
14
+ all_cnvs = CNV.setup(study.cnv_cohort.values.flatten, study.organism)
15
+ cnv2genes = Misc.process_to_hash(all_cnvs){|cnvs| cnvs.genes }
16
+
17
+ study.cnv_cohort.each do |sample,cnvs|
18
+ Log.info sample
19
+ genes = []
20
+ variations = []
21
+ cnvs.variation.zip(cnv2genes.chunked_values_at(cnvs)).each_with_index do |p,i|
22
+ variation, genes = p
23
+ Annotated.purge(genes).each{|gene| genes << gene; variations << variation }
24
+ end
25
+ tsv[sample] = [genes.to_a, variations.to_a]
26
+ end
27
+
28
+ tsv
29
+ }
30
+
31
+ end
32
+
33
+ if __FILE__ == $0
34
+ Workflow.require_workflow "ICGC"
35
+ Study.study_dir = ICGC.root
36
+ s = Study.setup("Glioblastoma_Multiforme-TCGA-US")
37
+ puts s.knowledge_base.get_database(:sample_cnv_genes).value_peek
38
+
39
+ end
@@ -11,7 +11,7 @@ module Sample
11
11
  gene_CN = {}
12
12
  cnvs.variation.zip(cnvs.genes).each do |var, genes|
13
13
  next if genes.empty?
14
- genes = genes.clean_annotations
14
+ genes = Annotated.purge genes
15
15
  case var
16
16
  when "loss"
17
17
  genes.each{|gene| gene_CN[gene] = "Lost"}
@@ -39,12 +39,10 @@ module Sample
39
39
  Gene.setup(gene_CN.select{|g,v| v == "Gained"}.collect{|g,v| g}, "Ensembl Gene ID", self.study.organism)
40
40
  end
41
41
 
42
-
43
42
  property :lost_genes => :single do
44
43
  Gene.setup(gene_CN.select{|g,v| v == "Lost"}.collect{|g,v| g}, "Ensembl Gene ID", self.study.organism)
45
44
  end
46
45
 
47
-
48
46
  property :cnv_genes => :single do
49
47
  return nil if lost_genes.nil? or gained_genes.nil?
50
48
  organism = study.metadata[:organism]
@@ -29,7 +29,7 @@ module StudyWorkflow
29
29
  mutation_genes = Misc.process_to_hash(all_mutations){|all_mutations| all_mutations.genes}
30
30
  mutation_affected_genes = Misc.process_to_hash(all_mutations){|all_mutations| all_mutations.affected_genes}
31
31
  if all_mutations.length < 5000
32
- log :damaged_genes, "Computing genes damaged genes"
32
+ log :damaged_genes, "Computing damaged genes"
33
33
  mutation_damaged_genes = Misc.process_to_hash(all_mutations){|all_mutations| all_mutations.damaged_genes}
34
34
  else
35
35
  mutation_damaged_genes = Misc.process_to_hash(all_mutations){|all_mutations| [nil] * all_mutations.length}
@@ -51,8 +51,6 @@ pathway.enrichment = rbbt.ruby.substitutions(
51
51
 
52
52
  study = Study.setup('STUDY')
53
53
 
54
- Log.severity = 0
55
-
56
54
  pathways = study.job(:mutation_pathway_enrichment, study, :baseline => :pathway_base_counts, :database => '#{database}', :fdr => false).run.select('p-value'){|pvalue| pvalue = pvalue.first.to_f if Array === pvalue; pvalue < 0.2}
57
55
  pathways.add_field 'Name' do |pathway, values|
58
56
  [pathway.name]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-study
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-27 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem add the study entity with suport for NGS, Microarray and other
14
14
  types of data
@@ -24,6 +24,7 @@ files:
24
24
  - lib/rbbt/entity/study.rb
25
25
  - lib/rbbt/entity/study/cnv.rb
26
26
  - lib/rbbt/entity/study/cnv/genes.rb
27
+ - lib/rbbt/entity/study/cnv/knowledge_base.rb
27
28
  - lib/rbbt/entity/study/cnv/samples.rb
28
29
  - lib/rbbt/entity/study/enrichment.rb
29
30
  - lib/rbbt/entity/study/expression.rb