Module: MartSearch::DataSetUtils

Included in:
DataSet, ProjectUtils
Defined in:
lib/martsearch/data_set_utils.rb

Overview

Utility module for the DataSet class.

Author:

Instance Method Summary (collapse)

Instance Method Details

- (String) allele_type(allele_symbol, design_type = nil)

Helper function to retrieve the allele type

Parameters:

  • allele_symbol (String)

    The allele symbol superscript

  • design_type (String) (defaults to: nil)

    The design type

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/martsearch/data_set_utils.rb', line 32

def allele_type( allele_symbol, design_type=nil )
   case allele_symbol
   when /tm\d+a/ then "Knockout-First - Reporter Tagged Insertion"
   when /tm\d+b/ then "Knockout-First, Post-Cre - Reporter Tagged Deletion"
   when /tm\d+c/ then "Knockout-First, Post-Flp - Conditional"
   when /tm\d+d/ then "Knockout-First, Post-Flp and Cre - Deletion, No Reporter"
   when /tm\d+e/ then "Targeted Non-Conditional"
   when /tm\d+\(/ then "Deletion"
   else
     case design_type
     when nil          then ""
     when /deletion/i  then "Deletion"
     else                   "Knockout-First - Reporter Tagged Insertion"
     end
   end
end

- (String) fix_superscript_text_in_attribute(attribute)

Utility function to clean up superscript text in attributes will convert text between <> tags to <sup></sup>, but leave other HTML formatted text alone.

Parameters:

  • attribute (String)

    The attribute text to be cleaned

Returns:

  • (String)

    The cleaned text



16
17
18
19
20
21
22
23
24
25
# File 'lib/martsearch/data_set_utils.rb', line 16

def fix_superscript_text_in_attribute( attribute )
  if attribute and attribute.match("<.+>.+</.+>")
    # HTML code - leave alone...
  elsif attribute and attribute.match("<.+>")
    match = /(.+)<(.+)>(.*)/.match(attribute);
    attribute = match[1] + "<sup>" + match[2] + "</sup>" + match[3];
  end

  return attribute;
end