Created
April 2, 2024 17:53
-
-
Save fomightez/2a8b1ce03e87e26efafadbe3dc6c5416 to your computer and use it in GitHub Desktop.
Snakemake run test for SO question https://stackoverflow.com/q/78260730/8508004
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "id": "9ca6ae4a-2fbc-449a-ba5e-e5193220baff", | |
| "metadata": {}, | |
| "source": [ | |
| "## Snakemake run test for SO https://stackoverflow.com/q/78260730/8508004\n", | |
| "\n", | |
| "Ran in session launched from [here](https://github.com/fomightez/pdbepisa-binder) via clicking 'launch binder' badge. (Or click badge below for a fresh session!)\n", | |
| "\n", | |
| "[](https://mybinder.org/v2/gh/fomightez/pdbepisa-binder/main?urlpath=%2Fnotebooks%2Findex.ipynb)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "id": "bafc96b3-29d8-44fd-8a58-5866542a4ce0", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " apt.txt README.md\n", | |
| " index.ipynb requirements.txt\n", | |
| " LICENSE 'Snakemake run test for SO question 78260730.ipynb'\n", | |
| " \u001b[0m\u001b[01;34mnotebooks\u001b[0m/\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "ls" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "id": "c389f424-d490-4092-afed-2d36ec658e18", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Writing 's' (str) to file 'Snakefile'.\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "s='''rule A:\n", | |
| " input:\n", | |
| " i = 'B1477.all_merged_3split_dedupped_sorted.bam'\n", | |
| " output:\n", | |
| " o = 'B1477.all_merged_3split_dedupped_sorted2.bam'\n", | |
| " shell:\n", | |
| " \"cat {input.i} > {output.o}\"\n", | |
| "'''\n", | |
| "%store s >Snakefile" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "3be94589-cefa-46b5-8902-8e4b4ddf7b79", | |
| "metadata": {}, | |
| "source": [ | |
| "Started runnng with only a `Snakefile` that had the above content." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "id": "411ce30a-4a16-4506-b579-fd845dedaa50", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\u001b[33mBuilding DAG of jobs...\u001b[0m\n", | |
| "\u001b[31mMissingInputException in line 1 of /home/jovyan/Snakefile:\n", | |
| "Missing input files for rule A:\n", | |
| " output: B1477.all_merged_3split_dedupped_sorted2.bam\n", | |
| " affected files:\n", | |
| " B1477.all_merged_3split_dedupped_sorted.bam\u001b[0m\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "!snakemake --cores 1" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "id": "68736e64-1d0e-43c0-926a-3680de406a9f", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " apt.txt README.md\n", | |
| " index.ipynb requirements.txt\n", | |
| " LICENSE Snakefile\n", | |
| " \u001b[0m\u001b[01;34mnotebooks\u001b[0m/ 'Snakemake run test for SO question 78260730.ipynb'\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "ls" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "edb2993f-2c95-4bcb-ad66-c737d6e6c54f", | |
| "metadata": {}, | |
| "source": [ | |
| "Make the input file." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "id": "1e551dfa-4008-4bd1-a010-c1a7f83b3d9f", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "!touch B1477.all_merged_3split_dedupped_sorted.bam" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "dc6f344b-4598-4c04-b27f-42f7e0850b03", | |
| "metadata": {}, | |
| "source": [ | |
| "Now try again." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "id": "a7cd6cb9-80d8-405f-b77b-d21f6928477c", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\u001b[33mBuilding DAG of jobs...\u001b[0m\n", | |
| "\u001b[33mUsing shell: /bin/bash\u001b[0m\n", | |
| "\u001b[33mProvided cores: 1 (use --cores to define parallelism)\u001b[0m\n", | |
| "\u001b[33mRules claiming more threads will be scaled down.\u001b[0m\n", | |
| "\u001b[33mJob stats:\n", | |
| "job count min threads max threads\n", | |
| "----- ------- ------------- -------------\n", | |
| "A 1 1 1\n", | |
| "total 1 1 1\n", | |
| "\u001b[0m\n", | |
| "\u001b[33mSelect jobs to execute...\u001b[0m\n", | |
| "\u001b[32m\u001b[0m\n", | |
| "\u001b[32m[Tue Apr 2 17:52:26 2024]\u001b[0m\n", | |
| "\u001b[32mrule A:\n", | |
| " input: B1477.all_merged_3split_dedupped_sorted.bam\n", | |
| " output: B1477.all_merged_3split_dedupped_sorted2.bam\n", | |
| " jobid: 0\n", | |
| " resources: tmpdir=/tmp\u001b[0m\n", | |
| "\u001b[32m\u001b[0m\n", | |
| "\u001b[32m[Tue Apr 2 17:52:26 2024]\u001b[0m\n", | |
| "\u001b[32mFinished job 0.\u001b[0m\n", | |
| "\u001b[32m1 of 1 steps (100%) done\u001b[0m\n", | |
| "\u001b[33mComplete log: .snakemake/log/2024-04-02T175226.183902.snakemake.log\u001b[0m\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "!snakemake --cores 1" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "id": "92f2c41e-0634-4dc0-834d-0dd9774c47b1", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " apt.txt\n", | |
| " B1477.all_merged_3split_dedupped_sorted2.bam\n", | |
| " B1477.all_merged_3split_dedupped_sorted.bam\n", | |
| " index.ipynb\n", | |
| " LICENSE\n", | |
| " \u001b[0m\u001b[01;34mnotebooks\u001b[0m/\n", | |
| " README.md\n", | |
| " requirements.txt\n", | |
| " Snakefile\n", | |
| "'Snakemake run test for SO question 78260730.ipynb'\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "ls" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "1c98de98-a163-4982-a413-6e74c70b742a", | |
| "metadata": {}, | |
| "source": [ | |
| "Worked!" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "6bb0d2c8-9729-4da2-a54f-1e3004702f6b", | |
| "metadata": {}, | |
| "source": [ | |
| "#### What if remove the output and do dry run?" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "id": "10be6a4d-c233-46c7-8ab2-2dff15534071", | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [ | |
| "!rm -rf B1477.all_merged_3split_dedupped_sorted2.bam" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "id": "73d5dbb3-f4f4-4901-82b5-ed505f89b7a0", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| " apt.txt\n", | |
| " B1477.all_merged_3split_dedupped_sorted.bam\n", | |
| " index.ipynb\n", | |
| " LICENSE\n", | |
| " \u001b[0m\u001b[01;34mnotebooks\u001b[0m/\n", | |
| " README.md\n", | |
| " requirements.txt\n", | |
| " Snakefile\n", | |
| "'Snakemake run test for SO question 78260730.ipynb'\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "ls" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "id": "80c41494-f8b7-425d-ada4-a3ea539e1c04", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "\u001b[33mBuilding DAG of jobs...\u001b[0m\n", | |
| "\u001b[33mJob stats:\n", | |
| "job count min threads max threads\n", | |
| "----- ------- ------------- -------------\n", | |
| "A 1 1 1\n", | |
| "total 1 1 1\n", | |
| "\u001b[0m\n", | |
| "\u001b[32m\u001b[0m\n", | |
| "\u001b[32m[Tue Apr 2 17:52:32 2024]\u001b[0m\n", | |
| "\u001b[32mrule A:\n", | |
| " input: B1477.all_merged_3split_dedupped_sorted.bam\n", | |
| " output: B1477.all_merged_3split_dedupped_sorted2.bam\n", | |
| " jobid: 0\n", | |
| " resources: tmpdir=/tmp\u001b[0m\n", | |
| "\u001b[32m\u001b[0m\n", | |
| "\u001b[33mJob stats:\n", | |
| "job count min threads max threads\n", | |
| "----- ------- ------------- -------------\n", | |
| "A 1 1 1\n", | |
| "total 1 1 1\n", | |
| "\u001b[0m\n", | |
| "\u001b[33mThis was a dry-run (flag -n). The order of jobs does not reflect the order of execution.\u001b[0m\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "!snakemake -n" | |
| ] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "id": "6d6c7086-ccfa-49ad-8713-4fcc8074d7e2", | |
| "metadata": {}, | |
| "source": [ | |
| "Still seems to work without error." | |
| ] | |
| } | |
| ], | |
| "metadata": { | |
| "kernelspec": { | |
| "display_name": "Python 3 (ipykernel)", | |
| "language": "python", | |
| "name": "python3" | |
| }, | |
| "language_info": { | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "file_extension": ".py", | |
| "mimetype": "text/x-python", | |
| "name": "python", | |
| "nbconvert_exporter": "python", | |
| "pygments_lexer": "ipython3", | |
| "version": "3.7.12" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 5 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment