Class: Bio::Ngs::Illumina::Project

Inherits:
Meta::Pool show all
Defined in:
lib/bio/ngs/illumina/project.rb

Instance Attribute Summary collapse

Attributes inherited from Meta::Pool

#pool

Attributes inherited from Meta::Data

#metadata

Instance Method Summary collapse

Methods inherited from Meta::Pool

#add, #each, #empty?, #get, #get_by_name, #get_by_tag, #get_by_tag_and_value, #get_by_value, #get_down_to_childer, json_create, #names

Methods included from Enumerable

#average, #sample_variance, #standard_deviation, #sum

Methods inherited from Meta::Data

#==, #[], #has_tag?, #has_value?, json_create, #name, #name=

Constructor Details

#initialize(name, root_dir = ".") ⇒ Project

Returns a new instance of Project.



11
12
13
14
15
16
# File 'lib/bio/ngs/illumina/project.rb', line 11

def initialize(name, root_dir=".")
  super(name)
  @sample_sheet = nil
  @root_dir = root_dir
  [:path]=root_dir
end

Instance Attribute Details

#root_dirObject

Returns the value of attribute root_dir.



10
11
12
# File 'lib/bio/ngs/illumina/project.rb', line 10

def root_dir
  @root_dir
end

#sample_sheetObject

Returns the value of attribute sample_sheet.



10
11
12
# File 'lib/bio/ngs/illumina/project.rb', line 10

def sample_sheet
  @sample_sheet
end

#samples=(value) ⇒ Object

Sets the attribute samples

Parameters:

  • value

    the value to set the attribute samples to.



10
11
12
# File 'lib/bio/ngs/illumina/project.rb', line 10

def samples=(value)
  @samples = value
end

Instance Method Details

#pathObject



20
21
22
# File 'lib/bio/ngs/illumina/project.rb', line 20

def path
  File.join(@root_dir, (name=~/Undetermined_indices/ ? name : "Project_#{name}"))
end

#samples_pathObject



24
25
26
27
28
# File 'lib/bio/ngs/illumina/project.rb', line 24

def samples_path
  @samples.each_key.map do |sample_name|
    @samples[sample_name].filenames_paths
  end.flatten
end

#to_json(*a) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/bio/ngs/illumina/project.rb', line 29

def to_json(*a)
  {
    "json_class"    => self.class.name,
    "name"          => name,
    "sample_sheet"  => sample_sheet,
    "samples"       => samples#each_key.map{|k| samples[k].to_json }
  }.to_json(*a)
end