From b868db9adbe04d7be65411b8dbd97fe8aabb21d8 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:16:36 +0000 Subject: [PATCH 01/10] python project based gitignore --- .gitignore | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..988900ea --- /dev/null +++ b/.gitignore @@ -0,0 +1,166 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/latest/usage/project/#working-with-version-control +.pdm.toml +.pdm-python +.pdm-build/ + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +tmp +Genomes/GCF_000005845.2 +Genomes/GCF_000006765.1 \ No newline at end of file From f07548760be51c73e358fabedf55c9a59291701d Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:24:29 +0000 Subject: [PATCH 02/10] requirements to run TargetRNA3 --- requirements.txt | 106 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..efa925b3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,106 @@ +anyio==4.4.0 +argon2-cffi==23.1.0 +argon2-cffi-bindings==21.2.0 +arrow==1.3.0 +asttokens==2.4.1 +async-lru==2.0.4 +attrs==23.2.0 +Babel==2.15.0 +beautifulsoup4==4.12.3 +bleach==6.1.0 +certifi==2024.6.2 +cffi==1.16.0 +charset-normalizer==3.3.2 +comm==0.2.2 +debugpy==1.8.1 +decorator==5.1.1 +defusedxml==0.7.1 +executing==2.0.1 +fastjsonschema==2.20.0 +fqdn==1.5.1 +gitdb==4.0.11 +GitPython==3.1.41 +h11==0.14.0 +httpcore==1.0.5 +httpx==0.27.0 +idna==3.7 +ipykernel==6.29.4 +ipython==8.25.0 +ipywidgets==8.1.3 +isoduration==20.11.0 +jedi==0.19.1 +Jinja2==3.1.4 +json5==0.9.25 +jsonpointer==3.0.0 +jsonschema==4.22.0 +jsonschema-specifications==2023.12.1 +jupyter==1.0.0 +jupyter-console==6.6.3 +jupyter-events==0.10.0 +jupyter-lsp==2.2.5 +jupyter_client==8.6.2 +jupyter_core==5.7.2 +jupyter_server==2.14.1 +jupyter_server_terminals==0.5.3 +jupyterlab==4.2.2 +jupyterlab_pygments==0.3.0 +jupyterlab_server==2.27.2 +jupyterlab_widgets==3.0.11 +MarkupSafe==2.1.5 +matplotlib-inline==0.1.7 +mistune==3.0.2 +nbclient==0.10.0 +nbconvert==7.16.4 +nbformat==5.10.4 +nest-asyncio==1.6.0 +notebook==7.2.1 +notebook_shim==0.2.4 +numpy==2.0.0 +overrides==7.7.0 +packaging==24.1 +pandas==2.2.2 +pandocfilters==1.5.1 +parso==0.8.4 +pexpect==4.9.0 +platformdirs==4.2.2 +prometheus_client==0.20.0 +prompt_toolkit==3.0.47 +psutil==6.0.0 +ptyprocess==0.7.0 +pure-eval==0.2.2 +pycparser==2.22 +Pygments==2.18.0 +python-dateutil==2.9.0.post0 +python-json-logger==2.0.7 +pytz==2024.1 +PyYAML==6.0.1 +pyzmq==26.0.3 +qtconsole==5.5.2 +QtPy==2.4.1 +referencing==0.35.1 +requests==2.32.3 +rfc3339-validator==0.1.4 +rfc3986-validator==0.1.1 +rpds-py==0.18.1 +scipy==1.13.1 +Send2Trash==1.8.3 +setuptools==69.0.3 +six==1.16.0 +smmap==5.0.1 +sniffio==1.3.1 +soupsieve==2.5 +stack-data==0.6.3 +terminado==0.18.1 +tinycss2==1.3.0 +tornado==6.4.1 +traitlets==5.14.3 +types-python-dateutil==2.9.0.20240316 +tzdata==2024.1 +uri-template==1.3.0 +urllib3==2.2.2 +wcwidth==0.2.13 +webcolors==24.6.0 +webencodings==0.5.1 +websocket-client==1.8.0 +wheel==0.43.0 +widgetsnbextension==4.0.11 From b3fff59a9f2acd6861b14d9aaf50107e15659205 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:25:25 +0000 Subject: [PATCH 03/10] all dpendencies should be globally installed from now on --- AddGenome.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AddGenome.py b/AddGenome.py index a8a88633..9ae83dc8 100644 --- a/AddGenome.py +++ b/AddGenome.py @@ -210,7 +210,7 @@ def determine_closest_relatives(GENOME_DIR): seq_16S = get_16S_sequence(GENOME_DIR) with open(TEMP_FILENAME1, 'w') as out_file: out_file.write('>16S' + '\n' + seq_16S + '\n') - p = subprocess.run(['./blastn', '-db', DB_16S, '-query', TEMP_FILENAME1, '-evalue', '0.01', '-max_target_seqs', str(BLAST_RESULTS+1), '-num_threads', str(NUM_THREADS), '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', TEMP_FILENAME2], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastn', '-db', DB_16S, '-query', TEMP_FILENAME1, '-evalue', '0.01', '-max_target_seqs', str(BLAST_RESULTS+1), '-num_threads', str(NUM_THREADS), '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', TEMP_FILENAME2], stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Read in BLAST results replicates = {} @@ -310,14 +310,14 @@ def create_blast_filter_for_relatives(GENOME_DIR, target_ID_to_genome): for t in targets: out_file.write(t + '\n') # Format Blast filter file - p = subprocess.run(['./blastdb_aliastool', '-seqid_file_in', FILTER_FILE], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastdb_aliastool', '-seqid_file_in', FILTER_FILE], stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Helper function for computing target homologs # PERFORM BLAST WITHOUT USING MULTIPLE PROCESSORS def blast_targets_against_database_SINGLE_PROCESS(protein_file): BLAST_OUTPUT_FILE = str(time.time()) + '.blast' - p = subprocess.run(['./blastp', '-db', DB_FAA, '-query', protein_file, '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', BLAST_OUTPUT_FILE, '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-seqidlist', FILTER_FILE + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastp', '-db', DB_FAA, '-query', protein_file, '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', BLAST_OUTPUT_FILE, '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-seqidlist', FILTER_FILE + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if (os.path.exists(protein_file)): os.remove(protein_file) if (os.path.exists(FILTER_FILE)): os.remove(FILTER_FILE) if (os.path.exists(FILTER_FILE + '.bsl')): os.remove(FILTER_FILE + '.bsl') @@ -331,7 +331,7 @@ def run_blast(target_subset): for target in target_subset: GENOME_DIR, accession, protein_seq = target out_file.write('>' + accession + '\n' + protein_seq + '\n') - p = subprocess.run(['./blastp', '-db', DB_FAA, '-query', accession_file, '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', GENOME_DIR + accession + '.blast.xyz', '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-seqidlist', FILTER_FILE + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastp', '-db', DB_FAA, '-query', accession_file, '-outfmt', '6 qseqid sseqid evalue bitscore', '-out', GENOME_DIR + accession + '.blast.xyz', '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-seqidlist', FILTER_FILE + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) if (os.path.exists(accession_file)): os.remove(accession_file) @@ -482,7 +482,7 @@ def run_RNAplfold(target): accession, mRNA_name, mRNA_sequence, count = target with open(GENOME_DIR + RNAPLFOLD_DIR + accession + '____' + mRNA_name + '.fa', 'w') as out_file: out_file.write('>' + accession + '____' + mRNA_name + '\n' + mRNA_sequence + '\n') - p = subprocess.run(['./RNAplfold', '-u', '40', '-O', '--plex_output', '--auto-id', '--id-prefix', 'TR' + count], input=mRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['RNAplfold', '-u', '40', '-O', '--plex_output', '--auto-id', '--id-prefix', 'TR' + count], input=mRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) if (p.returncode != 0) or (len(p.stderr.decode()) > 0): error('Problem executing RNAplfold:\t' + str(p.stderr.decode()) + '\n') renameAndRemoveOutputFiles('TR' + count + '_0001', accession + '____' + mRNA_name) @@ -501,7 +501,7 @@ def RNAplfold_MULTI_PROCESS(targets): # Helper function for computing target accessibility # CREATE BINARY VERSIONS OF ACCESSIBILITY FILES USING RNAplex def create_binary_files(): - p = subprocess.run(['./RNAplex', '-a', GENOME_DIR + RNAPLFOLD_DIR, '-k'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['RNAplex', '-a', GENOME_DIR + RNAPLFOLD_DIR, '-k'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) filelist = os.listdir(GENOME_DIR + RNAPLFOLD_DIR) for f in filelist: if (f.endswith('_openen')): os.remove(GENOME_DIR + RNAPLFOLD_DIR + f) From 7499e8488f067671eae69fa517cbed05dab6ad29 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:25:56 +0000 Subject: [PATCH 04/10] Devcontainer configuration for vscode --- .devcontainer/Dockerfile | 14 ++++++++++++++ .devcontainer/devcontainer.json | 26 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..63b0d9b1 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye + +# RUN apt update -y && apt install --no-install-recommends + +# Install ViennaRNA package dependency to running AddGenome.py + +WORKDIR /tmp + +RUN wget https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_6_x/ViennaRNA-2.6.4.tar.gz +RUN tar -zxvf ViennaRNA-2.6.4.tar.gz +RUN cd ViennaRNA-2.6.4 +RUN ./configure +RUN make +RUN sudo make install \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..3a4a067e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/python +{ + "name": "Python 3", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + // "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", + "build": { "dockerfile": "Dockerfile" }, + "features": { + "ghcr.io/akhildevelops/devcontainer-features/pip:0": {} + } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} From 5848e7bc895dfb52ac123620e483bcd596bcf687 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:42:19 +0000 Subject: [PATCH 05/10] No more local program installation --- TargetRNA3.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TargetRNA3.py b/TargetRNA3.py index 1d68c725..121de456 100644 --- a/TargetRNA3.py +++ b/TargetRNA3.py @@ -251,10 +251,10 @@ def get_sRNA_homologs(SRNA_FILENAME, genome): RESTRICT_FILENAME = FILENAME + '.restrict' with open(RESTRICT_FILENAME, 'w') as out_file: for accession in genome: out_file.write(accession + '\n') - p = subprocess.run(['./blastdb_aliastool', '-seqid_file_in', RESTRICT_FILENAME], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastdb_aliastool', '-seqid_file_in', RESTRICT_FILENAME], stdout=subprocess.PIPE, stderr=subprocess.PIPE) # BLAST sRNA sequence - p = subprocess.run(['./blastn', '-db', DB, '-query', SRNA_FILENAME, '-outfmt', '6 qseqid sseqid evalue bitscore qstart qend', '-out', SRNA_HOMOLOGS_FILENAME, '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-negative_seqidlist', RESTRICT_FILENAME + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['blastn', '-db', DB, '-query', SRNA_FILENAME, '-outfmt', '6 qseqid sseqid evalue bitscore qstart qend', '-out', SRNA_HOMOLOGS_FILENAME, '-evalue', '0.01', '-max_target_seqs', '100', '-num_threads', str(NUM_THREADS), '-negative_seqidlist', RESTRICT_FILENAME + '.bsl'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Determine homologs of sRNA sRNA_homologs = {} @@ -302,7 +302,7 @@ def determine_sRNA_accessibility(GENOME_DIR, sRNA_name, sRNA_sequence): p = subprocess.run(['nice', './RNAplfold', '-u', '40', '-O', '--plex_output', '-W', str(WINDOW_SIZE), '--auto-id', '--id-prefix', TIME_STR], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) if (p.returncode != 0) or (len(p.stderr.decode()) > 0): sys.stderr.write('ERROR executing RNAplfold:\t' + str(p.stderr.decode()) + '\n') - p = subprocess.run(['./RNAplex', '-a', '.', '-k'], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['RNAplex', '-a', '.', '-k'], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Clean up shutil.move(TIME_STR + '_0001_openen_bin', GENOME_DIR + RNAPLFOLD_DIR + sRNA_name + '_openen_bin') From 19b68669f092159709aec30feab1c2ce05e869f9 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:43:00 +0000 Subject: [PATCH 06/10] ignoring subfolders --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 988900ea..b7890680 100644 --- a/.gitignore +++ b/.gitignore @@ -162,5 +162,5 @@ cython_debug/ #.idea/ tmp -Genomes/GCF_000005845.2 -Genomes/GCF_000006765.1 \ No newline at end of file +Genomes/GCF_000005845.2/** +Genomes/GCF_000006765.1/** \ No newline at end of file From f1b45eef4509f3ab8229e859b8491624615638b2 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:34:55 +0000 Subject: [PATCH 07/10] sklearn installed with correct version --- requirements.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index efa925b3..8f18fa20 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ bleach==6.1.0 certifi==2024.6.2 cffi==1.16.0 charset-normalizer==3.3.2 +cloudpickle==2.2.1 comm==0.2.2 debugpy==1.8.1 decorator==5.1.1 @@ -30,6 +31,7 @@ ipywidgets==8.1.3 isoduration==20.11.0 jedi==0.19.1 Jinja2==3.1.4 +joblib==1.4.2 json5==0.9.25 jsonpointer==3.0.0 jsonschema==4.22.0 @@ -55,7 +57,7 @@ nbformat==5.10.4 nest-asyncio==1.6.0 notebook==7.2.1 notebook_shim==0.2.4 -numpy==2.0.0 +numpy==1.26.4 overrides==7.7.0 packaging==24.1 pandas==2.2.2 @@ -82,6 +84,7 @@ requests==2.32.3 rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rpds-py==0.18.1 +scikit-learn==1.3.2 scipy==1.13.1 Send2Trash==1.8.3 setuptools==69.0.3 @@ -91,6 +94,7 @@ sniffio==1.3.1 soupsieve==2.5 stack-data==0.6.3 terminado==0.18.1 +threadpoolctl==3.5.0 tinycss2==1.3.0 tornado==6.4.1 traitlets==5.14.3 From 703e984db5075eb62c96fab6c46c129792ebaa24 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:35:17 +0000 Subject: [PATCH 08/10] ignoring files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b7890680..3eae463a 100644 --- a/.gitignore +++ b/.gitignore @@ -163,4 +163,5 @@ cython_debug/ tmp Genomes/GCF_000005845.2/** -Genomes/GCF_000006765.1/** \ No newline at end of file +Genomes/GCF_000006765.1/** +DataFiles \ No newline at end of file From c338410e4d44e1510144f78afee5924b750f3e38 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 20:35:55 +0000 Subject: [PATCH 09/10] global program call --- TargetRNA3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TargetRNA3.py b/TargetRNA3.py index 121de456..1161dee6 100644 --- a/TargetRNA3.py +++ b/TargetRNA3.py @@ -299,7 +299,7 @@ def get_homologs(GENOME_DIR, SRNA_FILENAME, genome, genes): def determine_sRNA_accessibility(GENOME_DIR, sRNA_name, sRNA_sequence): TIME_STR = str(time.time()) WINDOW_SIZE = min(70, len(sRNA_sequence)) - p = subprocess.run(['nice', './RNAplfold', '-u', '40', '-O', '--plex_output', '-W', str(WINDOW_SIZE), '--auto-id', '--id-prefix', TIME_STR], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['nice', 'RNAplfold', '-u', '40', '-O', '--plex_output', '-W', str(WINDOW_SIZE), '--auto-id', '--id-prefix', TIME_STR], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) if (p.returncode != 0) or (len(p.stderr.decode()) > 0): sys.stderr.write('ERROR executing RNAplfold:\t' + str(p.stderr.decode()) + '\n') p = subprocess.run(['RNAplex', '-a', '.', '-k'], input=sRNA_sequence.encode(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -313,7 +313,7 @@ def determine_sRNA_accessibility(GENOME_DIR, sRNA_name, sRNA_sequence): # HELPER FUNCTION FOR COMPUTING INTERACTION ENERGIES. COMPUTES ENERGIES USING RNAPLEX. def run_RNAplex(GENOME_DIR, SRNA_FILENAME, f): - p = subprocess.run(['nice', './RNAplex', '-f', '0', '-q', SRNA_FILENAME, '-t', GENOME_DIR + RNAPLFOLD_DIR + f, '-a', GENOME_DIR + RNAPLFOLD_DIR, '-b'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.run(['nice', 'RNAplex', '-f', '0', '-q', SRNA_FILENAME, '-t', GENOME_DIR + RNAPLFOLD_DIR + f, '-a', GENOME_DIR + RNAPLFOLD_DIR, '-b'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) structure_info = p.stdout.decode().strip().split('\n')[2] return (f, structure_info) From 92a8dcd8c29bd7ec76ec525649bcef7d8865d110 Mon Sep 17 00:00:00 2001 From: Thiago M Souza <46378621+mtsz-thiago@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:18:31 +0000 Subject: [PATCH 10/10] devcontainer for project --- .devcontainer/Dockerfile | 16 +++++++--------- .devcontainer/devcontainer.json | 31 ++++++++++++++++++------------- .devcontainer/docker-compose.yml | 26 ++++++++++++++++++++++++++ .github/dependabot.yml | 12 ++++++++++++ requirements.txt | 1 - 5 files changed, 63 insertions(+), 23 deletions(-) create mode 100644 .devcontainer/docker-compose.yml create mode 100644 .github/dependabot.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 63b0d9b1..71aaff57 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,14 +1,12 @@ -FROM mcr.microsoft.com/devcontainers/python:1-3.12-bullseye - -# RUN apt update -y && apt install --no-install-recommends - -# Install ViennaRNA package dependency to running AddGenome.py +# Note: You can use any Debian/Ubuntu based image you want. +FROM mcr.microsoft.com/devcontainers/base:bullseye WORKDIR /tmp RUN wget https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_6_x/ViennaRNA-2.6.4.tar.gz RUN tar -zxvf ViennaRNA-2.6.4.tar.gz -RUN cd ViennaRNA-2.6.4 -RUN ./configure -RUN make -RUN sudo make install \ No newline at end of file +RUN cd ViennaRNA-2.6.4 && ./configure && make && sudo make install + +# [Optional] Uncomment this section to install additional OS packages. +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends ncbi-blast+ \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3a4a067e..07dcd270 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,25 +1,30 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/python +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-outside-of-docker-compose { - "name": "Python 3", - // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile - // "image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye", - "build": { "dockerfile": "Dockerfile" }, + "name": "Docker from Docker Compose", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + + // Use this environment variable if you need to bind mount your local source code into a new container. + "remoteEnv": { + "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" + }, + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { + "version": "latest", + "enableNonRootDocker": "true", + "moby": "true" + }, + "ghcr.io/devcontainers/features/python:1": {}, "ghcr.io/akhildevelops/devcontainer-features/pip:0": {} } - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pip3 install --user -r requirements.txt", - - // Configure tool-specific properties. - // "customizations": {}, + // "postCreateCommand": "docker --version", // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root" diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000..73ad0bde --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,26 @@ +version: '3' + +services: + app: + build: + context: . + dockerfile: Dockerfile + + volumes: + # Forwards the local Docker socket to the container. + - /var/run/docker.sock:/var/run/docker-host.sock + # Update this to wherever you want VS Code to mount the folder of your project + - ../..:/workspaces:cached + + # Overrides default command so things don't shut down after the process ends. + entrypoint: /usr/local/share/docker-init.sh + command: sleep infinity + + # Uncomment the next four lines if you will use a ptrace-based debuggers like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/requirements.txt b/requirements.txt index 8f18fa20..573776e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,6 @@ httpcore==1.0.5 httpx==0.27.0 idna==3.7 ipykernel==6.29.4 -ipython==8.25.0 ipywidgets==8.1.3 isoduration==20.11.0 jedi==0.19.1