mirDIP : microRNA Data Integration Portal



You can use this API for calling mirDIP from your Java code.

      Windows   Linux   Mac


	



import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

public class MyMain {

    public static void main(String[] args) {
        
        // ... Pick-up right sample for your search
        // Note: Adjust 'ophid.utoronto.ca' if you are using our development server.

        
        // /*
        // **************************************************
        // Example of Unidirectional search on Gene Symbols *
        // **************************************************
        {
            // GeneSymbols 
            //      - Comma delimited. 
            //      - Follow to HUGO approved spelling.)
            String geneSymbols = "AKAP17A,AKR1C2,APP,ZZZ3,MARK4,C17orf51";
        
            // Minimum Score 
            //      - Use one of those: 'Very High', 'High', 'Medium', 'Low'. 
            //      - Mind exact spelling.
            String minimumScore = "Very High";


            mirDIP_Http o = new mirDIP_Http();

            int responseCode = o.unidirectionalSearchOnGenes(geneSymbols, minimumScore);

            if (responseCode != 200) {
                System.out.println("Error: Response Code : " + responseCode);
            } else {

                // print results
                System.out.println("\n  Unidirectional Search on Genes:  \n");

                System.out.println("Generated at: " + o.getGeneratedAt());
                System.out.println("Gene Symbols: " + o.getGeneSymbols());
                System.out.println("Minimum Score: " + o.getMinimumScore());

                System.out.println("Results Size: " + o.getResulsSize());
                System.out.print("Results: \r\n" + o.getResuls());  // formatted as tab-delimited spreadsheet
            }
        }
        // */
        
        
        
        // /*
        // ***********************************************
        // Example of Unidirectional search on MicroRNAs *
        // ***********************************************
        {
            // MicroRMAs 
            //      - Comma delimited. 
            //      - Follow the notation as shown.
            String microRNAs = "hsa-miR-603, hsa-let-7a-3p, hsa-miR-625-5p, hsa-miR-7852-3p, hsa-miR-17-5p";

            // Minimum Score 
            //      - Use one of those: 'Very High', 'High', 'Medium', 'Low'. 
            //      - Mind exact spelling.
            String minimumScore = "Very High";


            mirDIP_Http o = new mirDIP_Http();

            int responseCode = o.unidirectionalSearchOnMicroRNAs(microRNAs, minimumScore);

            if (responseCode != 200) {
                System.out.println("Error: Response Code : " + responseCode);
            } else {

                // print results
                System.out.println("\n  Unidirectional Search on microRNAs  \n");

                System.out.println("Generated at: " + o.getGeneratedAt());
                System.out.println("Micro RNAs: " + o.getMicroRNAs());
                System.out.println("Minimum Score: " + o.getMinimumScore());

                System.out.println("Results Size: " + o.getResulsSize());
                System.out.print("Results: \r\n" + o.getResuls());  // formatted as tab-delimited spreadsheet
            }
        }
        // */
        
        
        
        // /*
        // *********************************
        // Example of Bidirectional search *
        // *********************************
        {
            // GeneSymbols 
            //      - Comma delimited. 
            //      - Follow to HUGO approved spelling.
            String geneSymbols = 
                    "AKAP17A,AKR1C2,APP,ZZZ3,MARK4, C17orf51";
            
            // MicroRMAs 
            //      - Comma delimited; 
            //      - Follow the notation as shown.
            String microRNAs = 
                    "hsa-miR-603,hsa-let-7a-3p,hsa-miR-625-5p,hsa-miR-7852-3p,"
                    + "hsa-miR-17-5p,hsa-miR-4321,hsa-miR-758-3p";
            
            // Minimum Score
            //      - Use one of those: 'Very High', 'High', 'Medium', 'Low'. 
            //      - Mind exact spelling.
            String minimumScore = "Very High";
            
            // Sources 
            //      - Use only combination of those:  
            //              bitargeting_May_2021, BCmicrO, CoMeTa, Cupid, DIANA, miranda_May_2021, 
            //              mirbase, mirCoX, mirmap_May_2021, mirzag, miRcode, miRDB_v6, miRTar2GO, 
            //              MBStar, MirAncesTar, MirSNPInTarget, MirTar2, MiRNATIP, MultiMiTar, PACCMIT, 
            //              PITA_May_2021, rnahybrid_May_2021, RNA22, TargetScan_v7_2
            //      - Mind exact spelling
            String sources = 
                    "bitargeting_May_2021, BCmicrO, CoMeTa, Cupid, DIANA, miranda_May_2021, " 
                    + "mirbase, mirCoX, mirmap_May_2021, mirzag, miRcode, miRDB_v6, miRTar2GO, " 
                    + "MBStar, MirAncesTar, MirSNPInTarget, MirTar2, MiRNATIP, MultiMiTar, PACCMIT, " 
                    + "PITA_May_2021, rnahybrid_May_2021, RNA22, TargetScan_v7_2";                    

            // Data
            // Database Occurrences (named as 'Number of Sources' on 'Bidirectional search' web page): 
            //          - Use this option to select microRNA target predictions that are 
            //              present in at least a given number of sources - irrespective 
            //              of what those sources are.
            //          - The valid values are: from 1 to 24
            int occurrances = 2;
            


            mirDIP_Http o = new mirDIP_Http();

            int responseCode = o.bidirectionalSearch(geneSymbols, 
                                    microRNAs, minimumScore, sources, occurrances);

            if (responseCode != 200) {
                System.out.println("Error: Response Code : " + responseCode);
            } else {

                // print results
                System.out.println("\n  Bidirectioanl Search:  \n");
                
                System.out.println("Generated at: " + o.getGeneratedAt());
                System.out.println("Gene Symbols: " + o.getGeneSymbols());
                System.out.println("Minimum Score: " + o.getMinimumScore());
                System.out.println("Database Occurrences: " + o.getDatabaseOccurrences());
                System.out.println("Source Filter: " + o.getSources());

                System.out.println("Results Size: " + o.getResulsSize());
                System.out.print("Results: \r\n" + o.getResuls());  // formatted as tab-delimited spreadsheet
            }
        }
        // */
    }    
}



    

    // ... Add mirDIP_Http class to your code.


class mirDIP_Http {

	private final String USER_AGENT = "Mozilla/5.0";
        
        
        final static Map<String, Integer> mapScore = new HashMap<String, Integer>();
	static {
		
            mapScore.put("Very High", 0);
            mapScore.put("High", 1);
            mapScore.put("Medium", 2);
            mapScore.put("Low", 3);
        }

        
        final private String url = "http://ophid.utoronto.ca/mirDIP";
        
        private final StringBuilder response = new StringBuilder();
        private final Map<String, String> map = new HashMap<String, String>();
        
        
        
        int unidirectionalSearchOnGenes(String geneSymbols, String minimumScore) {

            String url_u = url + "/Http_U";
            
            String parameters = 
                    "genesymbol=" + geneSymbols + "&" + "microrna=" + "&" + "scoreClass=" + 
                    mapScore.get(minimumScore);
            
            int responseCode = sendPost(url_u, parameters);
            return responseCode;
        }
        
        int unidirectionalSearchOnMicroRNAs(String microRNAs, String minimumScore) {

            String url_u = url + "/Http_U";
            
            String parameters = 
                    "genesymbol=" + "&" + "microrna=" + microRNAs + "&" + "scoreClass=" + 
                    mapScore.get(minimumScore);
            
            int responseCode = sendPost(url_u, parameters);
            return responseCode;
        }
        
        int bidirectionalSearch(String geneSymbols, 
                String microRNAs, String minimumScore, String sources, int occurrances) {

            String url_b = url + "/Http_B";
            
            String parameters = 
                    "genesymbol=" + geneSymbols + 
                    "&" + "microrna=" + microRNAs +
                    "&" + "scoreClass=" + mapScore.get(minimumScore) + 
                    "&" + "dbOccurrences=" + occurrances +
                    "&" + "sources=" + sources;
            
            int responseCode = sendPost(url_b, parameters);
            return responseCode;
        }
        
        
        
        
	// .. server GET request
	int sendGet(String url_, String parameters) {

            try {

		URL obj = new URL(url_ + "?" + parameters);

                // ... make request
                HttpURLConnection con = (HttpURLConnection) obj.openConnection();
		con.setRequestMethod("GET");
		con.setRequestProperty("User-Agent", USER_AGENT);

                // ... get response
		int responseCode = con.getResponseCode();
                if (responseCode == 200) {
                
                    BufferedReader in = new BufferedReader(
                            new InputStreamReader(con.getInputStream()));

                    String end_line = System.getProperty("line.separator");
                    String inputLine;
                    while ((inputLine = in.readLine()) != null) {
                            response.append(inputLine).append(end_line);
                    }
                    
                    in.close();
                }
                con.disconnect();
                
                // .. format response
                if (responseCode == 200) makeMap(response);
                
                return responseCode;

            } catch (IOException e) {
                e.printStackTrace(System.err);
            }
            
            return 520; // 520 Unknown Error
	}

        
	// .. serve POST request
	int sendPost(String url_, String parameters) {

            try {
		URL obj = new URL(url_);
		HttpURLConnection con = (HttpURLConnection) obj.openConnection();

		//add reuqest header
		con.setRequestMethod("POST");
		con.setRequestProperty("User-Agent", USER_AGENT);
		con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

		// ... send post request
		con.setDoOutput(true);
		DataOutputStream wr = new DataOutputStream(con.getOutputStream());
		wr.writeBytes(parameters);
		wr.flush();
		wr.close();

		int responseCode = con.getResponseCode();
                if (responseCode == 200) {

                    BufferedReader in = new BufferedReader(
                            new InputStreamReader(con.getInputStream()));
                    
                    String end_line = System.getProperty("line.separator");
                    String inputLine;
                    while ((inputLine = in.readLine()) != null) {
                            response.append(inputLine).append(end_line);
                    }
                    in.close();
                }
                con.disconnect();
                
                // .. format response
                if (responseCode == 200) makeMap(response);
                
                return responseCode;

            } catch (IOException e) {
                e.printStackTrace(System.err);
            }

            return 520; // 520 Unknown Error
	}
        
        
        
        
        void makeMap(StringBuilder response) {
            
            final char ENTRY_DEL = 0x01;
            final char KEY_DEL = 0x02;
            
            String[] arr = response.toString().split(String.valueOf(ENTRY_DEL));
            
            for (String str : arr) {
                
                String[] arrKeyValue = str.split(String.valueOf(KEY_DEL));
                if (arrKeyValue.length > 1) map.put(arrKeyValue[0], arrKeyValue[1]);
            }
        }
        
        String getGeneratedAt() {return (map.get("generated_at") == null) ? "" : map.get("generated_at");}
        String getGeneSymbols() {return (map.get("gene_symbols") == null) ? "" : map.get("gene_symbols");}
        String getMicroRNAs() {return (map.get("micro_rnas") == null) ? "" : map.get("micro_rnas");}
        String getMinimumScore() {return (map.get("minimum_score") == null) ? "" : map.get("minimum_score");}

        String getDatabaseOccurrences() {return (map.get("dbOccurrences") == null) ? "" : map.get("dbOccurrences");}
        String getSources() {return (map.get("sources") == null) ? "" : map.get("sources");}
        
        String getResulsSize() {return (map.get("results_size") == null) ? "" : map.get("results_size");}
        String getResuls() {return (map.get("results") == null) ? "" : map.get("results");}
}





All contents copyright: Jurisica Lab, Schroeder Arthritis Institute, Krembil Research Institute - the University Health Network, Toronto, Canada. Last modified Jan 26, 2024. (Version 5.3.0.2, Database version 5.2.3.1)

All downloads and use of this database are subject to the following terms.

Permission to use, copy, and modify this database hereby granted to all academic and not-for-profit institutions without fee, provided that name of organization and author appear in all copies of the database. Under these conditions, the permission to modify and distribute or to make extended versions of the database is explicitly granted to non-profit organizations. All commercial entities willing to download or use the database must contact the authors. This database is provided "AS-IS" and with out any warranty of any kind. In no event shall Krembil Research Institute - the University Health Network or the authors be liable for any consequential damage of any kind, or any damages resulting from the use of this database.

Reference:
- Tokar T, Pastrello C, Rossos AEM, Abovsky M, Hauschild AC, Tsay M, Lu R, Jurisica I. mirDIP 4.1-integrative database of human microRNA target predictions. Nucleic Acids Res. 2018 Jan 4;46(D1):D360-D370. doi: 10.1093/nar/gkx1144. PubMed PMID: 29194489; PubMed Central PMCID: PMC5753284
- Shirdel EA, Xie W, Mak TW, Jurisica I, 2011 NAViGaTing the Micronome. Using Multiple MicroRNA Prediction Databases to Identify Signalling Pathway-Associated MicroRNAs. PLoS ONE 6(2): e17429. doi:10.1371/journal.pone.0017429