Class: GlyDevKit::WURCSFramework
- Inherits:
-
Object
- Object
- GlyDevKit::WURCSFramework
- Defined in:
- lib/glydevkit/wurcs_frame_work.rb
Instance Method Summary collapse
-
#get_anomeric_status(a_o_backbone) ⇒ String?
Retrieves the anomeric status of a backbone.
-
#get_ring_type(a_o_backbone) ⇒ String?
Retrieves the ring type of a backbone.
-
#getWURCSMass(w) ⇒ Float?
Calculates the mass of a WURCS data string.
-
#to_graph(w) ⇒ Object?
Converts WURCS data to a graph object.
-
#validator(w, maxbranch) ⇒ Hash
Validates a WURCS data string.
Instance Method Details
#get_anomeric_status(a_o_backbone) ⇒ String?
Retrieves the anomeric status of a backbone.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/glydevkit/wurcs_frame_work.rb', line 62 def get_anomeric_status(a_o_backbone) a_o_backbone.get_backbone_carbons.each do |t_o_bc| return "archetype_anomer" if %w[u U].include?(t_o_bc.get_descriptor.get_char.chr) end case a_o_backbone.get_anomeric_symbol.chr when 'x' "anomer_unknown" when 'a' "anomer_alpha" when 'b' "anomer_beta" else a_o_backbone.get_anomeric_position != 0 ? "openchain" : nil end end |
#get_ring_type(a_o_backbone) ⇒ String?
Retrieves the ring type of a backbone.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/glydevkit/wurcs_frame_work.rb', line 84 def get_ring_type(a_o_backbone) a_o_backbone.get_backbone_carbons.each do |t_o_bc| return "archetype_ringtype" if %w[u U].include?(t_o_bc.get_descriptor.get_char.chr) end a_o_backbone.get_edges.each do |edge| next unless edge.is_anomeric && edge.get_modification.is_ring ring_start = edge.get_linkages[0].get_backbone_position ring_end = edge.get_modification.get_edges[1].get_linkages[0].get_backbone_position ring_size = ring_end - ring_start return case ring_size when 6 then "octanose" when 5 then "septanose" when 4 then "pyranose" when 3 then "furanose" when 2 then "oxetose" when 1 then "oxirose" end end nil end |
#getWURCSMass(w) ⇒ Float?
Calculates the mass of a WURCS data string.
112 113 114 115 116 117 118 119 |
# File 'lib/glydevkit/wurcs_frame_work.rb', line 112 def getWURCSMass(w) importer = WURCSImporter.new wurcs_array = importer.extractWURCSArray(w) WURCSMassCalculator.calcMassWURCS(wurcs_array) rescue WURCSException, WURCSMassException, StandardError => e e.printStackTrace nil end |
#to_graph(w) ⇒ Object?
Converts WURCS data to a graph object.
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/glydevkit/wurcs_frame_work.rb', line 43 def to_graph(w) wgn = WURCSGraphNormalizer.new begin factory = WURCSFactory.new(w) graph = factory.getGraph wgn.start(graph) graph rescue WURCSException => e e.printStackTrace nil end end |
#validator(w, maxbranch) ⇒ Hash
Validates a WURCS data string.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/glydevkit/wurcs_frame_work.rb', line 20 def validator(w, maxbranch) validator = WURCSValidator.new validator.setMaxBranchCount(maxbranch) validator.start(w) report = validator.getReport() { "message" => { "VALIDATOR" => ["WURCSFramework-1.2.14"], "WARNING" => report.hasWarning(), "ERROR" => report.hasError(), "UNVERIFIABLE" => report.hasUnverifiable() }, "StandardWURCS" => report.standard_string(), "RESULTS" => report.getResults() } end |