Module: Sylfy::Service::CIR

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

Defined Under Namespace

Modules: REST

Class Method Summary collapse

Class Method Details

.getnames(inchi) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/sylfy/service/cactusncirest.rb', line 43

def getnames(inchi)
	result = []
	inchi = Rubabel[inchi, :inchi].to_s(:inchikey) if inchi =~ /^InChI\=1S\/[A-Za-z0-9]+(\/[cnpqbtmsih][A-Za-z0-9\-\+\(\)\,]+)+$/
	
	if inchi =~ /^[A-Z]{14}\-[A-Z]{10}(\-[A-N])?/
		result += REST.perform(inchi, :iupac_name)
		result += REST.perform(inchi, :names)
	end
	
	return result.uniq[0..21]
end