Show
Ignore:
Timestamp:
08/07/09 10:57:34 (3 years ago)
Author:
martijn
Message:

WIP on improving biomart webservice

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/corelib/test/org/bridgedb/TestBiomart.java

    r134 r146  
    5656 
    5757        for (Database db : dbs) { 
     58                System.out.println (db.getName()); 
    5859            Set<Dataset> datasets = new HashSet(biomartStub.getAvailableDatasets(db.getName())); 
    5960            int nds = datasets.size(); 
    6061            for (Dataset ds : datasets) { 
     62                System.out.println ("\t" + ds.getName()); 
    6163                IDMapperBiomart idMapper = new IDMapperBiomart(ds.getName()); 
    6264                IDMapperCapabilities cap = idMapper.getCapabilities(); 
    6365                if (cap.getSupportedSrcDataSources().isEmpty() 
    6466                        || cap.getSupportedTgtDataSources().isEmpty()) { 
    65                     System.out.println("ds\t"+ds.getName()); 
     67//                    System.out.println("\tds\t"+ds.getName()); 
    6668                    nds--; 
    6769                } 
     70                for (DataSource dsx : cap.getSupportedSrcDataSources()) 
     71                { 
     72                 System.out.println ("\t\t" + dsx); 
     73                } 
     74                for (DataSource dsx : cap.getSupportedTgtDataSources()) 
     75                { 
     76                 System.out.println ("\t\t" + dsx); 
     77                } 
    6878            } 
    69             if (nds==0) { 
    70                 System.out.println("db\t"+db.getName()); 
    71             } 
     79//            if (nds==0) { 
     80//                System.out.println("\tdb\t"+db.getName()); 
     81//            } 
    7282        } 
    7383    } 
    74          
     84     
     85    public void testBioMartConnector() throws IOException, IDMapperException 
     86    { 
     87//        BiomartStub biomartStub = BiomartStub.getInstance(); 
     88//        Map<String, Database> reg = null; 
     89//        try { 
     90//            reg = biomartStub.getRegistry(); 
     91//        } catch (Exception e) { 
     92//            e.printStackTrace(); 
     93//        } 
     94//        Set<Database> dbs = new HashSet(reg.size()); 
     95//         for (Database db : reg.values()) { 
     96//             //if (db.visible()) { 
     97//                 dbs.add(db); 
     98//             //} 
     99//                System.out.println (db.getName()); 
     100//         } 
     101        BiomartStub biomartStub = BiomartStub.getInstance(); 
     102         
     103        Set<Dataset> datasets = new HashSet(biomartStub.getAvailableDatasets("ensembl")); 
     104         
     105         IDMapperBiomart mapper = new IDMapperBiomart("hsapiens_gene_ensembl"); 
     106         for (DataSource ds : mapper.getCapabilities().getSupportedSrcDataSources()) 
     107         { 
     108                 System.out.println (ds); 
     109         } 
     110         for (DataSource ds : mapper.getCapabilities().getSupportedTgtDataSources()) 
     111         { 
     112                 System.out.println (ds); 
     113         } 
     114    } 
     115 
     116    public void testBioMartConnector2() throws IOException, IDMapperException, ClassNotFoundException 
     117    { 
     118        BiomartStub biomartStub = BiomartStub.getInstance(); 
     119         
     120        Class.forName("org.bridgedb.webservice.IDMapperBiomart"); 
     121         
     122        biomartStub.getAvailableDatasets("ensembl"); 
     123         
     124         //IDMapperBiomart mapper = new IDMapperBiomart("hsapiens_gene_ensembl"); 
     125        IDMapper mapper = BridgeDb.connect ("idmapper-biomart:dataset=hsapiens_gene_ensembl"); 
     126         for (DataSource ds : mapper.getCapabilities().getSupportedSrcDataSources()) 
     127         { 
     128                 System.out.println (ds); 
     129         } 
     130         for (DataSource ds : mapper.getCapabilities().getSupportedTgtDataSources()) 
     131         { 
     132                 System.out.println (ds); 
     133         } 
     134    } 
     135 
    75136}