Skip to content
This repository was archived by the owner on Dec 23, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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`
Binary file modified assets/XOLO_PTDB_Nomenclature.xlsx
Binary file not shown.
Binary file added assets/~$XOLO_PTDB_Nomenclature.xlsx
Binary file not shown.
13 changes: 8 additions & 5 deletions lib/ptdb_request.py
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion target_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down