Module: Annotations::UMLS

Defined in:
lib/MARQ/annotations.rb

Constant Summary collapse

SEMANTIC_TYPES =
"T020,T100,T116,T123,T023,T118,T043,T049,T103,T200,T060,T047,T203,T126,T050,T131,T125,T129,T037,T197,T191,T114,T110,T167,T024"

Class Method Summary collapse

Class Method Details

.OBA(text) ⇒ Object



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
# File 'lib/MARQ/annotations.rb', line 673

def self.OBA(text)

  res = Net::HTTP.post_form(URI.parse('http://rest.bioontology.org/obs_hibernate/annotator'),
                            {
      'longestOnly'=> true, 
      'wholeWordOnly'=> true,
      'withDefaultStopWords' => true,
      'scored' => true,
      'ontologiesToExpand' => 'null', 
      'ontologiesToKeepInResult' => "",
      'levelMax' => 0,
      'levelMin' => 0,
      'textToAnnotate' => text.gsub(/\s/,' '),
      'semanticTypes' => SEMANTIC_TYPES,
      'mappingTypes' => 'null',
      'format' => 'tabDelimited'
  })

  res.body.collect{|l| l.split(/\t/)}.select{|v| v[0].to_i > 0}.collect{|v| v[2].sub(/\W*NOS/,'').downcase}.select{|w| w !~ /^\d+$/}.sort.uniq
end