Show
Ignore:
Timestamp:
08/19/09 05:53:32 (3 years ago)
Author:
jgao
Message:

IDMapperBiomart refactor to clean the interface

Files:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/corelib/src/org/bridgedb/webservice/biomart/IDMapperBiomart.java

    r156 r161  
    1616// 
    1717 
    18 package org.bridgedb.webservice; 
    19  
    20 import java.io.BufferedReader; 
     18package org.bridgedb.webservice.biomart; 
     19 
    2120import java.io.IOException; 
    2221 
    2322import java.util.HashMap; 
    2423import java.util.HashSet; 
    25 import java.util.Iterator; 
    2624import java.util.Map; 
    2725import java.util.Set; 
    28 import java.util.Vector; 
    29  
    30 import javax.xml.parsers.ParserConfigurationException; 
    3126 
    3227import org.bridgedb.AbstractIDMapperCapabilities; 
     
    3732import org.bridgedb.IDMapperException; 
    3833import org.bridgedb.Xref; 
    39 import org.bridgedb.file.IDMappingReaderFromDelimitedReader; 
    40 import org.bridgedb.webservice.biomart.Attribute; 
    41 import org.bridgedb.webservice.biomart.BiomartStub; 
    42 import org.bridgedb.webservice.biomart.Filter; 
    43 import org.bridgedb.webservice.biomart.XMLQueryBuilder; 
    44  
    45 import org.xml.sax.SAXException; 
     34import org.bridgedb.webservice.IDMapperWebservice; 
     35import org.bridgedb.webservice.biomart.util.BiomartClient; 
    4636 
    4737/** 
     
    6151        /** {@inheritDoc} */ 
    6252        public IDMapper connect(String location) throws IDMapperException  { 
    63             // e.g.: transitivity=false,id-type-filter=true@dataset=oanatinus_gene_ensembl 
     53            // e.g.: id-type-filter=true@dataset=oanatinus_gene_ensembl 
    6454            // e.g.: http://www.biomart.org/biomart/martservice?dataset=oanatinus_gene_ensembl 
    65             String baseURL = BiomartStub.defaultBaseURL; 
    66             boolean transitivity = false; 
     55            String baseURL = BiomartClient.defaultBaseURL; 
    6756            boolean idTypeFilter = true; 
    6857             
     
    7867 
    7968            if (config!=null) { 
    80                 String transitivityTag = "transitivity="; 
    81                 idx = config.indexOf(transitivityTag); 
    82                 if (idx!=-1) { 
    83                     String tran = config.substring(idx+transitivityTag.length()); 
    84                     if (tran.toLowerCase().startsWith("true")) { 
    85                         transitivity = true; 
    86                     } else if (tran.toLowerCase().startsWith("false")) { 
    87                         transitivity = false; 
    88                     } else { 
    89                         throw new IDMapperException( 
    90                                 "transivity can only be true or false"); 
    91                     } 
    92                 } 
    93  
    94  
    9569                String idTypeFilterTag = "id-type-filter="; 
    9670                idx = config.indexOf(idTypeFilterTag); 
     
    11791            String martTag = "mart="; 
    11892            idx = param.indexOf(martTag); 
    119             String martName = param.substring(idx+martTag.length()); 
    120  
    121             idx = martName.indexOf("&"); 
     93            String mart = param.substring(idx+martTag.length()); 
     94 
     95            idx = mart.indexOf("&"); 
    12296            if (idx>-1) { 
    123                 martName = martName.substring(0,idx); 
     97                mart = mart.substring(0,idx); 
    12498            } 
    12599 
    126100            String datasetTag = "dataset="; 
    127101            idx = param.indexOf(datasetTag); 
    128             String datasetName = param.substring(idx+datasetTag.length()); 
    129  
    130             idx = datasetName.indexOf("&"); 
     102            String dataset = param.substring(idx+datasetTag.length()); 
     103 
     104            idx = dataset.indexOf("&"); 
    131105            if (idx>-1) { 
    132                 datasetName = datasetName.substring(0,idx); 
    133             } 
    134  
    135             return new IDMapperBiomart(martName, datasetName, baseURL,  
    136                     idTypeFilter, transitivity); 
    137         } 
    138     } 
    139  
    140     private String martName; 
    141     private String datasetName; 
     106                dataset = dataset.substring(0,idx); 
     107            } 
     108 
     109            return new IDMapperBiomart(mart, dataset, baseURL, 
     110                    idTypeFilter); 
     111        } 
     112    } 
     113 
     114    private String mart; 
     115    private String dataset; 
    142116    private BiomartStub stub; 
    143     private boolean transitivity; 
    144117    private boolean idOnlyForTgtDataSource; 
    145118 
    146119    private String baseURL; 
    147120 
    148     private Map<DataSource, Filter> mapSrcDSFilter; 
    149     private Map<DataSource, Attribute> mapSrcDSAttr; 
     121    private Set<DataSource> supportedSrcDs; 
     122    private Set<DataSource> supportedTgtDs; 
    150123 
    151124    /** 
    152125     * Transitivity is unsupported.ID only. ID only for target data sources. 
    153126     * Use default url of BiMart. 
    154      * @param martName name of mart 
    155      * @param datasetName name of dataset 
     127     * @param mart name of mart 
     128     * @param dataset name of dataset 
    156129     * @throws IDMapperException if failed to link to the dataset 
    157130     */ 
    158     public IDMapperBiomart(String martName, String datasetName) throws IDMapperException { 
    159         this(martName, datasetName, null); 
     131    public IDMapperBiomart(String mart, String dataset) 
     132            throws IDMapperException { 
     133        this(mart, dataset, null); 
    160134    } 
    161135 
    162136    /** 
    163137     * Use default url of BiMart. 
    164      * @param martName name of mart 
    165      * @param datasetName name of dataset 
     138     * @param mart name of mart 
     139     * @param dataset name of dataset 
    166140     * @param idOnlyForTgtDataSource id-only option, filter data source ends 
    167141     *        with 'ID' or 'Accession'. 
     
    169143     * @throws IDMapperException if failed to link to the dataset 
    170144     */ 
    171     public IDMapperBiomart(String martName, String datasetName, boolean idOnlyForTgtDataSource, 
    172                 boolean transitivity) throws IDMapperException { 
    173         this(martName, datasetName, null, idOnlyForTgtDataSource, transitivity); 
     145    public IDMapperBiomart(String mart, String dataset, 
     146            boolean idOnlyForTgtDataSource) throws IDMapperException { 
     147        this(mart, dataset, null, idOnlyForTgtDataSource); 
    174148    } 
    175149 
    176150    /** 
    177151     * Transitivity is unsupported.ID only. ID only for target data sources. 
    178      * @param martName name of mart 
    179      * @param datasetName name of dataset 
     152     * @param mart name of mart 
     153     * @param dataset name of dataset 
    180154     * @param baseURL base url of BioMart 
    181155     * @throws IDMapperException if failed to link to the dataset 
    182156     */ 
    183     public IDMapperBiomart(String martName, String datasetName, String baseURL) 
     157    public IDMapperBiomart(String mart, String dataset, String baseURL) 
    184158                throws IDMapperException { 
    185         this(martName, datasetName, baseURL, true); 
    186     } 
    187  
    188     /** 
    189      * Transitivity is unsupported. 
    190      * @param martName name of mart 
    191      * @param datasetName name of dataset 
    192      * @param baseURL base url of BioMart 
    193      * @param idOnlyForTgtDataSource id-only option, filter data source ends 
    194      *        with 'ID' or 'Accession'. 
    195      * @throws IDMapperException if failed to link to the dataset 
    196      */ 
    197     public IDMapperBiomart(String martName, String datasetName, String baseURL, 
    198             boolean idOnlyForTgtDataSource) throws IDMapperException { 
    199         this(martName, datasetName, baseURL, idOnlyForTgtDataSource, false); 
     159        this(mart, dataset, baseURL, true); 
    200160    } 
    201161 
     
    203163     * Construct from a dataset, a database, id-only option and transitivity 
    204164     * option. 
    205      * @param martName name of mart 
    206      * @param datasetName name of dataset 
     165     * @param mart name of mart 
     166     * @param dataset name of dataset 
    207167     * @param baseURL base url of BioMart 
    208168     * @param idOnlyForTgtDataSource id-only option, filter data source ends 
     
    211171     * @throws IDMapperException if failed to link to the dataset 
    212172     */ 
    213     public IDMapperBiomart(String martName, String datasetName, String baseURL, 
    214             boolean idOnlyForTgtDataSource, boolean transitivity) throws IDMapperException { 
    215         this.martName = martName; 
    216         this.datasetName = datasetName; 
     173    public IDMapperBiomart(String mart, String dataset, String baseURL, 
     174            boolean idOnlyForTgtDataSource) throws IDMapperException { 
     175        this.mart = mart; 
     176        this.dataset = dataset; 
    217177        if (baseURL!=null) { 
    218178            this.baseURL = baseURL; 
    219179        } else { 
    220             this.baseURL = BiomartStub.defaultBaseURL; 
     180            this.baseURL = BiomartClient.defaultBaseURL; 
    221181        } 
    222182 
     
    227187        } 
    228188 
    229         try { 
    230             if (!stub.getRegistry().containsKey(martName)) { 
    231                 throw new IDMapperException("Mart not exist."); 
    232             } 
    233  
    234             if (!stub.getAvailableDatasets(martName).contains(stub.getDataset(datasetName))) { 
    235                 throw new IDMapperException("dataset not exist."); 
    236             } 
    237         } catch (IOException e) { 
    238             throw new IDMapperException(e); 
    239         } catch (ParserConfigurationException e) { 
    240             throw new IDMapperException(e); 
    241         } catch (SAXException e) { 
    242             throw new IDMapperException(e); 
    243         } 
    244          
    245         setIDOnlyForTgtDataSource(idOnlyForTgtDataSource); 
    246         setTransitivity(transitivity); 
    247  
    248         mapSrcDSFilter = new HashMap<DataSource, Filter>(); 
    249         mapSrcDSAttr = new HashMap<DataSource, Attribute>(); 
     189        if (!stub.availableMarts().contains(mart)) { 
     190            throw new IDMapperException("Mart not exist."); 
     191        } 
     192 
     193        if (!stub.availableDatasets(mart).contains(dataset)) { 
     194            throw new IDMapperException("dataset not exist."); 
     195        } 
     196 
     197        this.idOnlyForTgtDataSource = idOnlyForTgtDataSource; 
     198 
     199        supportedSrcDs = this.getSupportedSrcDataSources(); 
     200        supportedTgtDs = this.getSupportedTgtDataSources(); 
    250201         
    251202        cap = new BiomartCapabilities(); 
     
    253204 
    254205    /** 
    255      * Filter target datasource ending with "ID" or "Accession". 
    256      * @param idOnlyForTgtDataSource ID-only if true 
    257      */ 
    258     public void setIDOnlyForTgtDataSource(boolean idOnlyForTgtDataSource) { 
    259         this.idOnlyForTgtDataSource = idOnlyForTgtDataSource; 
    260     } 
    261  
    262     /** 
    263206     * 
    264207     * @return true if ID-only for target data sources. 
     
    269212 
    270213    /** 
    271      * Set transitivity support. 
    272      * @param transitivity support transitivity if true. 
    273      */ 
    274     public void setTransitivity(final boolean transitivity) { 
    275         this.transitivity = transitivity; 
    276     } 
    277  
    278     /** 
    279      * Get transitivity support. 
    280      * @return true if support transitivity; false otherwise. 
    281      */ 
    282     public boolean getTransitivity() { 
    283         return transitivity; 
    284     } 
    285  
    286     /** 
    287      * Set base url of BioMart. 
    288      * @param baseURL URL of BioMart. 
    289      * @throws IDMapperException if failed to read local resources. 
    290      */ 
    291     public void setBaseURL(final String baseURL) throws IDMapperException { 
    292         try { 
    293             stub = BiomartStub.getInstance(baseURL); 
    294         } catch (IOException e) { 
    295             throw new IDMapperException(e); 
    296         } 
    297         this.baseURL = baseURL; 
    298     } 
    299  
    300     /** 
    301214     * 
    302215     * @return base URL of BioMart. 
     
    308221    /** 
    309222     * 
    310      * @param mart mart name 
    311      */ 
    312     public void setMart(final String mart) { 
    313         this.martName = mart; 
    314     } 
    315  
    316     /** 
    317      * 
    318223     * @return mart name 
    319224     */ 
    320225    public String getMart() { 
    321         return martName; 
    322     } 
    323  
    324     /** 
    325      * Set dataset. 
    326      * @param dataset dataset from BioMart 
    327      */ 
    328     public void setDataset(final String dataset) { 
    329         this.datasetName = dataset; 
     226        return mart; 
    330227    } 
    331228 
     
    335232     */ 
    336233    public String getDataset() { 
    337         return datasetName; 
     234        return dataset; 
    338235    } 
    339236 
     
    353250        if (srcXrefs==null) { 
    354251            throw new java.lang.IllegalArgumentException( 
    355                         "srcXrefs or tgtDataSources cannot be null"); 
    356         } 
    357  
    358         Map<Xref, Set<Xref>> result = new HashMap(); 
    359  
    360         // remove unsupported source datasources 
    361         Set<DataSource> supportedSrcDatasources 
    362                     = cap.getSupportedSrcDataSources(); 
    363         Map<DataSource, String> queryFilters = getQueryFilters(srcXrefs); 
    364         Iterator<DataSource> it = queryFilters.keySet().iterator(); 
    365         while (it.hasNext()) { 
    366             DataSource ds = it.next(); 
    367             if (!supportedSrcDatasources.contains(ds)) { 
    368                 it.remove(); 
    369             } 
    370         } 
    371         if (queryFilters.isEmpty()) { 
    372             return result; 
    373         } 
    374  
    375         // remove unsupported target datasources 
    376         Set<DataSource> supportedTgtDatasources = cap.getSupportedTgtDataSources(); 
    377         Vector<DataSource> tgtDss; 
    378         if (tgtDataSources == null) 
    379                 tgtDss = new Vector(supportedSrcDatasources); 
    380         else 
    381         { 
    382                 tgtDss = new Vector(tgtDataSources); 
    383                 tgtDss.retainAll(supportedTgtDatasources); 
    384         } 
    385         if (tgtDss.isEmpty()) { 
    386             return result; 
    387         } 
    388  
    389         for (Map.Entry<DataSource, String> filter : queryFilters.entrySet()) { 
    390             DataSource srcDs = filter.getKey(); 
    391  
    392             String srcAttr = mapSrcDSFilter.get(srcDs).getName(); 
    393             Attribute[] attrs = getAttributes(tgtDss, srcAttr); 
    394  
    395             Map<String, String> queryFilter = new HashMap(1); 
    396             queryFilter.put(srcAttr, filter.getValue()); 
    397  
    398             String query = XMLQueryBuilder.getQueryString(datasetName, attrs, queryFilter); 
    399  
    400             BufferedReader bfr = null; 
    401             try { 
    402                 bfr = stub.sendQuery(query); 
    403                 if (!bfr.ready()) 
    404                     throw new IDMapperException("Query failed"); 
    405             } catch (IOException e) { 
    406                 throw new IDMapperException(e); 
    407             } 
    408  
    409             if (bfr==null) { 
    410                 return result; 
    411             } 
    412              
    413             IDMappingReaderFromDelimitedReader reader 
    414                     = new IDMappingReaderFromDelimitedReader(bfr, 
    415                                 "\\t", null, transitivity); 
    416  
    417             Vector<DataSource> dss = new Vector(tgtDss.size()+1); 
    418             dss.addAll(tgtDss); 
    419             dss.add(srcDs); 
    420             reader.setDataSources(dss); 
    421              
    422             Map<Xref,Set<Xref>> mapXrefs = reader.getIDMappings(); 
    423             if (mapXrefs==null) { 
    424                 return result; 
    425             } 
    426  
    427             for (Xref srcXref : srcXrefs) { 
    428                 Set<Xref> refs = mapXrefs.get(srcXref); 
    429                 if (refs==null) continue; 
    430  
    431                 Set<Xref> tgtRefs = result.get(srcXref); 
    432                 if (tgtRefs==null) { 
    433                     tgtRefs = new HashSet(); 
    434                     result.put(srcXref, tgtRefs); 
     252                        "srcXrefs or tgtDataSources cannot be null."); 
     253        } 
     254 
     255        Map<Xref, Set<Xref>> result = new HashMap<Xref, Set<Xref>>(); 
     256 
     257        // source datasources 
     258        Map<String, Map<String, Xref>> mapSrcTypeIDXrefs = new HashMap(); 
     259        for (Xref xref : srcXrefs) { 
     260            DataSource ds = xref.getDataSource(); 
     261            if (!supportedSrcDs.contains(ds)) continue; 
     262 
     263            String src = ds.getFullName(); 
     264            Map<String, Xref> ids = mapSrcTypeIDXrefs.get(src); 
     265            if (ids==null) { 
     266                ids = new HashMap(); 
     267                mapSrcTypeIDXrefs.put(src, ids); 
     268            } 
     269            ids.put(xref.getId(), xref); 
     270        } 
     271 
     272        // supported tgt datasources 
     273        Set<String> tgtTypes = new HashSet(); 
     274        for (DataSource ds : tgtDataSources) { 
     275            if (supportedTgtDs.contains(ds)) { 
     276                tgtTypes.add(ds.getFullName()); 
     277            } 
     278        } 
     279        String[] tgts = tgtTypes.toArray(new String[0]); 
     280 
     281        for (Map.Entry<String, Map<String, Xref>> entry : 
     282                mapSrcTypeIDXrefs.entrySet()) { 
     283            String src = entry.getKey(); 
     284            Set<String> ids = entry.getValue().keySet(); 
     285            Map<String,Set<String>[]> res = 
     286                        stub.translate(mart, dataset , src, tgts, ids); 
     287 
     288 
     289            for (Map.Entry<String,Set<String>[]> entryRes : res.entrySet()) { 
     290                String srcId = entryRes.getKey(); 
     291                Set<String>[] tgtIds = entryRes.getValue(); 
     292                if (tgtIds==null) { // source xref not exist 
     293                    continue; 
    435294                } 
    436295 
    437                 for (Xref tgtXref : refs) { 
    438                     if (tgtDataSources.contains(tgtXref.getDataSource())) { 
    439                         tgtRefs.add(tgtXref); 
     296                Xref srcXref = mapSrcTypeIDXrefs.get(src).get(srcId); 
     297                 
     298                Set<Xref> tgtXrefs = new HashSet(); 
     299                for (int itgt=0; itgt<tgts.length; itgt++) { 
     300                    for (String tgtId : tgtIds[itgt]) { 
     301                        Xref tgtXref = new Xref(tgtId, 
     302                                DataSource.getByFullName(tgts[itgt])); 
     303                        tgtXrefs.add(tgtXref); 
    440304                    } 
    441305                } 
    442             } 
    443         } 
     306                 
     307                result.put(srcXref, tgtXrefs); 
     308            } 
     309        }         
    444310 
    445311        return result; 
    446     } 
    447  
    448     /** 
    449      * Create filters from the source xrefs. 
    450      * @param srcXrefs source xrefs 
    451      * @return map from data source to IDs 
    452      */ 
    453     protected Map<DataSource,String> getQueryFilters(Set<Xref> srcXrefs) { 
    454         Map<DataSource, Set<String>> mapNameValue = new HashMap(); 
    455         for (Xref xref : srcXrefs) { 
    456             DataSource ds = xref.getDataSource(); 
    457             Set<String> ids = mapNameValue.get(ds); 
    458             if (ids==null) { 
    459                 ids = new HashSet(); 
    460                 mapNameValue.put(ds, ids); 
    461             } 
    462             ids.add(xref.getId()); 
    463         } 
    464  
    465         Map<DataSource,String> filters = new HashMap(); 
    466         for (Map.Entry<DataSource, Set<String>> entry : mapNameValue.entrySet()) { 
    467             DataSource ds = entry.getKey(); 
    468             StringBuilder value = new StringBuilder(); 
    469             for (String str : entry.getValue()) { 
    470                 value.append(str); 
    471                 value.append(","); 
    472             } 
    473  
    474             int len = value.length(); 
    475             if (len>0) { 
    476                 value.deleteCharAt(len-1); 
    477             } 
    478  
    479             filters.put(ds, value.toString()); 
    480         } 
    481  
    482         return filters; 
    483     } 
    484  
    485     /** 
    486      * This code is bollowed from IDMapperClient from Cytoscape. 
    487      * @param tgtDataSources target data sources 
    488      * @param filterName filter name 
    489      * @return attributes 
    490      */ 
    491     protected Attribute[] getAttributes(Vector<DataSource> tgtDataSources,  
    492             String filterName) { 
    493         int n = tgtDataSources.size(); 
    494         Attribute[] attrs = new Attribute[n+1]; 
    495  
    496         int iattr = 0; 
    497         for (DataSource ds : tgtDataSources) { 
    498             //attrs[iattr++] = new Attribute(ds.getFullName()); 
    499             attrs[iattr++] = this.mapSrcDSAttr.get(ds); 
    500         } 
    501  
    502         // Database-specific modification. 
    503         // This is not the best way, but cannot provide universal solution. 
    504         Attribute attr; 
    505         if (datasetName.contains("REACTOME")) { 
    506             attr = stub.filterToAttributeName(datasetName, "REACTOME", filterName); 
    507         } else if (datasetName.contains("UNIPROT")) { 
    508             attr = stub.filterToAttributeName(datasetName, "UNIPROT", filterName); 
    509         } else if (datasetName.contains("VARIATION")) { 
    510             attr = stub.getAttribute(datasetName, filterName + "_stable_id"); 
    511         } else { 
    512             attr = stub.getAttribute(datasetName, filterName); 
    513         } 
    514  
    515         attrs[n] = attr; 
    516  
    517         return attrs; 
    518312    } 
    519313 
     
    535329     * free text search is not supported for BioMart-based IDMapper. 
    536330     */ 
    537     public Set<Xref> freeSearch (String text, int limit) throws IDMapperException { 
     331    public Set<Xref> freeSearch (String text, int limit) 
     332            throws IDMapperException { 
    538333        throw new UnsupportedOperationException(); 
    539334    } 
     
    544339     * @throws IOException if failed to read the filters 
    545340     */ 
    546     protected Set<DataSource> getSupportedSrcDataSources() throws IOException { 
     341    protected Set<DataSource> getSupportedSrcDataSources() 
     342            throws IDMapperException { 
    547343        Set<DataSource> dss = new HashSet(); 
    548         Map<String, Filter> filters = stub.getFilters(datasetName); 
    549         for (Filter filter : filters.values()) { 
    550             //String fullName = filter.getDisplayName()+" ("+filter.getName()+")"; 
    551             String fullName = filter.getDisplayName(); 
    552             if (fullName.endsWith("(s)")) { 
    553                 fullName = fullName.substring(0, fullName.length()-3); 
    554             } 
    555             //TODO: mapping to bridgedb system code 
    556             DataSource ds = DataSource.getByFullName(fullName); 
    557             dss.add(ds); 
    558             mapSrcDSFilter.put(ds, filter); 
     344        Set<String> filters = stub.availableFilters(mart, dataset); 
     345        for (String filter : filters) { 
     346            DataSource ds = DataSource.getByFullName(filter); 
     347            if (ds!=null) { 
     348                dss.add(ds); 
     349            } 
    559350        } 
    560351        return dss; 
     
    566357     * @throws IOException if failed to read the filters 
    567358     */ 
    568     protected Set<DataSource> getSupportedTgtDataSources() throws IOException { 
    569         Map<String, Attribute> attributeVals = stub.getAttributes(datasetName); 
     359    protected Set<DataSource> getSupportedTgtDataSources()  
     360            throws IDMapperException { 
    570361        Set<DataSource> dss = new HashSet(); 
    571         for (Attribute attr : attributeVals.values()) { 
    572             String displayName = attr.getDisplayName(); 
    573             String name = attr.getName(); 
    574             if (idOnlyForTgtDataSource) { 
    575                 if (!displayName.endsWith("ID") 
    576                         && !displayName.endsWith("Accession") 
    577                         && !name.endsWith("id") 
    578                         && !name.endsWith("accession")) { 
    579                     continue; 
    580                 } 
    581             } 
    582             //String fullName = displayName + " ("+name+")"; 
    583             String fullName = displayName; 
    584             //TODO: mapping to bridgedb system code 
    585             DataSource ds = DataSource.getByFullName(fullName); 
    586             dss.add(ds); 
    587             mapSrcDSAttr.put(ds, attr); 
     362        Set<String> attributes = stub.availableAttributes(mart, dataset, 
     363                idOnlyForTgtDataSource); 
     364 
     365        for (String attr : attributes) { 
     366            DataSource ds = DataSource.getByFullName(attr); 
     367            if (ds!=null) { 
     368                dss.add(ds); 
     369            } 
    588370        } 
    589371        return dss; 
     
    603385        /** {@inheritDoc} */ 
    604386        public Set<DataSource> getSupportedSrcDataSources() throws IDMapperException { 
    605         try { 
    606             return IDMapperBiomart.this.getSupportedSrcDataSources(); 
    607         } catch (IOException ex) { 
    608             throw new IDMapperException(ex); 
    609         } 
     387            return IDMapperBiomart.this.supportedSrcDs; 
    610388        } 
    611389 
    612390        /** {@inheritDoc} */ 
    613391        public Set<DataSource> getSupportedTgtDataSources() throws IDMapperException { 
    614             try { 
    615             return IDMapperBiomart.this.getSupportedTgtDataSources(); 
    616         } catch (IOException ex) { 
    617             throw new IDMapperException(ex); 
    618         } 
     392            return IDMapperBiomart.this.supportedTgtDs; 
    619393        } 
    620394