Tiny-CLI Commands

Here are all the commands available in the tiny-cli package

Workbench

tiny.create_workbench(name: str) -> Workbench

Create a new workbench with the given name.

workbench = tiny.create_workbench('some-workbench-name')
The some-workbench-name-20230410160630063331 workbench is now available. 

workbench = tiny.Workbench(name: str)

initialize your workbench

workbench = tiny.Workbench('some-workbench-name-20230410160630063331')

tiny.list_workbenches()

list all your workbenches

tiny.list_workbenches()
+--------------------------------------------+----------+----------------+
| Workbench Name                             | Size     | Last Updated   |
+============================================+==========+================+
| atac-seq-20230406175308669217              | 161.7 GB | 7 days ago     |
+--------------------------------------------+----------+----------------+
| reproduce-covid-paper-20230404201606359927 | 582.4 GB | 9 days ago     |
+--------------------------------------------+----------+----------------+
| rna-seq-20230410171413789657               | 46.2 GB  | 3 days ago     |
+--------------------------------------------+----------+----------------+

Jobs

workbench.run(tool: str, full_command: str)

Run the specified command on the current workbench using the specified tool.

workbench.run(
    tool="samtools", 
    full_command="samtools quickcheck /output/mapping/sorted/CRR119890_Aligned_sorted.bam"
)
+---------------------+----------+----------+----------+----------------------------------------------+---------------------------------------------------------------------------------+
| Job ID              | Version  | Tool     | Status   | Get Logs                                     | Full Command                                                                    |
+=====================+==========+==========+==========+==============================================+=================================================================================+
| samtools-9284deada3 | 1.16     | samtools | Queued   | workbench.jobs['samtools-9284deada3'].logs() | samtools quickcheck /output/mapping/sorted/CRR119890_Aligned_sorted.bam |
+---------------------+----------+----------+----------+----------------------------------------------+---------------------------------------------------------------------------------+

workbench.jobs()

Return all jobs on workbench

workbench.jobs()
+---------------------+----------+----------+-----------+----------------------------------------------+---------------------------------------------------------------------------------+
| Job ID              | Version  | Tool     | Status    | Get Logs                                     | Full Command                                                                    |
+=====================+==========+==========+===========+==============================================+=================================================================================+
| samtools-9284deada3 | 1.16     | samtools | Scheduled | workbench.jobs['samtools-9284deada3'].logs() | samtools quickcheck /output/mapping/sorted/CRR119890_Aligned_sorted.bam         |
+---------------------+----------+----------+-----------+----------------------------------------------+---------------------------------------------------------------------------------+

workbench.jobs(exclude: List[str])

you can exclude certain statuses from the list of jobs

workbench.jobs(exclude=['Succeeded'])
+---------------------+----------+----------+-----------+----------------------------------------------+---------------------------------------------------------------------------------+
| Job ID              | Version  | Tool     | Status    | Get Logs                                     | Full Command                                                                    |
+=====================+==========+==========+===========+==============================================+=================================================================================+
| samtools-9284deada3 | 1.16     | samtools | Running   | workbench.jobs['samtools-9284deada3'].logs() | samtools quickcheck /output/mapping/sorted/CRR119890_Aligned_sorted.bam         |
+---------------------+----------+----------+-----------+----------------------------------------------+---------------------------------------------------------------------------------+

workbench(job_id: str).get_status()

Get the status of the specified job.

workbench.jobs('samtools-9284deada3').get_status()
Running

Logs

workbench.jobs(job_id: str).logs()

Return the logs of a specific job

workbench.jobs('samtools-9284deada3').logs()
'Analysis complete for SRR6357070_1.fastq.gz' 
'Started analysis of SRR6357070_2.fastq.gz'
'Approx 5% complete for SRR6357070_2.fastq.gz\n'

workbench.jobs(job_id: str).stream_logs()

Stream logs of a specific job

workbench.jobs('samtools-9284deada3').stream_logs()
'Analysis complete for SRR6357070_1.fastq.gz' 
'Started analysis of SRR6357070_2.fastq.gz'
'Approx 5% complete for SRR6357070_2.fastq.gz\n'
'end of stream'

File Management

workbench.ls() -> List[str]

List all the files on the current workbench.

worbench.ls()
reproduce-covid-paper-20230404201606359927
└── output
    └── mapping
        ├── 
        │   └── output/mapping/ (0 Bytes)
        ├── CRR119890_Aligned.out.bam
        │   └── output/mapping/CRR119890_Aligned.out.bam (17.6 GB)
        ├── CRR119890_Aligned.toTranscriptome.out.bam
        │   └── output/mapping/CRR119890_Aligned.toTranscriptome.out.bam (14.4 GB)
        ├── CRR119890_Log.final.out
        │   └── output/mapping/CRR119890_Log.final.out (2.0 kB)

workbench.ls(path: str)

List all the files in the provided directory on the current workbench.

workbench.ls('output/')
reproduce-covid-paper-20230404201606359927
└── output
    └── mapping
        ├── 
        │   └── output/mapping/ (0 Bytes)
        ├── CRR119890_Aligned.out.bam
        │   └── output/mapping/CRR119890_Aligned.out.bam (17.6 GB)
        ├── CRR119890_Aligned.toTranscriptome.out.bam
        │   └── output/mapping/CRR119890_Aligned.toTranscriptome.out.bam (14.4 GB)
        ├── CRR119890_Log.final.out
        │   └── output/mapping/CRR119890_Log.final.out (2.0 kB)

workbench.create_directory(path: str)

create a directory on your workbench

wb.create_directory('/foo/bar')
+----------------------------------+-------------------------+-------------------+
| Workbench                        | Directory               | Message           |
+==================================+=========================+===================+
| test-20230412165811062848        | /foo/bar                | Directory created |
+----------------------------------+-------------------------+-------------------+

workbench.upload(file_path: str)

Upload the specified file to the current workbench

workbench.upload('/path/to/file/samplesheet_core.csv')
Uploading /path/to/file/samplesheet_core.csv to samtools-test-20221208212343699098
{'/path/to/file/samplesheet_core.csv': 'input/samplesheet_core.csv'}

workbench.upload_job(method: str, files: List[Tuple[str, str]])

Upload the specified files to the current workbench using the specified method.

files = [
    (
        'ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR102/093/SRR10261593/SRR10261593_1.fastq.gz', 
        'input/sample_data/SRR10261593_ATAC-Seq_of_S._cerevisiae_at_30C_rep1_1.fastq.gz'
    ), 
    (
        'ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR102/093/SRR10261593/SRR10261593_2.fastq.gz', 
        'input/sample_data/SRR10261593_ATAC-Seq_of_S._cerevisiae_at_30C_rep1_2.fastq.gz'
    )
    # (input_url, workbench_destination)
]

workbench.upload_job(method='curl', files=files)
+-----------------+--------+----------+------------------------------------------+----------------------------------------------------------------------------------+
| Job ID          | Tool   | Status   | Get Logs                                 | Full Command                                                                     |
+=================+========+==========+==========================================+==================================================================================+
| curl-e129d17f4c | curl   | Queued   | workbench.jobs['curl-e129d17f4c'].logs() | curl                                                                             |
|                 |        |          |                                          | ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR102/093/SRR10261593/SRR10261593_1.fastq.gz |
+-----------------+--------+----------+------------------------------------------+----------------------------------------------------------------------------------+
| curl-2b319c97c2 | curl   | Queued   | workbench.jobs['curl-2b319c97c2'].logs() | curl                                                                             |
|                 |        |          |                                          | ftp://ftp.sra.ebi.ac.uk/vol1/fastq/SRR102/093/SRR10261593/SRR10261593_2.fastq.gz |
+-----------------+--------+----------+------------------------------------------+----------------------------------------------------------------------------------+

workbench.download(file_path: str)

Download the specified file from the current workbench.

workbench.download('cli-test-out.sam')
{'download_url': 'https://storage.googleapis.com/samtools-test-20221208212343699098/cli-test-out.sam?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=tiny-api%40nextflow-test-366601.iam.gserviceaccount.com%2F20221215%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20221215T181037Z&X-Goog-Expires=3600&X-Goog-SignedHeaders=host&X-Goog-Signature=2f9fe015912c436d5be285853e51c1897189d1df9ac66fdae68a11d69535ddaafbc54923d24a9044608390c74e54c9ebf924f62957d9d47aa69112d4788b6bd1020f435ab27069d4f5a9df816fd98f6967c5b1cf6eaf95cc978bf8d245202f4e5a3dd58f4b17ed84221f5e73f74ea78e6a4459b9998b5194ebe3a86a2f9ad7f0517d0fd0297e6a02f3e856baa85ee341afe7c26e788f687ba5632a2e3db4729e17f53c37bd5d5592fe22e9acbdde396c111a22dabeb4a28023e493ff1113489e4f815a96d37c9eab3830b5613fb93ae396ca3aa829b475c885073497371c592dd6923d82d6c7182674a0015bedaae2916b91802d0be6d61bd109d253d3024ebc'}

workbench.delete_path(file_path: str)

delete a path on your workbench

wb.delete_path('/delete/me/')
+----------------------------------+-------------+-----------+
| Workbench                        | Path        | Message   |
+==================================+=============+===========+
| test-delete-20230412165811062848 | /delete/me/ | deleted   |
+----------------------------------+-------------+-----------+

workbench.move_file(source_path: str, destination_path: str)

move or rename files on your workbench

workbench.move_file('input/sample_data/SRR10261593_1.fastq.gz', 'input/SRR10261593_1-renamed.fastq.gz')