mfiers / Moa

Lightweight workflows in bioinformatics:
http://moa.readthedocs.org
GNU General Public License v3.0
23 stars 10 forks source link

Simple quoting issues? #17

Closed cfljam closed 11 years ago

cfljam commented 11 years ago

This is showing up in all my simple jobs:

cfljam@pgenome 20.Compare_NXD_USDA]$ pwd /data/moa/onion/map/20.USDA_2012/20.Compare_NXD_USDA [cfljam@pgenome 20.Compare_NXD_USDA]$ moa show jobid l.o Compare_NXDUSDA process l.M for marker in `awk '/^ACP/ {split($1,A,""); print A[1]}' NXD_map | sort | uniq; do grep $marker ../15.Primersearch/all_mapped_USDA_contigs.primersearch.hits; done > common_markers title l.o get mapped contigs in common [cfljam@pgenome 20.Compare_NXD_USDA]$ moa run Warning: Removing a stale lockfile /data/moa/onion/map/20.USDA_2012/20.Compare_NXD_USDA/.moa/tmp/moa.u3zEta.sh: line 3: syntax error near unexpected token(' Error: Exit on error [cfljam@pgenome 20.Compare_NXD_USDA]$

mfiers commented 11 years ago

This was a little tricky - moa exits on error, because the oneliner exited with an error. All Moa script are executed with 'set -e' - meaning that if any of the commands gives an error - the script terminates immediately. In this case, grep causes the error when it tries to find a pattern that does not exists. If you rewrite this as:

for marker in `awk '/^ACP/ {split($1,A,"_"); print A[1]}'  NXD_map | sort | uniq`; do (grep $marker ../15.Primersearch/all_mapped_USDA_contigs.primersearch.hits || true); done > common_markers

where the ( <COMMAND> || true ) negates any non zero returncode the simple job runs fine.