Skip to content

Instantly share code, notes, and snippets.

@niksmac
Created February 2, 2020 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niksmac/545b5679dbb2c4f0ef261fe92eb48f37 to your computer and use it in GitHub Desktop.
Save niksmac/545b5679dbb2c4f0ef261fe92eb48f37 to your computer and use it in GitHub Desktop.
#!/bin/bash
cd /home/ubuntu/
touch pipeline_trace.txt
sleep 5s
node /home/ubuntu/clpush/index.js &
while true;
do
input_directory=`cat inputpath.txt`
w=`cat wpath.txt`
out_directory=`cat outpath.txt`
sleep 2s
echo "$input_directory"
if [ $input_directory ] && [ $w ] && [ $out_directory ]
then
sleep 1s
cd /home/ubuntu
sudo aws s3 cp $input_directory .
sleep 3s
sudo nextflow run https://github.com/OmixPlatform/GWASpipe -c multidocker_qc.config -r ee3cc42c3888c5e1540266029256e5b7f35b310e --vcf_file ./vcf_samples.csv --pheno SMOKER --covariates AGE,SEX
sudo nextflow run h3abionet/h3agwas/plink-assoc.nf -c nextflow_gwas.config --pheno SEX --data results/sample.phe --input_pat results --input_dir ./results --assoc 1 --covariate PAT,MAT --freq
sudo cp /home/ubuntu/results/assoc/SEX.assoc /home/ubuntu/gwas_asscoc.assoc
# sudo nextflow run h3abionet/h3agwas/qc.nf --input_pat sampleA --input_dir ./sample/
sleep 2s
echo "Generating graphs"
echo "# 1. Convert assoc to csv"
python3 convert-to-csv.py gwas_asscoc.assoc gwas_assoc.csv
sleep 1s
## 2. Create graphs
echo "second graph"
python3 generate-graph-manhatten.py full-gwas_assoc.csv gwas.png
python3 generate-pca.py cleaned.eigenvec gwas.png
sleep 1s
# # Copy result files to s3
sudo aws s3 cp /home/ubuntu/results $out_directory --recursive
# # Copy logs to s3
sudo aws s3 cp pipeline_trace.txt $out_directory --recursive
# # Copy nextlfow log s3
sudo aws s3 cp qc_pipeline_trace.csv $out_directory --recursive
# # Copy .nextflow.log
sudo aws s3 cp .nextflow.log $out_directory --recursive
# Move graphs
sudo aws s3 cp . $out_directory --recursive --exclude "*" --include "*.png"
echo "files uploaded succesfully"
break
fi
done
sleep 6s
sudo poweroff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment