Code Ocean Aux Tools
Convenience tools for working in Code Ocean capsules and pipelines.
Background
These convenience tools were created to make working with files common in bioinformatics more streamlined. Some of the tools in this package are only useful in the Code Ocean platform but many of these tools will be useful outside of the platform.
Requirements
Python>=3.8
Installing Code Ocean Aux Tools in your capsule
Add the following package using pip in the environment UI Code-Ocean-Aux-Tools
or use the following command at the terminal.
pip install Code-Ocean-Aux-Tools
List of Available Commands
The following commands will work at the terminal or in a bash script. Each of these commands has a --help flag which provides more information about using the command.
- get_cpu_count
- get_dir_contents
- get_fasta_file
- get_fastq_pair
- get_fastqs
- get_groups
- get_pipeline_confirm
- get_read_direction
- get_read_pattern
- get_read_prefix
- get_rev_file
- set_log_msg
List of Available Python Functions
There are 2 modules you can import (co_utils & co_fastq)
At the top of your python script, import them
from co_tools import co_utils
from co_tools import co_fastq
co_utils
- get_cpu_limit()
- get_dir_contents()
- get_groups()
- is_pipeline()
co_fastq
- get_fastq_pair()
- get_fastqs()
- get_read_direction()
- get_read_pattern()
- get_prefix()
- get_rev_file()
Logging
There is a pre-configured logger that will work seamlessly in bash and/or python and output to the same log file. The format for each log entry is:
[{Date} {Time} - {filename}:{funcName}:{lineno} - {Log Level}] {log message}
The available log levels are debug, info, warning, error, and critical
Python
To use the logger in a python script just import it and use it
from co_tools.get_logger import LOGGER
To use it just type LOGGER.{log level}("your log message here") where {log level} is your desired log level.
e.g. LOGGER.info("logging is fun")
Bash
To use the logger in a bash script, just use the set_log_msg command. It takes 1 required argument and an additional optional flag --log-level
The required argument is the log message and the optional flag is for the desired log level. The default log level is "WARNING" when no flag is used.
e.g. set_log_msg "logging is fun" --log-level "INFO"
Configuring the LOGGER
Activating the LOGGER
The Code Ocean LOGGER is turned off by default. To turn it on, just assign the log level, described in the next section.
Assigning the log level
Create an environment variable called CO_LOG_LEVEL and assign it one of the 5 available log levels. One method can be to assign the value to CO_LOG_LEVEL in your runscript (run) just before the entry script is executed.
e.g.
export CO_LOG_LEVEL="INFO"
python -u main.py "$@"
or
export CO_LOG_LEVEL="INFO"
bash main.sh "$@"
Logging to the console
By default, anytime a log message with level error or above is logged, the logger will create an entry in the log files with the log message and also print the log message to the console. If you would like the logger to always print the log message to the console whenever the logger creates an entry in the log file, then create an environment variable called CO_LOG_CONSOLE and assign its value to true.
export CO_LOG_CONSOLE="true"
export CO_LOG_LEVEL="INFO"
bash main.sh "$@"
Code Ocean is a cloud-based dry lab for scientific computing with a focus on guaranteeing reproducibility, collaboration and organizing scientific projects. Code Ocean automates best practices allowing users of the platform to focus on science yet follow best practices. Visit our Open Science Library for free code and to demo our free product. Contact our sales for a demo of our enterprise VPC product.
Metadata
Release files for Code-Ocean-Aux-Tools 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| code_ocean_aux_tools-1.1.3.tar.gz | 250.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| code_ocean_aux_tools-1.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 269.9 kB
Release files / code_ocean_aux_tools-1.1.3.tar.gz
| Download URL | code_ocean_aux_tools-1.1.3.tar.gz |
|---|---|
| Size | 250.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d53b85640029abd95031c2ae25071d1e53e9b7078aa3dac04321102725e6809
|
|
BLAKE2b-256 checksum How to use checksums |
1769085282aecad3ad0d3c0b0b5da382ccabf7dc3c641e1d5e83c0872a17172f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / code_ocean_aux_tools-1.1.3-py3-none-any.whl
| Download URL | code_ocean_aux_tools-1.1.3-py3-none-any.whl |
|---|---|
| Size | 19.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a0394fc842054b09f34f9427395c623996bbcfc08d866847cd4b998aac3bba6
|
|
BLAKE2b-256 checksum How to use checksums |
91007b7ca3fd1b838d29ac8529157f6681a8f207578eb487aeb3655f1519c8a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for Code-Ocean-Aux-Tools 1.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.