Sha256: 9e73253ae2d704d5e406da57fd23e7af303caa34706f369fc4b8aa35df00e55d

Contents?: true

Size: 1.3 KB

Versions: 15

Compression:

Stored size: 1.3 KB

Contents

module Bio::PolyploidTools
class ChromosomeArm



  @@arm_selection_functions = Hash.new;

  #example format: chr2A
  @@arm_selection_functions[:nrgene] = lambda do | contig_name |
    ret = contig_name[3,2]
    return ret
  end

  @@arm_selection_functions[:first_two] = lambda do | contig_name |
    contig_name.gsub!(/chr/,"")
    ret = contig_name[0,2]       
    return ret
  end

  #Function to parse stuff like: "IWGSC_CSS_1AL_scaff_110"
  #Or the first two characters in the contig name, to deal with 
  #pseudomolecules that start with headers like: "1A"
  #And with the cases when 3B is named with the prefix: v443
  @@arm_selection_functions[:embl] = lambda do | contig_name|

    arr = contig_name.split('_')
    ret = "U"
    ret = arr[2][0,2] if arr.size >= 3
    ret = "3B" if arr.size == 2 and arr[0] == "v443"
    ret = arr[0][0,2] if arr.size == 1   
    return ret
  end

  @@arm_selection_functions[:morex] = lambda do | contig_name |
    ret = contig_name.split(':')[0].split("_")[1];       
    return ret
  end

  @@arm_selection_functions[:scaffold] = lambda do | contig_name |
    ret = contig_name;       
    return ret
  end

  def self.getArmSelection(name)
    @@arm_selection_functions[name.to_sym]
  end

  def self.getValidFunctions
    @@arm_selection_functions.keys.map { |e| e.to_s }
  end
end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bio-polyploid-tools-0.9.7 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.6 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.5 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.4 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.3 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.2 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.1 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.9.0 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.9 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.8 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.7 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.6 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.5 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.4 lib/bio/PolyploidTools/ChromosomeArm.rb
bio-polyploid-tools-0.8.3 lib/bio/PolyploidTools/ChromosomeArm.rb