Python Client:

Basic Python Program

The simple python template program provides a basic set of functions for querying the G2S API via the Python platform for scientific computing.

#Python 2.7
#A Simple Python template program reading G2S APIs

import requests
from requests.auth import HTTPDigestAuth
import json

#Setup API, e.g.
#Can change to any valid URL in G2S API


# Set up API URL
url = hostName+apiName+"/"+varType+"/"+varName+"/"+apiType

# Request API
myResponse = requests.get(url)
#print (myResponse.status_code)

# For successful API call, response code will be 200 (OK)
    # Loads (Load String) takes a Json file and converts into python data structure (dict or list, depending on JSON)
        # In this Example, jData are lists of Residues from Genome Mapping to Protein Structures
    jData = json.loads(myResponse.content)
    #pring output
  # If response code is not ok (200), print the resulting http error code with description

Comprehensive Python Client

A comprehensive python client can be generated by swagger-Codegen as follows:

# swagger_client
A Genome to Strucure (G2S) API Supports Automated Mapping and Annotating Genomic Variants in 3D Protein Structures. Supports Inputs from Human Genome Position, Uniprot and Human Ensembl Names

This Python package is automatically generated by the [Swagger Codegen]( project:

- API version: 1.0 (beta)
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.PythonClientCodegen
For more information, please visit [](

## Requirements.

Python 2.7 and 3.4+

## Installation and Usage

git clone
cd swagger-codegen
mvn clean package
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
-i \
-l python \
-o {YOURFOLDER/}py_api_client

(if you're on Windows, replace the last command with java -jar modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i  -l python
-o {YOURFOLDER\}py_api_client)

### pip install (optional)

If you have not install certifi, you may need to run `pip install certif`

### Setuptools

Install via [Setuptools](

python install --user

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

from __future__ import print_function
import time
import swagger_client
from import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.GetAlignmentsApi()
id_type = 'ensembl' # str | Input id_type: ensembl; uniprot; uniprot_isoform
id = 'ENSP00000484409.1' # str | Input id e.g. ensembl:ENSP00000484409.1/ENSG00000141510.16/ENST00000504290.5; uniprot:P04637/P53_HUMAN; uniprot_isoform:P04637_9/P53_HUMAN_9
pdb_id = '2fej' # str | Input PDB Id e.g. 2fej
chain_id = 'A' # str | Input Chain e.g. A

    # Get PDB Alignments by ProteinId, PDBId and Chain
    api_response = api_instance.get_alignment_by_pdb_using_get(id_type, id, pdb_id, chain_id)
except ApiException as e:
    print("Exception when calling GetAlignmentsApi->get_alignment_by_pdb_using_get: %s\n" % e)


## Documentation for API Endpoints

All URIs are relative to **

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*GetAlignmentsApi* | [**get_alignment_by_pdb_using_get**](docs/ | **GET** /api/alignments/{id_type}/{id}/pdb/{pdb_id}_{chain_id} | Get PDB Alignments by ProteinId, PDBId and Chain
*GetAlignmentsApi* | [**get_alignment_using_get**](docs/ | **GET** /api/alignments/{id_type}/{id} | Get PDB Alignments by ProteinId
*GetAlignmentsApi* | [**get_pdb_alignment_by_sequence_using_get**](docs/ | **GET** /api/alignments | Get PDB Alignments by Protein Sequence
*GetAlignmentsApi* | [**get_pdb_alignment_by_sequence_using_post**](docs/ | **POST** /api/alignments | Get PDB Alignments by Protein Sequence
*GetResidueMappingApi* | [**get_pdb_alignment_reisude_by_sequence_using_get**](docs/ | **GET** /api/alignments/residueMapping | Get PDB Residue Mapping by Protein Sequence and Residue position
*GetResidueMappingApi* | [**get_pdb_alignment_reisude_by_sequence_using_post**](docs/ | **POST** /api/alignments/residueMapping | Get PDB Residue Mapping by Protein Sequence and Residue position
*GetResidueMappingApi* | [**post_residue_mapping_by_pdb_using_get**](docs/ | **GET** /api/alignments/{id_type}/{id}/pdb/{pdb_id}_{chain_id}/residueMapping | Post Residue Mapping by ProteinId, PDBId and Chain
*GetResidueMappingApi* | [**post_residue_mapping_by_pdb_using_post**](docs/ | **POST** /api/alignments/{id_type}/{id}/pdb/{pdb_id}_{chain_id}/residueMapping | Post Residue Mapping by ProteinId, PDBId and Chain
*GetResidueMappingApi* | [**post_residue_mapping_using_get**](docs/ | **GET** /api/alignments/{id_type}/{id}/residueMapping | POST PDB Residue Mapping by ProteinId
*GetResidueMappingApi* | [**post_residue_mapping_using_post**](docs/ | **POST** /api/alignments/{id_type}/{id}/residueMapping | POST PDB Residue Mapping by ProteinId

## Documentation For Models

 - [Alignment](docs/
 - [ResidueMapping](docs/

## Documentation For Authorization

 All endpoints do not require authorization.

## Author