Module: Genotype::Cohort
- Extended by:
- Entity, Workflow
- Defined in:
- lib/rbbt/entity/genotype.rb
Constant Summary
Constants included
from Entity
Entity::UNPERSISTED_PREFIX
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.extended(cohort) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/rbbt/entity/genotype.rb', line 31
def self.extended(cohort)
prev_genotype_cohort_extended(cohort) if self.respond_to? :prev_genotype_cohort_extended
cohort.each do |genotype| genotype.extend Genotype unless Genotype === genotype end
cohort.helper :metagenotype do
cohort.metagenotype
end
cohort.helper :samples do
cohort
end
NamedArray.setup(cohort, cohort.collect{|genotype| genotype.jobname})
end
|
.prev_genotype_cohort_extended ⇒ Object
27
|
# File 'lib/rbbt/entity/genotype.rb', line 27
alias prev_genotype_cohort_extended extended
|
Instance Method Details
#jobname ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/rbbt/entity/genotype.rb', line 52
def jobname
if @jobname.nil?
if self.length > 3
@jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname}[0..2] * ", " + " + #{self.length - 3} more"
else
@jobname ||= "Meta-genotype: " + self.collect{|g| g.jobname} * ", "
end
@jobname[100..-1] = " (etc. #{self.length} genotypes)" if @jobname.length > 135
end
@jobname
end
|
64
65
66
67
68
|
# File 'lib/rbbt/entity/genotype.rb', line 64
def metagenotype
organism = self.collect{|g| g.organism}.compact.first
orig_watson = self.collect{|g| g.watson}.compact.first
GenomicMutation.setup(self.dup.flatten, jobname, organism, orig_watson).extend Genotype
end
|
#subset(genotypes) ⇒ Object
47
48
49
50
|
# File 'lib/rbbt/entity/genotype.rb', line 47
def subset(genotypes)
new = self.values_at *(genotypes & fields)
new.extend Cohort
end
|