Examples of Terminology


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

    for(TemplateItem item: getTemplateItems()){
      items.appendChild(item.toElement(doc));
    }
   
    // add terminology
    Terminology term = getTerminology();
    if(term instanceof CompositTerminology){
      for(Terminology t : ((CompositTerminology)term).getTerminologies())
        root.appendChild(t.toElement(doc));
    }else{
      root.appendChild(term.toElement(doc));
    }
    // append template element
    return root;
  }
View Full Code Here

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

  /**
   * create a template from terminology where each root is a template item
   * @param url
   */
  private void addTerminologyTemplate(String url) throws Exception {
    Terminology terminology = new NobleCoderTerminology(url);
   
    // setup template
    Template template = new Template();
    template.setName(terminology.getName()+" Template");
    template.setDescription(terminology.getDescription());
    template.setTerminology(terminology);
    template.getFilters().add(new DocumentFilter("(?s)^BACKGROUND:$.*^$",true));
   
    for(Concept c: terminology.getRootConcepts()){
      TemplateItem item = new TemplateItem();
      /*     
      {
        //TODO: this is a hack for BRAF, let it stay for now?
        public List<ItemInstance> process(TemplateDocument doc) throws TerminologyException {
View Full Code Here

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

  /**
   * @param args
   */
  public static void main(String[] args) throws Exception {
    NobleCoderTerminology.setPersistenceDirectory(new File("/home/tseytlin/Data/Terminologies/IndexFinder"));
    Terminology terminology = new NobleCoderTerminology("TIES_Pathology");
    //Terminology terminology = new NobleCoderTerminology("NCI_Thesaurus");
    PathHelper ph = new PathHelper(terminology);
    //ph.createAncestryCache();
    for(String text: Arrays.asList("melanoma","nevus","skin","margin")){
      for(Concept c: terminology.search(text)){
        long t = System.currentTimeMillis();
        // lookup paths
       
        List<ConceptPath> path = ph.getPaths(c);
        t = System.currentTimeMillis()-t;
View Full Code Here

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

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

    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

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

  }
 
 
 
  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

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

  /**
   * 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

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

          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

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

    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

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

          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
TOP
Copyright © 2018 www.massapi.com. 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.