Skip to content

Instantly share code, notes, and snippets.

@sahilseth
Last active April 1, 2019 18:38
Show Gist options
  • Save sahilseth/587edf0aed095be49121fd7f05904e57 to your computer and use it in GitHub Desktop.
Save sahilseth/587edf0aed095be49121fd7f05904e57 to your computer and use it in GitHub Desktop.
flowr tips
# install this cool tools from Heng Li (https://github.com/lh3/bioawk)
brew install bioawk
# information regarding exit_code:
# - NA: not started yet
# show lines where job started and had errors
bioawk -tc hdr '{if($exit_code!=0 && $started=="TRUE") print $jobname, $cmd, $exit_code}' flow_details.txt
# show lines which did not start
bioawk -tc hdr '{if($started=="FALSE") print $jobname, $cmd, $exit_code}' flow_details.txt
# started, but have not finished yet (no exit status yet)
bioawk -tc hdr '{if($started=="TRUE" && $exit_code==-1) print $jobname, $cmd, $exit_code}' flow_details.txt
# get the 3rd column, cut -f3 and re-submit the jobs
jobs=$(bioawk -tc hdr '{if($exit_code!=0 && $started=="TRUE") print $jobname, $cmd, $exit_code}' flow_details.txt | cut -f2)
echo $jobs
# this will work, provided there were no pre requisite jobs
for j in $jobs; do bsub < $j; done
# END
@sahilseth
Owner
sahilseth commented on Aug 7, 2017
# resubmission ex
bsub -M 60384 -R rusage[mem=60384] < cnt_cmd_66.sh
# https://github.com/stephenturner/oneliners
# http://www.delorie.com/gnu/docs/gawk/gawk_204.html
vcffl="sample.vcf"
bioawk -c vcf '{
freq[$filter]++
total++
}
END {
for(val in freq)
printf "%s\t%d\t%d\n", val, freq[val], freq[val]*100/total
}' $vcffl | sort -k 2nr | less
# https://stackoverflow.com/questions/10445934/change-multiple-files
fls=$(ls */002.cmd_hla/cmd_hla_cmd_1.sh)
for fl in $fls; do
# test first
#sed 's/Allelelist.txt/Allelelist_v2.txt/g' $fl
sed -i 's/Allelelist.txt/Allelelist_v2.txt/g' $fl
done
# install the newer version:
flowr devtools::install_github repo=sahilseth/flowr ref=add_docker
# create a UUID path
myuuid=$(flowr get_unique_id prefix=tumorname___normalname)
# run an example, with predefined uuid
flowr run x=sleep_pipe uuid=$myuuid
# get a list of rundirs
rundirs=$(ls . | grep neo);echo $rundirs
jobnm=""
jobfl=""
for rundir in $rundirs; do
echo "working on $rundir"
# cd into tmp, to run the cmd
cd $rundir/tmp
# extract and run the cmd
grep "Allelelist_v2" ../$jobnm/$jobfl | bash
cd ../..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment