Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
urmi-21 committed Jan 18, 2021
1 parent 0dfcb05 commit dadf1ac
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
34 changes: 20 additions & 14 deletions case_studies/Integrating third-party tools.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"Executing any shell command with pyrpipe is easy and straight-forward. \n",
"\n",
"The `Runnable` class can used to import any Unix command into python in an object oriented manner. The `Runnable` class executes all commands via the `pyrpipe_engine` module, which provides helper functions to easily execute and log shell commands. \n",
"Users can directly use `execute_command()` function from `pyrpipe_engine` to directly run Unix commands."
"Users can directly use `execute_command()` function from `pyrpipe_engine` to directly run Unix commands.\n",
"\n",
"**NOTE:** Inexperienced users must be careful when executing shell commands as some commands can be dangerous and cause loss of data or even worse. Same applies when executing shell commands via `pyrpipe`. `pyrpipe` provides `--dry-run` option that users can use to see the shell commands without executing them (Use this before running any scripts shared via a source you dont trust (also go through the python code)). In pyrpipe only the `get_shell_output()` method provides `shell=True` option for subprocess. This comes in handy when executing commands that relies on environment variables, pipes, output redirection etc., but can also execute commands like `rm -r *` which deletes everything in the current working directory.\n",
"`pyrpipe` has a `--safe-mode` flag that can disable `rm` commands.\n"
]
},
{
Expand Down Expand Up @@ -140,27 +143,30 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[93mStart:21-01-01 13:43:51\u001b[0m\n",
"\u001b[93mReading configuration from pyrpipe_conf.yaml\u001b[0m\n",
"\u001b[93mStart:21-01-17 19:04:34\u001b[0m\n",
"\u001b[96m$ ls -l\u001b[0m\n",
"\u001b[96mSTDOUT:\n",
"total 44\n",
"drwxr-xr-x 7 usingh usingh 4096 Apr 6 2020 Athaliana_transcript_assembly\n",
"drwxr-xr-x 2 usingh usingh 4096 Apr 6 2020 Human_annotation_snakemake\n",
"-rw-r--r-- 1 usingh usingh 14373 Jan 1 13:42 Integrating third-party tools.ipynb\n",
"drwxr-xr-x 9 usingh usingh 4096 Apr 6 2020 Maize_lncRNA_prediction\n",
"drwxr-xr-x 2 usingh usingh 4096 Jan 1 13:43 orfipy_out\n",
"-rw-r--r-- 1 usingh usingh 12 Dec 31 17:03 pyrpipe_conf.yaml\n",
"drwxr-xr-x 2 usingh usingh 4096 Dec 31 17:02 pyrpipe_logs\n",
"drwxr-xr-x 3 usingh usingh 4096 Mar 7 2020 sample_data\n",
"total 56\n",
"drwxr-xr-x 8 usingh usingh 4096 Jan 4 15:00 Athaliana_transcript_assembly\n",
"drwxr-xr-x 4 usingh usingh 4096 Jan 17 13:41 Covid_RNA-Seq\n",
"drwxr-xr-x 3 usingh usingh 4096 Jan 11 11:24 GTEx_processing\n",
"-rw-r--r-- 1 usingh usingh 16955 Jan 17 19:00 Integrating third-party tools.ipynb\n",
"drwxr-xr-x 11 usingh usingh 4096 Jan 4 15:00 Maize_lncRNA_prediction\n",
"drwxr-xr-x 2 usingh usingh 4096 Jan 4 15:00 orfipy_out\n",
"-rw-r--r-- 1 usingh usingh 12 Jan 4 15:00 pyrpipe_conf.yaml\n",
"drwxr-xr-x 2 usingh usingh 4096 Dec 31 17:02 pyrpipe_logs\n",
"drwxr-xr-x 3 usingh usingh 4096 Mar 7 2020 sample_data\n",
"drwxr-xr-x 3 usingh usingh 4096 Jan 5 12:24 Snakemake_example\n",
"\u001b[0m\n",
"\u001b[93mEnd:21-01-01 13:43:51\u001b[0m\n",
"\u001b[93mEnd:21-01-17 19:04:34\u001b[0m\n",
"\u001b[92mTime taken:0:00:00\u001b[0m\n"
]
},
Expand All @@ -170,7 +176,7 @@
"True"
]
},
"execution_count": 5,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
3 changes: 1 addition & 2 deletions pyrpipe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ def init_sys_args(self):
elif sys.argv[0].split('/')[-1]=='pyrpipe':
#will go to __main__.main
pass
else:

else:
run_py=False
_full_command=' '.join(sys.argv)
#this will execute in command was like python <script.py> [opts]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ def test_pipeline1():

def test_pipeline2():
st=sraOb.trim(tg).align(hs).assemble(stie).quant(kl)
assert st!=None,"pipeline 1 failed"
assert st!=None,"pipeline 2 failed"


def test_pipeline3():
st=sraOb.trim(tg).align(star).assemble(stie).quant(sl)
assert st!=None,"pipeline 1 failed"
assert st!=None,"pipeline 3 failed"


def test_pipeline4():
st=sraOb.quant(sl).quant(kl).align(star)
assert st!=None,"pipeline 1 failed"
assert st!=None,"pipeline 4 failed"

def test_remove():
assert pe.delete_file('pyrpipe_conf.yaml')==True,'removing conf.yaml failed'
Expand Down

0 comments on commit dadf1ac

Please sign in to comment.