Module: Sylfy::Service::UniChem

Defined in:
lib/sylfy/service/unichemrest.rb

Defined Under Namespace

Modules: REST

Class Method Summary collapse

Class Method Details

.idbyinchi(inchi) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/sylfy/service/unichemrest.rb', line 90

def idbyinchi(inchi)
	result = []
	inchi = Rubabel[inchi, :inchi].to_s(:inchikey) if inchi =~ Sylfy::Pattern::INCHI
	
	if inchi =~ Sylfy::Pattern::INCHIKEY
		REST.verbose_inchikey(inchi).each do |entry|
			if REST::NAMEURIMAPPING.has_key?(entry["name"].to_sym)
				entry["src_compound_id"].each {|e| result.push("urn:miriam:#{REST::NAMEURIMAPPING[entry["name"].to_sym]}:#{e}")}
			end
		end
	end
	
	return result
end