Package edu.pitt.dbmi.nlp.noble.terminology

Examples of edu.pitt.dbmi.nlp.noble.terminology.Terminology


    BufferedWriter mrsab = new BufferedWriter(new FileWriter(new File(dir,"MRSAB"),append));
    BufferedWriter mrdef = new BufferedWriter(new FileWriter(new File(dir,"MRDEF"),append));
    BufferedWriter codes = new BufferedWriter(new FileWriter(new File(dir,"CUI2CODE"),append));

    Set<Source> sources = new TreeSet<Source>();
    Terminology term = null;
   
    // iterate over all concepts
    for(Concept c: concepts){
      String cui = getCUI(c.getCode());
      String code = c.getCode();
     
      for(Term t: c.getTerms()){
        // save term information in MRCON
        // C0002871|ENG|P|L0002871|VC|S0352787|ANEMIA|0|
        String lat = t.getLanguage() == null?"ENG":t.getLanguage();
        String ts =  t.isPreferred()?"P":"S";
        String lui = getLUI(t.getText());
        String stt = t.isPreferred()?"PF":"VO";
        String sui = getSUI(t.getText());
        String str = t.getText();
        String lrl = "0";
       
        // write out
        mrcon.write(cui+I+lat+I+ts+I+lui+I+stt+I+sui+I+str+I+lrl+I+"\n");
        mrcon.flush();
       
        // save term information in MRSO
        // C0002871|L0002871|S0013742|SNOMEDCT|OP|154786001|9|
        Source src = t.getSource();
        if(src == null && c.getSources().length > 0)
          src = c.getSources()[0];
        String sab  = src != null?src.getName():"";
        String tty = t.isPreferred()?"PT":"NP";
        //String tty = t.getForm() != null && !compat?t.getForm():"SY";
        String scode = (c.getCodes() != null && src != null && c.getCodes().containsKey(src))?""+c.getCodes().get(src):cui;
       
        mrso.write(cui+I+lui+I+sui+I+sab+I+tty+I+scode+I+lrl+I+"\n");
        mrso.flush();
      }
     
      // save MRDEF information in MRDEF
      // C0002871|CSP|subnormal levels or function of erythrocytes, resulting in symptoms of tissue hypoxia.|
      for(Definition d: c.getDefinitions()){
        Source src = d.getSource();
        if(src == null && c.getSources().length > 0)
          src = c.getSources()[0];
        String sab = src != null?src.getName():"";
        String def = d.getDefinition();
        mrdef.write(cui+I+sab+I+def+I+"\n");
        mrdef.flush();
      }
      // save MRSTY information
      // C0000005|T121|Pharmacologic Substance||
      if(compat){
        String tui = "T071";
        String sty = "Entity";
        mrsty.write(cui+I+tui+I+sty+I+"\n");
        mrsty.flush();
      }else{
        for(SemanticType st: c.getSemanticTypes()){
          String tui = getTUI(st);
          String sty = st.getName();
          mrsty.write(cui+I+tui+I+sty+I+"\n");
          mrsty.flush();
        }
      }
      // add to sources
      Collections.addAll(sources,c.getSources())
     
      // save terminology
      if(term == null && c.getTerminology() != null)
        term = c.getTerminology();
     
      // keep track of translation
      codes.write(cui+"="+code+"\n");
      codes.flush();
    }
   
    // if possible use sources from terminology, cuase they have more data
    if(term != null && term.getSources().length > 0){
      Set<Source> tsources = new TreeSet<Source>();
      for(Source s: term.getSources()){
        if(sources.contains(s)){
          tsources.add(s);
        }
      }
      sources = tsources;
View Full Code Here


    BufferedWriter mrdef = new BufferedWriter(new FileWriter(new File(dir,"MRDEF.RRF"),append));
    BufferedWriter mrsab = new BufferedWriter(new FileWriter(new File(dir,"MRSAB.RRF"),append));
    BufferedWriter codes = new BufferedWriter(new FileWriter(new File(dir,"CUI2CODE"),append));

    Set<Source> sources = new TreeSet<Source>();
    Terminology term = null;
   
    // iterate over all concepts
    for(Concept c: concepts){
      String cui = getCUI(c.getCode());
      String code = c.getCode();
     
      // save term information in MRCONSO
      // C0000005|ENG|P|L0187013|PF|S2192303|Y|A4332670||M0019694|D012711|MSH|EN|D012711|(131)I-MAA|0|N||
      for(Term t: c.getTerms()){
        Source src = t.getSource();
        if(src == null && c.getSources().length > 0)
          src = c.getSources()[0];
        String lat = t.getLanguage() == null?"ENG":t.getLanguage();
        String ts =  t.isPreferred()?"P":"S";
        String lui = getLUI(t.getText());
        String stt = t.isPreferred()?"PF":"VO";
        String sui = getSUI(t.getText());
        String pref = t.isPreferred()?"Y":"N";
        String aui = String.format("A%07d",atomCount);
        String saui = "";
        String scui = "";
        String sdui = "";
        String sab  = src != null?src.getName():"";
        String tty = t.getForm() != null?t.getForm():"SY";
        String scode = (c.getCodes() != null && src != null && c.getCodes().containsKey(src))?""+c.getCodes().get(src):cui;
        String str = t.getText();
        String srl = "0";
        String sup  = "N";
        String cvf = "";
       
        // write out
        mrconso.write(cui+I+lat+I+ts+I+lui+I+stt+I+sui+I+pref+I+aui+I+saui+I+scui+I+sdui+I+sab+I+tty+I+scode+I+str+I+srl+I+sup+I+cvf+"\n");
        mrconso.flush();
        atomCount ++;
      }
      // save MRDEF information in MRDEF
      // C0000107|A3857241|AT22515555||MSH|An ANGIOTENSIN II analog which acts as a highly specific inhibitor of ANGIOTENSIN TYPE 1 RECEPTOR.|N||
      for(Definition d: c.getDefinitions()){
        Source src = d.getSource();
        if(src == null && c.getSources().length > 0)
          src = c.getSources()[0];
        String aui = "";
        String atui = "";
        String satui = "";
        String sab = src != null?src.getName():"";
        String def = d.getDefinition();
        String sup = "N";
        String cvf = "";
        mrdef.write(cui+I+aui+I+atui+I+satui+I+sab+I+def+I+sup+I+cvf+"\n");
        mrdef.flush();
      }
      // save MRSTY information
      // C0000005|T121|A1.4.1.1.1|Pharmacologic Substance|AT16627324||
      for(SemanticType st: c.getSemanticTypes()){
        String tui = getTUI(st);
        String stn = "";
        String sty = st.getName();
        String atui = "";
        String cvf = "";
        mrsty.write(cui+I+tui+I+stn+I+sty+I+atui+I+cvf+"\n");
        mrsty.flush();
      }
      // add to sources
      Collections.addAll(sources,c.getSources())
     
      // save terminology
      if(term == null && c.getTerminology() != null)
        term = c.getTerminology();
     
      // keep track of translation
      codes.write(cui+"="+code+"\n");
      codes.flush();
    }
   
    // if possible use sources from terminology, cuase they have more data
    if(term != null && term.getSources().length > 0){
      Set<Source> tsources = new TreeSet<Source>();
      for(Source s: term.getSources()){
        if(sources.contains(s)){
          tsources.add(s);
        }
      }
      sources = tsources;
View Full Code Here

  }
 
 
 
  private void doAddRoot(){
    final Terminology ont = getSelectedTerminology();
    if(ont == null)
      return;
    if(query == null){
      query = new QueryTool();
      query.setPreferredSize(new Dimension(600,400));
    }
    if(ontologyExplorer == null){
      ontologyExplorer = new OntologyExplorer();
      ontologyExplorer.setPreferredSize(new Dimension(600,400));
    }
   
    query.setTerminology(ont);
    try {
      ontologyExplorer.setRoot(ont.getRootConcepts());
    } catch (TerminologyException e) {
      e.printStackTrace();
    }
   
    JTabbedPane tabs = new JTabbedPane();
View Full Code Here

  /**
   * get selected classes
   * @return
   */
  public Concept [] getSelectedConcepts(){
    Terminology ont = getSelectedTerminology();
    if(ont == null)
      return new Concept [0];
    Concept [] cls = new Concept [rootList.getModel().getSize()];
    for(int i=0;i<cls.length;i++)
      cls[i] = (Concept) rootList.getModel().getElementAt(i);
    try {
      return (cls.length > 0)?cls:ont.getRootConcepts();
    } catch (TerminologyException e) {
      e.printStackTrace();
    }
    return new Concept [0];
  }
View Full Code Here

          String msg = "Not valid ontology file "+ontologyFile.getAbsolutePath();
          console.append("Error: "+msg+"\n");
          JOptionPane.showMessageDialog(main,msg,"Error",JOptionPane.ERROR_MESSAGE);
          return;
        }
        Terminology term = (Terminology) terminologyList.getSelectedItem();
        List<Concept> rootFilter = new ArrayList<Concept>();
        List<SemanticType> semanticTypeFilter = new ArrayList<SemanticType>();
        for(int i=0;i<rootList.getModel().getSize();i++){
          rootFilter.add((Concept)rootList.getModel().getElementAt(i));
        }
View Full Code Here

    text.setBorder(new LineBorder(Color.gray));
   
    String desc = "<b>"+d.getName()+"</b> "+d.getVersion()+"<br>"+d.getURI()+"<hr>"+d.getDescription();
    if(d instanceof Terminology){
      desc +="<hr>";
      Terminology t = (Terminology) d;
      desc += "Languages: "+Arrays.toString(t.getLanguages())+"<br>";
      desc += "Sources: "+Arrays.toString(t.getSources())+"<br>";

    }
    text.setText(desc);
    JOptionPane.showMessageDialog(frame,text,"",JOptionPane.PLAIN_MESSAGE);
View Full Code Here

          explorer.setRoot(ont.getRootClasses());
          explorer.setBusy(false);
        }
      })).start();
    }else if(value instanceof Terminology){
      final Terminology term = (Terminology) value;
      explorer.setBusy(true);
      (new Thread(new Runnable(){
        public void run(){
          try{
            explorer.setRoot(term.getRootConcepts());
          }catch(TerminologyException ex){
            ex.printStackTrace();
          }
          explorer.setBusy(false);
        }
View Full Code Here

   */
  public static void main(String[] args) throws Exception{
    //String server = "http://lexevsapi.nci.nih.gov/lexevsapi50/";
    String server = "http://lexevsapi60.nci.nih.gov/lexevsapi60/";
    //String server = "http://lexevsapi51.nci.nih.gov/lexevsapi51#NCI MetaThesaurus";
    Terminology term = new LexEVSRestTerminology(server);
    long time = System.currentTimeMillis();
    // ZFA_0001234 | C0025202
    System.out.println("--- lookup ---");
    Concept c = term.lookupConcept("C0025202");
    if(c != null){
      c.printInfo(System.out);
    }
    System.out.println("lookup time "+(System.currentTimeMillis()-time));
   
    System.out.println("--- search ---");
   
    time = System.currentTimeMillis();
    Concept [] cs = term.search("melanoma");
    for(Concept i: cs){
      i.printInfo(System.out);
    }
    System.out.println("lookup time "+(System.currentTimeMillis()-time));
  }
View Full Code Here

    l.setConstraints(panel,c);
    panel.setLayout(l);
   
    terminologies = new JComboBox(getTerminologies());
    terminologies.setToolTipText("Select a terminology that will be used for coding");
    Terminology t = repository.getTerminology(DEFAULT_TERMINOLOGY);
    if(t != null)
      terminologies.setSelectedItem(t);
   
    input = new JTextField(30);
    input.setToolTipText("Select a directory with text documents (.txt) to process");
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    Terminology term = new UMLSTerminology("oracle.jdbc.driver.OracleDriver",
        "jdbc:oracle:thin:@lnx01.dbmi.pitt.edu:1521:dbmi01", "umls","dbmi09umls");
   
    // lookup concept
    Concept melanoma = term.lookupConcept("C0025202");
    melanoma.printInfo(System.out);
    term.setFilterSources(term.getSources("NCI"));
    System.out.println("--");
    // do search
    long time = System.currentTimeMillis();
    for(String text: new String [] {"blue tumor"}){
      System.out.println("searching for: "+text);
      for(Concept c: term.search(text)){
        System.out.println(c.getCode()+" "+c.getName());
        c.initialize();
        c.printInfo(System.out);
        System.out.println(c.getCodes());
      }
View Full Code Here

TOP

Related Classes of edu.pitt.dbmi.nlp.noble.terminology.Terminology

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.