Class: Ulla::EnvironmentClassHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/ulla/environment_class_hash.rb

Instance Method Summary collapse

Instance Method Details

#group_by_non_residue_labelsObject



4
5
6
# File 'lib/ulla/environment_class_hash.rb', line 4

def group_by_non_residue_labels
  self.values.group_by { |env| env.label[1..-1] }
end

#group_sizeObject



20
21
22
# File 'lib/ulla/environment_class_hash.rb', line 20

def group_size
  group_by_non_residue_labels.size
end

#groups_sorted_by_residue_labelsObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ulla/environment_class_hash.rb', line 8

def groups_sorted_by_residue_labels
  group_by_non_residue_labels.to_a.sort_by { |env_group|
    env_group[0].gsub('-', '').split('').each_with_index.map { |l, i|
      if i < ($env_features.size - 1)
        $env_features[i + 1].labels.index(l)
      else
        $env_features[i + 2 - $env_features.size].labels.index(l)
      end
    }
  }
end