mirDIP : microRNA Data Integration Portal



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

      Windows   Linux   Mac


	




# Note: Works with Python 3 and up

import urllib.request, urllib.parse


# ########################################################################################################
#                                                   class library mirDIP_Http                            #
# ########################################################################################################
class mirDIP_Http:

    mapScore = {
    'Very High' : '0',
    'High' : '1',
    'Medium' : '2',
    'Low' : '3'
    }


    url = "http://ophid.utoronto.ca/mirDIP"
        
    map = {}    # results will be here

    def __init__(self):
        return

    
    # unidirectional on genes
    def unidirectionalSearchOnGenes(self, geneSymbols, minimumScore):
    
        self.sendPost(self.url + "/Http_U", geneSymbols, '', self.mapScore[minimumScore])
        return


    # unidirectional on microrna(s)
    def unidirectionalSearchOnMicroRNAs(self, microRNAs, minimumScore):
            
        self.sendPost(self.url + "/Http_U", '', microRNAs, self.mapScore[minimumScore])
        return


    # bidirectional        
    def bidirectionalSearch(self, geneSymbols, microRNAs, minimumScore, sources, 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;
        '''

        self.sendPost(self.url + "/Http_B", geneSymbols, microRNAs, self.mapScore[minimumScore], sources, occurrances)
        return        


       
    # .. serve POST request
    def sendPost(self, url_, geneSymbols, microrna, minimumScore, sources = '', occurrances = '1'):

        params = {
        'genesymbol' : geneSymbols,
        'microrna' : microrna,
        'scoreClass' : minimumScore,
        'dbOccurrences' : occurrances,
        'sources' : sources}

        params = bytes( urllib.parse.urlencode( params ).encode() )
        response = ''

        try:
            handler = urllib.request.urlopen(url_, params)
        except Exception:
            traceback.print_exc()
        else:
            self.response = handler.read().decode('utf-8')
            ## print(self.response)
            self.makeMap()

        return


    def makeMap(self):
            
        ENTRY_DEL = 0x01
        KEY_DEL = 0x02
            
        arr = self.response.split(chr(ENTRY_DEL))
            
        for str in arr:
                
            arrKeyValue = str.split(chr(KEY_DEL));
            if len(arrKeyValue) > 1: 
                self.map[arrKeyValue[0]] = arrKeyValue[1]

        return

    def getGeneratedAt(self): 

        if "generated_at" in self.map: 
            return self.map["generated_at"]
        else:
            return ''


    def getGeneSymbols(self):
       
        if "gene_symbols" in self.map:
            return self.map["gene_symbols"]
        else:
            return ''


    def getMicroRNAs(self): 
        if "micro_rnas" in self.map: 
            return self.map["micro_rnas"]
        else:
            return ''

    def getMinimumScore(self): 
        if "minimum_score" in self.map: 
            return self.map["minimum_score"]
        else:
            return ''

    def getDatabaseOccurrences(self):
        if "dbOccurrences" in self.map: 
            return self.map["dbOccurrences"]
        else: 
            return ''

    def getSources(self):
        if "sources" in self.map: 
            return self.map["sources"]
        else:
            return '' 
        
    def getResulsSize(self):
        if "results_size" in self.map: 
            return self.map["results_size"]
        else: 
            return ''

    def getResuls(self): 
        if "results" in self.map: 
            return self.map["results"]
        else: 
            return ''





#########################################################################################################
#                                          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.)
geneSymbols = "AKAP17A,AKR1C2,APP,ZZZ3,MARK4,C17orf51"
# Minimum Score 
#      - Use one of those: 'Very High', 'High', 'Medium', 'Low'. 
#      - Mind exact spelling.
minimumScore = "Very High"


o = mirDIP_Http()   # note: re-instance with every search !!!
o.unidirectionalSearchOnGenes(geneSymbols, minimumScore)

# print results
print("\r\n  Unidirectional Search on Genes:  \r\n")
print("Generated at: " + o.getGeneratedAt())
print("Gene Symbols: " + o.getGeneSymbols())
print("Minimum Score: " + o.getMinimumScore())
print("Results Size: " + o.getResulsSize())
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.
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.
minimumScore = "Very High"


o = mirDIP_Http()   # note: re-instance with every search !!!

o.unidirectionalSearchOnMicroRNAs(microRNAs, minimumScore)

# print results
print("\n  Unidirectional Search on microRNAs  \n");
print("Generated at: " + o.getGeneratedAt());
print("Micro RNAs: " + o.getMicroRNAs());
print("Minimum Score: " + o.getMinimumScore());
print("Results Size: " + o.getResulsSize());
print("Results: \r\n" + o.getResuls());      # formatted as tab-delimited spreadsheet




        
# *********************************
# Example of Bidirectional search *
# *********************************
# GeneSymbols 
#      - Comma delimited. 
#      - Follow to HUGO approved spelling.
geneSymbols = "AKAP17A,AKR1C2,APP,ZZZ3,MARK4, C17orf51"
            
# MicroRMAs 
#       - Comma delimited; 
#      - Follow the notation as shown.
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.
minimumScore = "Very High"
            
# Sources 
#      - Use ony 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
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
occurrances = '2'


o = mirDIP_Http()   # note: re-instance with every search !!!

o.bidirectionalSearch(geneSymbols, microRNAs, minimumScore, sources, occurrances)

# print results
print("\n  Bidirectioanl Search:  \n")
print("Generated at: " + o.getGeneratedAt())
print("Gene Symbols: " + o.getGeneSymbols())
print("Minimum Score: " + o.getMinimumScore())
print("Database Occurrences: " + o.getDatabaseOccurrences())
print("Source Filter: " + o.getSources())
print("Results Size: " + o.getResulsSize())
print("Results: \r\n" + o.getResuls());      # formatted as tab-delimited spreadsheet


    




All contents copyright: Jurisica Lab, Schroeder Arthritis Institute, Krembil Research Institute - the University Health Network, Toronto, Canada. Last modified Sep 12, 2022. (Version 5.2.2.1, Database version 5.2.2.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