acasclient package¶
Submodules¶
acasclient.acasclient module¶
Main module.
-
class
acasclient.acasclient.client(creds)[source]¶ Bases:
object-
add_file_to_lot(lot_corp_name, file, file_type, writeup=None)[source]¶ Add a file to a lot
Uploads and attaches a file to a lot
- Args:
- lot_corp_name (str): The corp name of the lot to attach the files to. file (Path): The file path to upload type (str): The type of file to upload writeup (str): The writeup for the file
Returns: A dict with errors array and metalot dict object with the files attached to the lot
-
add_files_to_lot(lot_corp_name, files)[source]¶ Attach files to a lot.
Attach files to a lot by passing a list of files and the lot’s corp name.
- Args:
lot_corp_name: The corp name of the lot to attach the files to. files: An array of dicts with the following keys
“file” (Path): The file path to upload “type” (str): The type of file to upload “writeup” (str): The writeup for the file
Returns: A dict with errors array and metalot dict object with the files attached to the lot
-
add_parent_alias(parent_corp_name: str, alias: str, ls_type: str = None, ls_kind: str = None) → None[source]¶ Adds a new alias to the specified parent. Does not alter existing aliases.
- Args:
- parent_corp_name (str): The parent compound to add the alias to alias (str): The alias to add ls_type (str): The LS type of the alias, default None ls_kind (str): The LS kind of the alias, default None
- Returns:
- The updated MetaLot object
-
advanced_search_ls_things(ls_type, ls_kind, search_string, value_listings=[], label_listings=[], first_itx_listings=[], second_itx_listings=[], codes_only=False, max_results=1000, combine_terms_with_and=False, format='stub', return_listings=None)[source]¶ Query ACAS for deeply specified conditions
- Args:
ls_type (str): LsThing lsType to match ls_kind (str): LsThing lsKind to match search_string (str): str to match on or compare to value_listings (list): list of dicts of a structure like:
- {
- “stateType”: “metadata”, “stateKind”: “pdb”, “valueType”: “stringValue”, “valueKind”: “librarian search status”, “operator”: “=”
}
combine_terms_with_and (bool): Whether to combine terms with ‘and’ format (str): ACAS format to fetch data in return_listings (dict): Used when format = “flat”. Return only the defined values or label listings and thing attributes in key value pair format.
- {
- “thingValues”: [
- {
- # Code value return listing “key”: return_status_key, “stateType”: “metadata”, “stateKind”: “project metadata”, “valueType”: “codeValue”, “valueKind”: PROJECT_STATUS
}, {
# String value return listing “key”: return_description_key, “stateType”: “metadata”, “stateKind”: “project metadata”, “valueType”: “stringValue”, “valueKind”: DESCRIPTION_KEY}, {
# Date value return listing “key”: return_startdate_key, “stateType”: “metadata”, “stateKind”: “project metadata”, “valueType”: “dateValue”, “valueKind”: START_DATE}, {
# Label return listing “key”: return_name_key, “labelType”: “name”, “labelKind”: PROJECT_NAME,}, {
# Numeric Value return listing “key”: return_project_number_key, “stateType”: “metadata”, “stateKind”: “project metadata”, “valueType”: “numericValue”, “valueKind”: PROJECT_NUMBER}
], “thingAttributes”: [“codeName”, “id”, “modifiedDate”]
}
- Returns:
- if codes_only:
- list of code_name strings
- otherwise:
- list of LsThing objects
-
check_cmpdreg_bulk_load_file_dependency(id)[source]¶ Check cmpdreg bulk load file dependencies
Check for dependencies of cmpdreg bulk load file
- Args:
- id (int): A bulk load file id
- Returns: Dict object with file content
- canPurge (bool): Can this file be purged summary (str): An html formatted summary of the dependencies
-
cmpd_search(corpNameList='', corpNameFrom='', corpNameTo='', aliasContSelect='contains', alias='', dateFrom='', dateTo='', searchType='substructure', percentSimilarity=90, chemist='anyone', maxResults=100, molStructure='', projectCodes=None)[source]¶
-
cmpd_structure_search(searchType='substructure', percentSimilarity=90, maxResults=100, molStructure='')[source]¶
Create an author
- Args:
- author (dict): A dict object representing the author to create
- Returns:
- a dict object representing the new author
Create authors
- Args:
- authors (list): A list of dicts representing the authors to create
- Returns:
- a list of dict objects representing the saved authors
-
create_label_sequence(labelPrefix, startingNumber, digits, labelSeparator, labelTypeAndKind=None, thingTypeAndKind=None, labelSequenceRoles=[])[source]¶ Create a label sequence
- Args:
- labelPrefix (str): Prefix of the label startingNumber (str): Set to 0 for the first number to be 1 digits (str): The number of leading zeros to add to the label sequence when formatting (e.g. CMPD-0000007 would be digts: 7 ) labelTypeAndKind (str): the label type and kind associated with this sequence (used for finding all labels of a specific label type and kind in some interfaces) thingTypeAndKind (str): the thing type and kind associated with this sequence (used for finding all labels of a specific thing type and kind in some interfaces) labelSequenceRoles (list): the registered role to associate with this label (used for limiting access to specific label sequences in some interfaces)
- Returns:
- a dict object representing the new label sequence
-
delete_experiment(idOrCode)[source]¶ Delete an experiment
Deletes an experiment. If a code name is given, the experiment is first retrieved by code name and then deleted by id.
- Args:
- idOrCode (int or str): An experiment id or an experiment code name
- Returns: Dict object with the experiment status value of the deleted
- experiment
-
delete_lot(lot_corp_name)[source]¶ Delete a lot
- Args:
- lot_corp_name (str): Corp name of lot to delete
- Returns:
A dict with “success”: true if successful. For example {
“success”: true} Or None if there was an error
- Raises:
- HTTPError: If permission denied
-
delete_ls_thing(ls_type, ls_kind, code_name, format)[source]¶ Deletes a models.LsThing object by ls_type, ls_kind, and code_name Args:
ls_type (str): Type of ls thing ls_kind (str): Kind of ls thing code_name (str): Code name of ls thing format (str)
-
dose_response_experiment_loader(model_fit_type, fit_settings, **kwargs)[source]¶ Dose response experiment loader
- Args:
- model_fit_type (str): The type of model fit to perform fit_settings (dict): The settings for the model fit **kwargs: All required arguments to pass to the experiment loader (e.g. data_file, user, dry_run = True/False)
- Returns:
dict: The response from the experiment loader and doseresponse fit request
Example:
- {
- “experiment_loader_response”: experiment_loader_response_resp_dict, “dose_response_fit_response”: dose_response_fit_response_resp_dict
}
- Example:
- request = {
“data_file”: data_file_to_upload, “user”: “bob”, “dry_run”: True, “model_fit_type”: “4 parameter D-R”, “fit_settings”: {
“smartMode”:True, “inactiveThresholdMode”:True, “inactiveThreshold”:20, “theoreticalMaxMode”:False, “theoreticalMax”:None, “inverseAgonistMode”:False, “max”:{
“limitType”:”none”}, “min”:
- {
- “limitType”:”none”
}, “slope”:{
“limitType”:”none”}, “baseline”:{
“value”:0}
}
} response = client. dose_response_experiment_loader(**request)
-
edit_parent(parent, dry_run=True) → Tuple[bool, Dict[KT, VT]][source]¶ Makes changes to an existing parent. Returns (status, data) where status is a bool representing success (True) or failure (False) data is a dict of supporting information. In case of failure it contains a list of duplicates In case of success it contains a list of affected lots
-
experiment_loader(data_file, user, dry_run, report_file='', images_file='', validate_dose_response_curves=True)[source]¶ Load an experiment
Load an experiment into ACAS.
- Args:
- data_file (str): A path to an experiment loader formatted file user (str): A username dry_run (bool): If true, then validate but do not load the data into the database report_file (str): A path to a report file (optional) images_file (str): A path to an images file (optional)
-
experiment_search(query, project_codes=None)[source]¶ Search for experiments by search term
Get an array of experiments given an experiment search term string and optional project code(s) filter
- Args:
- query (str): An experiment search term project_codes (str list): A list of project codes to filter by
en array of protocols
-
export_cmpd_search_results(search_results)[source]¶ Export an sdf of compound search results.
Given a search results dict object this will export a list of matching compounds to an SDF file.
- Args:
- search_results: Dict object
Search criteria for lots
search_results = { "foundCompounds": [ { "lotIDs": [ { "corpName": "CMPD-0000001-001" } ], } ] }
Full List of potential search results
search_results = { "foundCompounds": [ { "corpName": "CMPD-0000001", "corpNameType": "Parent", "lotIDs": [ { "corpName": "CMPD-0000001-001", "lotNumber": 1, "registrationDate": "01/29/2020", "synthesisDate": "01/29/2020" } ], "molStructure": "MOLFILE STRUCTURE" "parentAliases": [], "stereoCategoryName": "Achiral", "stereoComment": "" } ], "lotsWithheld": False }
- Returns:
- An object of responses from ACAS in the form:
{'reportFilePath': '/dataFiles/exportedSearchResults/2020_02_12_1581466283857_searchResults.sdf', 'summary': 'Successfully exported 1 lots.' }
See the output of
get_sdf_file_for_lots()for SDF details.
-
get_all_ddict_values()[source]¶ Get all ddict values
- Returns:
- a list of dict objects representing the ddict value (aka code value)
-
get_all_label_sequences()[source]¶ Get all label sequences (limited to those authorized by logged in user roles)
- Returns:
- a list of dict objects representing the labelSequence
-
get_all_lots(project_codes=None)[source]¶ Get all lots
Get all lots the currently logged in user is allowed to access
- Args:
- project_codes (list): A list of project codes to filter by
- Returns: Returns an array of dict objects
- id (id): the lot corp name lotCorpName (str): the lot corp name lotNumber (int): the lot number parentCorpName (str): the lots parent corp name registrationDate (int): the registration date project (str): the lots project
-
get_all_meta_lots(project_codes=None)[source]¶ Get all meta lots
Get all meta lots the currently logged in user is allowed to access
- Args:
- project_codes (list): A list of project codes to filter by
Returns: Returns an array of dict objects respresenting meta lots
Get author by username
- Args:
- username (str): The username of the author to fetch
- Returns:
- a dict object representing the author
Get all authors
- Returns:
- a list of dict objects representing the authors
-
get_blob_data_by_value_id(valueId)[source]¶ Get blob data by value id Args:
valueId (int): A known value id to fetch from the database that is stored as a blobValue lsType- Returns:
- (bytes): representing the blob value
-
get_cmpdreg_bulk_load_files()[source]¶ Get cmpdreg bulk load files
Gets a list of all cmpdreg bulk files on the system
- Returns: An array of dict objects
- fileDate (int): The epoch date the file was registered fileName (str): The name of the file fileSize (int): Size in bytes of the file id (int): The file id numberOfMols (int): Number of mols registered by this file recordedBy (str): Username of the user who registered the file version (int): The file version number
-
get_ddict_values_by_type_and_kind(codeType=None, codeKind=None)[source]¶ Get ddict values
- Returns:
- a list of dict objects representing the ddict value (aka code value)
-
get_experiment_by_code(experiment_code, full=False)[source]¶ Get an experiment from an experiment code
Get an experiment given an experiment code
- Args:
- experiment_code (str): An experiment code code full (bool): If true, return the full experiment object
Returns: Returns an experiment object
-
get_experiment_by_name(experiment_name)[source]¶ Get an experiment from experiment name
Get an experiment given an experiment name
- Args:
- experiment_name (str): An experiment name
Returns: Returns an experiment object or None if the experiment not found
-
get_experiments_by_protocol_code(protocol_code)[source]¶ Get all experiments for a protocol from a protocol code
Get an array of experiments given a protocol code
- Args:
- protocol_code (str): A protocol code
Returns: Returns an array of experiments
-
get_file(file_path, parse_content=True)[source]¶ Get a file from ACAS
Get a file from ACAS
- Note:
- If behind a proxy some fields (denoted with a
*) may not be filled - Args:
- file_path (str): A path to a file known to exist in ACAS
- Returns: ACAS file dict object with file content
- content-type* (str): Content type of the file content-length* (int): Content length in bytes of the file last-modified* (str): Date file was last mofied name (str): Name of the file content (str): Content of the file parsed_content (depends): Parsed content of the file
-
get_label_sequence_by_types_and_kinds(labelTypeAndKind=None, thingTypeAndKind=None)[source]¶ Get label sequence by types and kinds (limited to those authorized by logged in user roles)
- Args:
- labelPrefix (str): Prefix of the label startingNumber (str): Set to 0 for the first number to be 1 digits (str): The number of leading zeros to add to the label sequence when formatting (e.g. CMPD-0000007 would be digts: 7 ) labelTypeAndKind (str): the label type and kind associated with this sequence (used for finding all labels of a specific label type and kind in some interfaces) thingTypeAndKind (str): the thing type and kind associated with this sequence (used for finding all labels of a specific thing type and kind in some interfaces) labelSequenceRoles (list): the registered role to associate with this label (used for limiting access to specific label sequences in some interfaces)
- Returns:
- a list of dict objects representing the labelSequence
-
get_labels(labelTypeAndKind, thingTypeAndKind, numberOfLabels)[source]¶ Get next n labels from label sequence prefix
- Args:
- labelTypeAndKind (str): Prefix of the registered label (see create_label_sequence) numberOfLabels (int): Number of labels to fetch
- Returns:
- a list of dict objects representing the labelSequence
-
get_lot_corp_names_by_bulk_load_file(id)[source]¶ Get an array of lot corp names from a bulk load file
- Args:
- id (int): A bulk load file id
Returns: An array of lot corp names
-
get_lot_dependencies(lot_corp_name, include_linked_lots=True, include_analysis_group_values=True)[source]¶ Get lot dependencies for a lot by corp name
- Args:
- lot_corp_name (str): Corp name of lot to get dependencies for include_linked_lots (bool): Whether to include linked lots in the response, default True. Linked lots are purely informational as they are not a dependency preventing the lot from being deleted. include_analysis_group_values (bool): Whether to include analysis group values in the response, default True. Analysis group values are purely informational as they are not a dependency preventing the lot from being deleted.
- Returns:
A dict of the lot dependencies For example: {
- “batchCodes”: [
- “CMPD-0000001-001”
], “linkedDataExists”: true, “linkedExperiments”: [
- {
- “acls”: {
- “delete”: true, “read”: true, “write”: true
}, “code”: “EXPT-00000009”, “comments”: “CMPD-0000001-001”, “description”: “6 results”, “ignored”: false, “name”: “BLAH”, “analysisGroups”: [
- {
“code”: “AG-00000001”, “values”: [
- {
- “id”: 1, “lsKind”: “key”, “lsType”: “numericValue”, “value”: 6
}
]
}
], “protocol”: {
“code”: “PROT-00000001”, “name”: “Test Protocol”}
}
], “linkedLots”: [
- {
- “acls”: {
- “delete”: false, “read”: true, “write”: true
}, “code”: “CMPD-0000001-002”, “ignored”: false, “name”: “CMPD-0000001-002”
}
], “lot”: {
…the lot info…}
}
- Raises:
- HTTPError: If permission denied
-
get_ls_thing(ls_type, ls_kind, code_name, nestedfull=True)[source]¶ Get a models.LsThing object by ls_type, ls_kind, and code_name
- Args:
- ls_type (str): Type of ls thing ls_kind (str): Kind of ls thing code_name (str): Code name of ls thing
-
get_ls_things_by_codes(ls_type, ls_kind, code_name_list, nestedfull=True)[source]¶ Get a list of ls thing dict objects from a list of their code_names
- Args:
- ls_type (str): ls_type for all things to retrieve ls_kind (str): ls_kind for all things to retrieve code_name_list (str list): list of str code_names
-
get_ls_things_by_type_and_kind(ls_type, ls_kind, format='stub')[source]¶ Get a list of ls thing dict objects from ls_type and ls_kind
- Args:
- ls_type (str): ls_type for all things to retrieve ls_kind (str): ls_kind for all things to retrieve
-
get_meta_lot(lot_corp_name)[source]¶ - Get metalot by lot corp name
- Granted read permission on a lot if one of these is true:
- The user is the owner of the lot (chemist or recorded by)
- The user has access to the project the lot is associated with
- The user is a cmpdreg admin
- Args:
- lot_corp_name (str): A lot corp name
Returns: Returns a dict meta lot object
-
get_meta_lots_by_lot_corp_names(lot_corp_names, max_workers=10)[source]¶ Get meta lots by lot corp names
Get meta lots by lot corp names
- Args:
- lot_corp_names (list): A list of lot corp names
Returns: Returns an array of dict objects respresenting meta lots
-
get_parent_aliases(parent_corp_name: str) → List[str][source]¶ Get the current parent aliases by parent_corp_name
-
get_protocols_by_label(label)[source]¶ Get all experiments for a protocol from a protocol label
Get an array of experiments given a protocol label
- Args:
- label (str): A protocol label
Returns: Returns an array of experiments
-
get_saved_entity_codes(ls_type, ls_kind, id_list, label_type=None, label_kind=None)[source]¶ Query ACAS to determine which identifiers (labels) are already saved
- Args:
- ls_type (str): LsThing lsType to query for ls_kind (str): LsThing lsKind to query for id_list (str): list of identifier strings label_type (str): label_type to limit label searches label_kind (str): label_kind to limit label searches
- Returns:
- saved_codes (dict): dict of identifier : LsThing codeName for previously saved entities missing_ids (list): list of identifiers that were not found to be previously saved
-
get_sdf_by_bulk_load_file(id)[source]¶ Get an SDF file from a bulk load file id
- Args:
- id (int): A bulk load file id
Returns: (str) representaiton of the SDF file
-
get_sdf_file_for_lots(lots)[source]¶ Get an SDF file object from an array of lot corp names
Given an array of lots this function fetches and SDF file for those lots with their lot and parent attibutes
- Args:
- lots: Array of lot corp names
- Returns:
- ACAS file dict object with sdf content
Output object structure:
{'content-type': 'application/octet-stream', 'content-length': '1642', 'last-modified': 'Wed, 12 Feb 2020 00:49:09 GMT', 'name': '2020_02_12_1581468549556_searchResults.sdf', 'content': b'SDFILE CONTENT'}
SDF Attributes:
- Amount Units Code (str): amount units
- Buid (int): legacy field not used
- Bulk Load File (str): Bulk load file that the lot came from
- Chemist (str): the lot chemist
- Lot Corp Name (str):
- Is Virtual (bool): Is this a virtual compound
- Lot Mol Weight (float): Lot weight (includes salt weight)
- Lot Number (int):
- Project (str):
- Registration Date (str): Lot registration date in the format “2020-02-11”
- Lot Registered By (str):
- Salt Form Corp Name (str): Salt form name
- Parent Corp Name (str):
- Parent Number (int): Internal parent identifier
- Parent Stereo Category (str):
- Parent Mol Weight (float):
- Parent Exact Mass (float):
- Parent Mol Formula (str):
- Parent Registration Date (str): Parent registration date in the format “2020-02-11”
- Parent Registered By (str):
-
get_source_file_for_experient_code(experiment_code)[source]¶ Get the source file for an experiment
Gets the experiment loader file for ACAS
- Note:
- If behind a proxy some fields (denoted with a
*) may not be filled - Args:
- file_path (str): A path to a file known to exist in ACAS
- Returns: ACAS file dict object with file content
- content-type* (str): Content type of the file content-length* (int): Content length in bytes of the file last-modified* (str): Date file was last mofied name (str): Name of the file content (str): Content of the file
-
get_thing_codes_by_labels(thing_type, thing_kind, labels_or_codes, label_type=None, label_kind=None)[source]¶ Get a list of thing codes by providing a list of labels
- Args:
- labels_or_codes (str list): list of str labels or codes thing_type (str): ls_type for all things to retrieve thing_kind (str): ls_kind for all things to retrieve label_type (str): label_type to limit label searches label_kind (str): label_kind to limit label searches
- Returns:
- ref_name_lookup_results: list of objects with
- requestName (str): input label string preferredName (str): LsThing preferred label string referenceName (str): LsThing code name string
-
projects()[source]¶ Get projects authorized to user.
List of projects user is authorized to see.
- Args:
- None
- Returns:
An array of dict objects representing the projects the user has access to.
For example:
[ {'active': True, 'alias': 'Global', 'code': 'PROJ-00000001', 'id': 2, 'isRestricted': False, 'name': 'Global'} ]
-
protocol_search(search_term)[source]¶ Search for protocols by search term
Get an array of protocols given a protocol search term string
- Args:
- searchTerm (str): A protocol search term
Returns: Returns an array of protocols
-
purge_cmpdreg_bulk_load_file(id)[source]¶ Purge a cmpdreg bulk load file
Purges a cmpdreg bulk load file
- Args:
- id (int): A bulk load file id
- Returns: Dict object with file content
- fileName (str): The name of the file that was purged success (bool): Did the file purge successfully summary (str): An html formatted summary of the purge results
-
reparent_lot(lot_corp_name, new_parent_corp_name, dry_run=True)[source]¶ Reparent a lot
- Args:
- lot_corp_name (str): Corp name of lot to reparent new_parent_corp_name (str): Corp name of new parent dry_run (bool): Whether to perform a dry run, default True
- Returns:
A dict with information about expected changes {
- “dependencies”: {
- “linkedDataExists”: true, …other dependency data…
}, “modifiedBy”: “bob”, “newLot”: {
“corpName”: “CMPD-0000003-002”, …other lot info… “saltForm”: {
…salt form info… “parent”: {
“corpName”: “CMPD-0000003”, …other parent info…},
}, “originalLotCorpName”: “CMPD-0000001-001”, “originalParentCorpName”: “CMPD-0000001” “originalParentDeleted”: true
}
Or None if there was an error
- Raises:
- HTTPError: If permission denied
-
save_ls_thing(ls_thing)[source]¶ Persist a models.LsThing object to ACAS
- Args:
- ls_thing (dict): A dict object representing an ls thing
Returns: Dict object representing a saved ls_thing
-
save_ls_thing_list(ls_thing_list)[source]¶ Save a list of ls thing dict objects
- Args:
- ls_thing_list (str): list of ls_thing dict objects
-
save_meta_lot(meta_lot)[source]¶ - Save a meta lot to the server
- If updating a saved lot permissions are granted if one of these is true:
- Edit my lots is configured to true on the system and..
- The user is the owner of the lot (chemist or recorded by)
- The user has access to the project the lot is associated with
- The user is a cmpdreg admin
- Args:
- meta_lot (dict): A meta lot
Returns: Returns a dict meta lot object
-
set_parent_aliases(parent_corp_name: str, alias_list: List[str]) → None[source]¶ Sets the aliases of the specified parent to ONLY the provided list. This will remove existing aliases if they are not in alias_list. To add aliases without removing existing ones, use the add_parent_alias method.
-
setup_items(item_type, items)[source]¶ - Create or update items of a given typeKind
- ACAS Admin role for this operation
- Args:
- item_type (str): Type of item to create or update items (list): List of items to create or update
-
swap_parent_structures(corp_name1: str, corp_name2: str) → Dict[str, str][source]¶ Swap parent structures.
- Args:
- corp_name1 (str): Corporate ID of the first parent compound. corp_name2 (str): Corporate ID of the second parent compound.
- Returns:
A dict with “hasError” and “errorMessage” keys. For example {
“hasError”: True, “errorMessage”: “Swapping corpName1=CMPD-1 & corpName2=CMPD-2 creates duplicates.”}
Update an author
- Args:
- author (dict): A dict object representing the author to update
- Returns:
- a dict object representing the updated author
Update author roles
- Args:
- new_author_roles (list): A list of dicts representing the new author roles to create author_roles_to_delete (list): A list of dicts representing the author roles to delete
- Returns:
- a list of dict objects representing the saved author roles
-
update_ls_thing_list(ls_thing_list)[source]¶ Update a list of ls thing dict objects
- Args:
- ls_thing_list (str): list of ls_thing dict objects
-
update_project_roles(new_author_roles=None, author_roles_to_delete=None)[source]¶ Same as update author roles but with a different endpoint name.
-
upload_files(files)[source]¶ Upload a list of files to ACAS.
Pass an array of files to ACAS and upload them to the server
- Args:
- files: An array of either string paths, Path objects (see
pathlib.Path), base64 encoded strings, or dicts with “name” and “data” (base64 encoded data) attributes. - Returns:
- An object of responses from ACAS in the form:
{'files': [ {'name': '1_1_Generic.xlsx', 'originalName': '1_1_Generic.xlsx', 'size': 12887, 'type': None, 'deleteType': 'DELETE', 'url': 'http://localhost:3000/dataFiles/1_1_Generic.xlsx', 'deleteUrl': 'http://localhost:3000/uploads/1_1_Generic.xlsx'} ]}
-
write_sdf_file_for_lots(lots, dir_or_file_path)[source]¶ Get and write an SDF from lot corp name array
Given an array of lots this function fetches and SDF file for those lots with their lot and parent attibutes and write an SDF file
- Args:
- lots: Array of lot corp names
- Returns:
- ACAS file dict object with sdf content
See the output of
get_sdf_file_for_lots()for SDF details.
-
-
acasclient.acasclient.creds_from_file(fpath, profile='default')[source]¶ Fetches crecentials from a file
Retrieves credentials from a file.
- Args:
- fpath: Path to the credentials file profile: Optional string which specifies which section to read from the credentials file. Defaults to “default”
- Returns:
- A section of the configuration file.
-
acasclient.acasclient.get_default_credentials(profile='default')[source]¶ Fetches default credentials to use for client authentication.
Retrievies credentials from ~/.acas/credentials file or preferentially from the environment variables ACAS_API_{USERNAME, PASSWORD and URL}
- Args:
- profile: Optinal string which specifies which section to read from the credentials file.
- Returns:
A dict of credentials fetched. For example:
{'username': "USERNAME", 'password': "PASSWORD", 'url': "URL"}
Example setting via environment variables:
$ export ACAS_API_USERNAME=bob $ export ACAS_API_PASSWORD=secret $ export ACAS_API_URL=http://localhost:3000
If any one of the three environment variables are not found then the credentials file at
~/.acas/credentialsis used.Example credentials file:
[default] username=bob password=secret url=http://localhost:3000
If the environment variable
ACAS_API_PROFILEis set then it will be used as the default credential section from the credentials file otherwise, the[default]section is used. For example:$ export ACAS_API_PROFILE=myserver
The
myserversection credentials will be read:[mysever] username=bob password=secret url=http://localhost:3000
-
acasclient.acasclient.get_entity_label_by_label_type_kind(entity: dict, label_type: str, label_kind: str) → str[source]¶ Get a label from an acas entity dict object.
Gets a specific label from an acas entity dict object.
- Args:
- entity: Any ACAS entity (protocol, experiment, analysis_group, treatment_group, container…etc.) label_type: String. The label type of the value. label_kind: String. The label kind of the value.
- Returns:
- A dict object representing the label if it exits. Otherwise it returns None
-
acasclient.acasclient.get_entity_value_by_state_type_kind_value_type_kind(entity, state_type, state_kind, value_type, value_kind)[source]¶ Get a value from an acas entity dict object.
Gets a specific value from an acas entity dict object.
- Args:
- entity: Any ACAS entity (protocol, experiment, analysis_group, treatment_group, container…etc.) state_type: String. The state type of the value. state_kind: String. The state kind of the value. value_type: String. The value type of the value. value_kind: String. The value type of the value.
- Returns:
- A dict object representing the value if it exits. Otherwise it returns None
-
acasclient.acasclient.get_entity_values_by_state_type_kind_value_type(entity, state_type, state_kind, value_type)[source]¶ Gets values from an acas entity dict object.
Gets values from an acas entity dict object by state type, state kind and value type.
- Args:
- entity: Any ACAS entity (protocol, experiment, analysis_group, treatment_group, container…etc.) state_type: String. The state type of the value. state_kind: String. The state kind of the value. value_type: String. The value type of the value.
- Returns:
- A list of dict objects representing the values if they exits. Otherwise it returns an empty list
-
acasclient.acasclient.get_mol_as_dict(mol)[source]¶ Returns a dict representation of a molecule in cluding the mol block, the ctab and the properties as a key value pair
-
acasclient.acasclient.parse_file(file_content, file_extension)[source]¶ Parse content from a string into an extension specific format
- Args:
- file_content (str): Content of the file file_extension (str): Extension of the file
- Returns:
- Parsed content of the file in a format specific to the extension
acasclient.cli module¶
Console script for acasclient.
Module contents¶
Top-level package for acasclient.