Changeset 20789


Ignore:
Timestamp:
04/03/10 14:11:33 (2 years ago)
Author:
julie
Message:

temporarily check in a hack for ratmine. if gene.ensemblId exists, use that field instead of gene.primaryIdentifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bio/webapp/src/org/intermine/bio/web/OrthologueLinkController.java

    r20762 r20789  
    2929import org.intermine.bio.logic.OrthologueLinkManager; 
    3030import org.intermine.bio.web.logic.BioUtil; 
     31import org.intermine.util.TypeUtil; 
    3132import org.intermine.web.logic.bag.BagHelper; 
    3233import org.intermine.web.logic.session.SessionMethods; 
    33  
    3434 
    3535 
     
    4040public class OrthologueLinkController  extends TilesAction 
    4141{ 
    42     private static final String IDENTIFIER_FIELD = "primaryIdentifier"; 
    43      
     42    private String identifierField = "primaryIdentifier"; 
     43    private String alternativeIdentifierField = "ensemblIdentifier"; 
     44 
    4445    /** 
    4546     * {@inheritDoc} 
     
    5758                .getServletContext()); 
    5859 
    59         String identifierList = BagHelper.getIdList(bag, im.getObjectStore(), "", IDENTIFIER_FIELD); 
     60        // if gene.ensemblId is a field, use that instead 
     61        // FIXME this should come from config file instead 
     62 
     63        Class c = null; 
     64        try { 
     65            c = Class.forName(bag.getQualifiedType()); 
     66        } catch (ClassNotFoundException e) { 
     67            // TODO Auto-generated catch block 
     68            e.printStackTrace(); 
     69        } 
     70        if (TypeUtil.getFieldInfo(c, alternativeIdentifierField) != null) { 
     71            identifierField = alternativeIdentifierField; 
     72        } 
     73 
     74 
     75        String identifierList = BagHelper.getIdList(bag, im.getObjectStore(), "", identifierField); 
    6076        request.setAttribute("identifierList", identifierList); 
    61          
     77 
    6278        OrthologueLinkManager orthologueLinkManager 
    6379        = OrthologueLinkManager.getInstance(im, webProperties); 
    64         Collection<String> organismNamesInBag = BioUtil.getOrganisms(im.getObjectStore(), bag,  
     80        Collection<String> organismNamesInBag = BioUtil.getOrganisms(im.getObjectStore(), bag, 
    6581                false, "shortName"); 
    66         Map<Mine, Map<String, Set[]>> mines  
     82        Map<Mine, Map<String, Set[]>> mines 
    6783            = orthologueLinkManager.getMines(organismNamesInBag); 
    68  
    69         // test if mine has organisms in our list 
    7084        if (!mines.isEmpty()) { 
    7185            request.setAttribute("mines", mines); 
Note: See TracChangeset for help on using the changeset viewer.