diff --git a/README.md b/README.md new file mode 100644 index 0000000..34d2cee --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# CD19 MicAbody Target Uploader + +This program was written to upload 45 unique targets with different combinations of light and heavy chain subunits. There are several variables that must be given to the program via the CLI in order for it to work: + +`--excel_file_location`: This flag is used to determine the location of an Excel file that contains data used to create each "target". +`--fasata_location`: This flag is used to determine the location of the directory that holds the amino acid and dna sequences fasta files. +`--API_URL`: This is the URL of the PTDB. +`--token`: This is the API token necessary to make HTTP requests to the PTDB. + +Use the following command (replacing the value of `API_URL` and `token` with the appropriate values) to run the program. + +`python3 target_uploader.py --fasta_location=./assets/CD19_MicAbody_Xolo_FASTA_Files/ --excel_file_location=./assets/XOLO_PTDB_Nomenclature.xlsx --API_URL=https://localhost8000/api/v1/absci-targets/target-registration --token=like-id-show-you` + +## Testing + +Unit tests are run to ensure that the program creates the correct target object. To run unit tests issue the following command: + +`python3 -m unittest tests/test_target_creator.py` \ No newline at end of file diff --git a/assets/XOLO_PTDB_Nomenclature.xlsx b/assets/XOLO_PTDB_Nomenclature.xlsx index 60999c8..679ea88 100644 Binary files a/assets/XOLO_PTDB_Nomenclature.xlsx and b/assets/XOLO_PTDB_Nomenclature.xlsx differ diff --git a/assets/~$XOLO_PTDB_Nomenclature.xlsx b/assets/~$XOLO_PTDB_Nomenclature.xlsx new file mode 100644 index 0000000..5a93205 Binary files /dev/null and b/assets/~$XOLO_PTDB_Nomenclature.xlsx differ diff --git a/lib/ptdb_request.py b/lib/ptdb_request.py index 6177db7..3e6f85d 100644 --- a/lib/ptdb_request.py +++ b/lib/ptdb_request.py @@ -1,18 +1,21 @@ import json import requests - -URL = "http://localhost:8000/api/v1/absci-targets/target-registration/" +from pprint import pprint class PTDBRequest(): - def __init__(self, new_target): + def __init__(self, new_target, user_input): + print(new_target['target']) self.target = json.dumps(new_target) + self.url = user_input['API_URL'] + self.token = user_input['token'] def post_target(self): headers = self.get_headers() - # request = requests.post(URL, data=self.target, headers=headers) + request = requests.post(self.url, data=self.target, headers=headers) + pprint(request.content) def get_headers(self): return { - "Authorization": f"Token {TOKEN}", + "Authorization": f"Token {self.token}", "Accept": "*/*", "Content-Type": "application/json" } diff --git a/target_uploader.py b/target_uploader.py index 417ed8e..e3e70d1 100644 --- a/target_uploader.py +++ b/target_uploader.py @@ -5,7 +5,7 @@ def upload_targets(user_input): for target in TargetCreator(user_input).targets: - PTDBRequest(target).post_target() + PTDBRequest(target, user_input).post_target() if __name__ == "__main__": parser = argparse.ArgumentParser(description="""This program was written to upload 45