sr2silo.silo
sr2silo.silo.LapisClient
Client for interacting with the Lapis API.
__init__(token_url, submission_url, organism)
Initialize the Lapis client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
token_url
|
str
|
URL for authentication token endpoint |
required |
submission_url
|
str
|
Base URL for submission endpoint |
required |
organism
|
str
|
Organism identifier (e.g., 'sc2', 'sars-cov-2') |
required |
authenticate(username, password)
Authenticate with the Lapis API.
request_upload(group_id, numberFiles)
Request S3 pre-signed URLs to upload files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group_id
|
int
|
The group ID for the upload request |
required |
numberFiles
|
int
|
The number of files to request upload URLs for |
required |
Returns:
Type | Description |
---|---|
List[RequestUploadResponse]
|
List of request-upload response objects containing fileId and pre-signed URL |
Raises:
Type | Description |
---|---|
Exception
|
If the request fails or authentication token is missing |
submit(group_id, metadata_file_path, processed_file_path=None, submission_id=None, data_use_terms_type='OPEN')
Submit data to the Lapis API using pre-signed upload approach.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group_id
|
int
|
The group ID for the submission |
required |
metadata_file_path
|
Path
|
Path to the metadata TSV file |
required |
processed_file_path
|
Path | None
|
Path to the processed data file (e.g., .ndjson.zst) |
None
|
submission_id
|
str | None
|
Unique identifier for this submission (auto-generated if not provided) |
None
|
data_use_terms_type
|
str
|
Data use terms type (default: "OPEN") |
'OPEN'
|
Returns:
Type | Description |
---|---|
SubmitResponse
|
Submit response object |
Raises:
Type | Description |
---|---|
Exception
|
If submission fails or authentication token is missing |
sr2silo.silo.Submission
Submission-related utilities. Methods for generating placeholder FASTA files containing "NNN" sequences, and S3 links
__init__(fasta, s3_link)
Initialize the Submission object.
create_metadata_file(result_dir)
staticmethod
Create a metadata TSV file with the required submissionId header.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result_dir
|
Path
|
Directory where to save the metadata file |
required |
Returns:
Type | Description |
---|---|
tuple[Path, str]
|
Tuple of (Path to the created metadata file, submission ID) |
generate_placeholder_fasta(submission_ids)
staticmethod
Generates a placeholder FASTA file for each submission ID with "NNN" as the sequence.
get_submission_ids_from_tsv(file_path)
staticmethod
Reads a TSV file and extracts submission IDs by parsing the "submissionId" column.