diurnal.utils package
Submodules
diurnal.utils.file_io module
File manipulation module.
Author: Vincent Therrien (therrien.vincent.2@courrier.uqam.ca)
Affiliation: Département d’informatique, UQÀM
File creation date: April 2023
License: MIT
- diurnal.utils.file_io.clean_dir_path(directory: str) str [source]
Return the correct filepath to directory.
- Parameters
directory (str) – Directory name to validate.
- Raises
RuntimeError – If the directory does not exist.
Returns (str): Cleaned directory path.
- diurnal.utils.file_io.decompress(filename: str, mode: str, dst: str, verbosity: int, name: str = '') None [source]
Decompress a TAR file.
- Parameters
filename (str) – Name of the file to decompress.
mode (str) – Decompression mode (e.g. r:gz).
dst (str) – Output directory.
verbosity (int) – Verbosity level. 0 silences the function.
name (str) – Decompressed file name - used for logging.
- diurnal.utils.file_io.download(url: str, dst: str, verbosity: int, name: str = '') None [source]
Download a file through HTTPS.
- Parameters
url (str) – Location of the file to download.
dst (str) – File path of the downloaded content.
verbosity (int) – Verbosity level of the function. 0 silences the function. 1 prints a loading bar.
name (str) – Name of the downloaded file - used for logging.
- diurnal.utils.file_io.is_downloaded(dst: str, n: int) bool [source]
Check if a dataset has been downloaded and is available on the filesystem.
- Parameters
dst (str) – Expected directory in which the dataset should be.
n (int) – Expected number of RNA structure files.
Returns (bool): True if the dataset is downloaded, False otherwise.
diurnal.utils.log module
Message logging module.
Author: Vincent Therrien (therrien.vincent.2@courrier.uqam.ca)
Affiliation: Département d’informatique, UQÀM
File creation date: April 2023
License: MIT
- diurnal.utils.log.error(message: str) None [source]
Print an error message.
- Parameters
message (str) – Message to display.
- diurnal.utils.log.info(message: str) None [source]
Print information about the execution of the program.
- Parameters
message (str) – Message to display.
- diurnal.utils.log.progress_bar(N: int, n: int, suffix: str = '') None [source]
Print a progress bar in the standard output.
- Parameters
N (int) – Total number of elements to process.
n (int) – Number of elements that have been processed.
suffix (str) – A text to display after the progress bar.
- diurnal.utils.log.title(message: str) None [source]
Print a highlighted message. Used at the beginning of scripts.
- Parameters
message (str) – Message to display.
diurnal.utils.rna_data module
Handle RNA structure data files.
Author: Vincent Therrien (therrien.vincent.2@courrier.uqam.ca)
Affiliation: Département d’informatique, UQÀM
File creation date: June 2023
License: MIT
- diurnal.utils.rna_data.read_ct_file(path: str) tuple [source]
Read a CT (Connect table) file and return its information.
- Parameters
path (str) – File path of the CT file.
- Returns (tuple):
The returned tuple contains the following data: - RNA molecule title. - Primary structure (i.e. a list of ‘A’, ‘C’, ‘G’, and ‘U’). - Pairings (i.e. a list of integers indicating the index of the
paired based, with -1 indicating unpaired bases).