def search(args):
    """Uses PhosPhAt API to return computationally predicted phosphorylation
    hotspots when given an AGI code.

    Args:
        All arguments are stored in a single dict.
        transcript_id: AGI Transcript Identifier. Refers to a specific protein.
            Example value: 'AT1G06410.1'
    """
    # tools.validate_args is a custom method that validates the transcript ID.
    # It will throw an exception if the ID is invalid.
    tools.validate_args(args)

    # tools.request_data is a custom method in the services.common.tools module.
    # It contacts the remote host PhosPhAt and returns phosphorylation data
    # as a dict, which is then stored in phos_sites.
    # This method will raise an exception if it can't connect to PhosPhAt.
    hotspots = tools.request_data(args['transcript_id'], API_METHOD)

    # phos_sites is a dict, and phos_sites['result'] is a dict within phos_sites.
    for h in hotspots['result']:
        # h refers to each dict within hotspots['result'].
        extracted_data = {}
        extracted_data['hotspot_sequence'] = h['hsp_hotspot_sequenz']
        extracted_data['start_position'] = h['hsp_hotspot_start']
        extracted_data['end_position'] = h['hsp_hotspot_stop']
        # Adama requires JSON objects be printed and separated by three dashes
        print json.dumps(extracted_data) + '\n---'
def search(args):
    """Uses PhosPhAt API to get predicted phosphorylation sites.

    Args:
        All arguments are stored in a single dict.
        transcript_id: AGI Transcript Identifier. Refers to a specific protein.
            Example value: 'AT1G06410.1'
    """
    # tools.validate_args is a custom method that validates the transcript ID.
    # It will throw an exception if the ID is invalid.
    tools.validate_args(args)

    # tools.request_data is a custom method in the services.common.tools module.
    # It contacts the remote host PhosPhAt and returns phosphorylation data
    # as a dict, which is then stored in phos_sites.
    # This method will raise an exception if it can't connect to PhosPhAt.
    phos_sites = tools.request_data(args['transcript_id'], API_METHOD)

    # phos_sites is a dict, and phos_sites['result'] is a dict within phos_sites.
    for p_site in phos_sites['result']:
        # Each p_site is a dict within phos_sites['result'].
        extracted_data = {}
        extracted_data['position_in_protein'] = p['prd_position']
        extracted_data['prediction_score'] = p['prd_score']
        extracted_data['thirteen_mer_sequence'] = p['prd_13mer']
        # Adama requires JSON objects be printed and separated by three dashes
        print json.dumps(extracted_data) + '\n---'
def search(args):
    """Uses PhosPhAt API to get predicted phosphorylation sites.

    Args:
        All arguments are stored in a single dict.
        transcript_id: AGI Transcript Identifier. Refers to a specific protein.
            Example value: 'AT1G06410.1'
    """
    # tools.validate_args is a custom method that validates the transcript ID.
    # It will throw an exception if the ID is invalid.
    tools.validate_args(args)

    # tools.request_data is a custom method in the services.common.tools module.
    # It contacts the remote host PhosPhAt and returns phosphorylation data
    # as a dict, which is then stored in phos_sites.
    # This method will raise an exception if it can't connect to PhosPhAt.
    phos_sites = tools.request_data(args['transcript_id'], API_METHOD)

    # phos_sites is a dict, and phos_sites['result'] is a dict within phos_sites.
    for p_site in phos_sites['result']:
        # Each p_site is a dict within phos_sites['result'].
        extracted_data = {}
        extracted_data['position_in_protein'] = p['prd_position']
        extracted_data['prediction_score'] = p['prd_score']
        extracted_data['thirteen_mer_sequence'] = p['prd_13mer']
        # Adama requires JSON objects be printed and separated by three dashes
        print json.dumps(extracted_data) + '\n---'
def search(args):
    """Uses PhosPhAt API to return experimentally determined phosphorylation
    hotspots when given an AGI code.

    Args:
        All arguments are stored in a single dict.
        transcript_id: AGI Transcript Identifier. Refers to a specific protein.
            Example value: 'AT1G01540.1'
    """
    # tools.validate_args is a custom method that validates the transcript ID.
    # It will throw an exception if the ID is invalid.
    tools.validate_args(args)

    # tools.request_data is a custom method in the services.common.tools module.
    # It contacts the remote host PhosPhAt and returns phosphorylation data
    # as a dict, which is then stored in phos_sites.
    # This method will raise an exception if it can't connect to PhosPhAt.
    hotspots = tools.request_data(args['transcript_id'], API_METHOD)

    # phos_sites is a dict, and phos_sites['result'] is a dict within phos_sites.
    for h in hotspots['result']:
        # h refers to each dict within hotspots['result'].
        extracted_data = {}
        extracted_data['hotspot_sequence'] = h['hspExp_hotspot_sequenz']
        extracted_data['start_position'] = h['hspExp_hotspot_start']
        extracted_data['end_position'] = h['hspExp_hotspot_stop']
        # Adama requires JSON objects be printed and separated by three dashes
        print json.dumps(extracted_data) + '\n---'
def search(args):
    """Uses PhosPhAt API to return detailed experimental phosphorylation sites
        given a modified peptide sequence.

    Args:
        All arguments are stored in a single dict (args).
        transcript_id: AGI Transcript Identifier. Refers to a specific protein.
            Example value: 'AT1G06410.1'
    """

    # tools.validate_args is a custom method that validates the transcript ID.
    # It will throw an exception if the ID is invalid.
    tools.validate_args(args)

    # tools.request_data is a custom method in the services.common.tools module.
    # It contacts the remote host PhosPhAt and returns phosphorylation data
    # as a dict, which is then stored in phos_sites.
    # This method will raise an exception if it can't connect to PhosPhAt.
    phos_sites = tools.request_data(args['transcript_id'], API_METHOD)

    # phos_sites is a dict, and phos_sites['result'] is a dict within phos_sites.
    for p_site in phos_sites['result']:
        # Each p_site is a dict within phos_sites['result'].
        extracted_data = {}
        extracted_data['peptide_sequence'] = p_site['pep_sequence']
        extracted_data['modified_sequence'] = p_site['modifiedsequence']
        extracted_data['protein_sequence'] = p_site['prot_sequence']
        # PhosPhAt is in Germany and uses commas instead of decimal points
        extracted_data['mass'] = p_site['mass'].replace(",", ".")
        extracted_data['position_in_peptide'] = p_site['position']
        extracted_data['modification_code'] = p_site['modificationType']
        # Call tools.expand_mod_type to make returned data more comprehensible
        extracted_data['modification_type'] = tools.expand_mod_type(
            p_site['modificationType'])
        # Adama requires JSON objects be printed and separated by three dashes
        print json.dumps(extracted_data) + '\n---'