From OpenWetWare
Jump to: navigation, search

New Plan

  • INPUT: string of search-ready disease name or associated gene, ex. 'BRCA1', 'Hashimoto's Thyroiditis'
  • OUTPUT: list (of lists) of 1) base site name of 2) searched-URLs for the disease/gene

Sites to be Searched

  • General Patient Info
    • eMedicine
    • Google
    • Wikipedia
    • (WHO)
  • Less Patient-Friendly But Possibly Useful Info:
    • HapMap
    • OMIM
    • GeneCards


  1. Parse the search-term for individual sites' search URLs
  2. Return the search-URL + parsed-search-terms


import sys

# (Temporary) search_term will get whatever the input is 
search_term = "Hashimoto's Thyroiditis"

def parse_for_eMed(search_term):
    parsed_term = search_term.lower().replace(' ', '%20')
    return "" % parsed_term

def parse_for_Google_genl(search_term):
    parsed_term = search_term.lower().replace("'", '%27').replace(' ', '+')
    return "" % parsed_term 

def parse_for_Google_treatment(search_term):
    parsed_term = search_term.lower().replace("'", '%27').replace(' ', '+')
    return "" % parsed_term

def parse_for_Wikipedia(search_term):
    parsed_term = search_term.lower().capitalize().replace("'", '%27').replace(' ', '_')
    return "" % parsed_term

def parse_for_WHO(search_term):
    parsed_term = search_term.lower().replace("'", '%27').replace(' ', '+')
    return "" % parsed_term

def parse_for_GeneCards(search_term):
    parsed_term = search_term.lower().replace(" ", '+')
    # NB: This only gives a functionally correct search if the search_term is a name of a disease
    # because there are other formats for different inputs and different forms of the input
    return "" % parsed_term

def return_site_list_for_disease(search_term):
    # Currently returns site-name and URL list
    # ex. [["eMedicine", ""]]
    return [["eMedicine", parse_for_eMed(search_term)],
            ["Google, general search", parse_for_Google_genl(search_term)],
            ["Google, Treatment search", parse_for_Google_treatment(search_term)],
            ["Wikipedia", parse_for_Wikipedia(search_term)],
            ["WHO", parse_for_WHO(search_term)],
            ["GeneCards", parse_for_GeneCards(search_term)]

final_list = return_site_list_for_disease(search_term)
print final_list

Next Steps

  • Accessing other, not-as-easily-accessible sites: PubMed, OMIM, HapMap, GeneCards?
    • GeneCards can be done - sort of. The options for different inputs are the Examples on GeneCards main page, so we would need to know what kind of input, according to those options, we have in order to get the search information we really want. However, the current format does give useful gene information when otehr inputs are used (ie. inputting wnt* gives a list of genes pertaining to wnt).
    • The others have a hidden, non-URL based system I don't know how to deal with - yet...