-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #152 from RoanKanninga/master
new style generate_template
- Loading branch information
Showing
4 changed files
with
104 additions
and
82 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,109 @@ | ||
#!/bin/bash | ||
|
||
module load NGS_DNA/3.4.1 | ||
module list | ||
HOST=$(hostname -s) | ||
thisDir=$(pwd) | ||
module list | ||
host=$(hostname -s) | ||
environmentParameters="parameters_${host}" | ||
|
||
function showHelp() { | ||
# | ||
# Display commandline help on STDOUT. | ||
# | ||
cat <<EOH | ||
=============================================================================================================== | ||
Script to copy (sync) data from a succesfully finished analysis project from tmp to prm storage. | ||
Usage: | ||
$(basename $0) OPTIONS | ||
Options: | ||
-h Show this help. | ||
-a sampleType (DNA or RNA) (default=DNA) | ||
-b build (default=b37) | ||
-c batch (_chr or _small) (default=_chr) | ||
-g group (default=basename of ../../../ ) | ||
-p project (default=basename of this directory) | ||
-r runID (default=run01) | ||
-s species (default=homo_sapiens) | ||
-t tmpDirectory (default=basename of ../../ ) | ||
-w workdir (default=/groups/\${group}/\${tmpDirectory}) | ||
=============================================================================================================== | ||
EOH | ||
trap - EXIT | ||
exit 0 | ||
} | ||
|
||
|
||
while getopts "t:g:w:p:r:s:b:c:h" opt; | ||
do | ||
case $opt in h)showHelp;; t)tmpDirectory="${OPTARG}";; g)group="${OPTARG}";; w)workDir="${OPTARG}";; p)project="${OPTARG}";; r)runID="${OPTARG}";; s)species="${OPTARG}";; b)build="${OPTARG}";; c)batch="${OPTARG}";; | ||
esac | ||
done | ||
|
||
if [[ -z "${tmpDirectory:-}" ]]; then tmpDirectory=$(basename $(cd ../../ && pwd )) ; fi ; echo "tmpDirectory=${tmpDirectory}" | ||
if [[ -z "${group:-}" ]]; then group=$(basename $(cd ../../../ && pwd )) ; fi ; echo "group=${group}" | ||
if [[ -z "${workDir:-}" ]]; then workDir="/groups/${group}/${tmpDirectory}" ; fi ; echo "workDir=${workDir}" | ||
if [[ -z "${project:-}" ]]; then project=$(basename $(pwd )) ; fi ; echo "project=${project}" | ||
if [[ -z "${runID:-}" ]]; then runID="run01" ; fi ; echo "runID=${runID}" | ||
if [[ -z "${species:-}" ]]; then species="homo_sapiens" ; fi ; echo "species=${species}" | ||
if [[ -z "${build:-}" ]]; then build="b37" ; fi ; echo "build=${build}" | ||
if [[ -z "${batch:-}" ]]; then batch="_chr"; fi ; echo "batch=${batch}" | ||
|
||
ENVIRONMENT_PARAMETERS="parameters_${HOST}.csv" | ||
TMPDIRECTORY=$(basename $(cd ../../ && pwd )) | ||
GROUP=$(basename $(cd ../../../ && pwd )) | ||
|
||
PROJECT=projectXX | ||
WORKDIR="/groups/${GROUP}/${TMPDIRECTORY}" | ||
RUNID=runXX | ||
SPECIES="homo_sapiens" | ||
BUILD="b37" | ||
|
||
## Normal user, please leave BATCH at _chr | ||
## For expert modus: small batchsize (6) fill in '_small' or per chromosome fill in _chr | ||
BATCH="_chr" | ||
|
||
GENSCRIPTS="${WORKDIR}/generatedscripts/${PROJECT}" | ||
|
||
samplesheet=${GENSCRIPTS}/${PROJECT}.csv | ||
mac2unix $samplesheet | ||
genScripts="${workDir}/generatedscripts/${project}/" | ||
samplesheet="${genScripts}/${project}.csv" ; mac2unix "${samplesheet}" | ||
|
||
python ${EBROOTNGS_DNA}/scripts/samplesize.py ${samplesheet} $thisDir | ||
SAMPLESIZE=$(cat externalSampleIDs.txt | uniq | wc -l) | ||
python "${EBROOTNGS_DNA}/scripts/samplesize.py" "${samplesheet}" $(pwd) | ||
sampleSize=$(cat externalSampleIDs.txt | uniq | wc -l) | ||
echo "Samplesize is ${sampleSize}" | ||
|
||
python ${EBROOTNGS_DNA}/scripts/gender.py $samplesheet | ||
var=$(cat ${samplesheet}.tmp | wc -l) | ||
python "${EBROOTNGS_DNA}/scripts/gender.py" "${samplesheet}" | ||
var=$(cat "${samplesheet}.tmp" | wc -l) | ||
|
||
|
||
if [ $var != 0 ] | ||
if [ "${var}" != 0 ] | ||
then | ||
mv ${samplesheet}.tmp ${samplesheet} | ||
mv "${samplesheet}.tmp" "${samplesheet}" | ||
echo "samplesheet updated with Gender column" | ||
fi | ||
echo "Samplesize is $SAMPLESIZE" | ||
|
||
if [ $SAMPLESIZE -gt 199 ] | ||
if [ $sampleSize -gt 199 ] | ||
then | ||
WORKFLOW=${EBROOTNGS_DNA}/workflow_samplesize_bigger_than_200.csv | ||
workflow=${EBROOTNGS_DNA}/workflow_samplesize_bigger_than_200.csv | ||
else | ||
WORKFLOW=${EBROOTNGS_DNA}/workflow.csv | ||
fi | ||
|
||
if [ -f .compute.properties ]; | ||
then | ||
rm .compute.properties | ||
fi | ||
|
||
if [ -f ${GENSCRIPTS}/out.csv ]; | ||
then | ||
rm -rf ${GENSCRIPTS}/out.csv | ||
workflow=${EBROOTNGS_DNA}/workflow.csv | ||
fi | ||
|
||
echo "tmpName,${TMPDIRECTORY}" > ${GENSCRIPTS}/tmpdir_parameters.csv | ||
|
||
perl ${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl ${GENSCRIPTS}/tmpdir_parameters.csv > \ | ||
${GENSCRIPTS}/tmpdir_parameters_converted.csv | ||
|
||
perl ${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl ${EBROOTNGS_DNA}/parameters.csv > \ | ||
${GENSCRIPTS}/out.csv | ||
|
||
perl ${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl ${EBROOTNGS_DNA}/parameters_${GROUP}.csv > \ | ||
${GENSCRIPTS}/group_parameters.csv | ||
|
||
perl ${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl ${EBROOTNGS_DNA}/${ENVIRONMENT_PARAMETERS} > \ | ||
${GENSCRIPTS}/environment_parameters.csv | ||
|
||
|
||
sh $EBROOTMOLGENISMINCOMPUTE/molgenis_compute.sh \ | ||
-p ${GENSCRIPTS}/out.csv \ | ||
-p ${GENSCRIPTS}/group_parameters.csv \ | ||
-p ${GENSCRIPTS}/environment_parameters.csv \ | ||
-p ${GENSCRIPTS}/tmpdir_parameters_converted.csv \ | ||
-p ${EBROOTNGS_DNA}/batchIDList${BATCH}.csv \ | ||
-p ${GENSCRIPTS}/${PROJECT}.csv \ | ||
-w ${EBROOTNGS_DNA}/create_in-house_ngs_projects_workflow.csv \ | ||
-rundir ${GENSCRIPTS}/scripts \ | ||
--runid ${RUNID} \ | ||
-o "workflowpath=${WORKFLOW};\ | ||
outputdir=scripts/jobs;mainParameters=${GENSCRIPTS}/out.csv;\ | ||
group_parameters=${GENSCRIPTS}/group_parameters.csv;\ | ||
groupname=${GROUP};\ | ||
if [ -f "${genScripts}/out.csv" ];then rm -rf "${genScripts}/out.csv" ; fi | ||
|
||
echo "tmpName,${tmpDirectory}" > ${genScripts}/tmpdir_parameters.csv | ||
perl "${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl" "${genScripts}/tmpdir_parameters.csv" > "${genScripts}/tmpdir_parameters_converted.csv" | ||
perl "${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl" "${EBROOTNGS_DNA}/parameters.csv" > "${genScripts}/out.csv" | ||
perl "${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl" "${EBROOTNGS_DNA}/parameters_${group}.csv" > "${genScripts}/group_parameters.csv" | ||
perl "${EBROOTNGS_DNA}/scripts/convertParametersGitToMolgenis.pl" "${EBROOTNGS_DNA}/${environmentParameters}.csv" > "${genScripts}/environment_parameters.csv" | ||
|
||
echo "BATCHIDLIST=${EBROOTNGS_DNA}/batchIDList${batch}.csv" | ||
|
||
sh "${EBROOTMOLGENISMINCOMPUTE}/molgenis_compute.sh" \ | ||
-p "${genScripts}/out.csv" \ | ||
-p "${genScripts}/group_parameters.csv" \ | ||
-p "${genScripts}/environment_parameters.csv" \ | ||
-p "${genScripts}/tmpdir_parameters_converted.csv" \ | ||
-p "${EBROOTNGS_DNA}/batchIDList${batch}.csv" \ | ||
-p "${genScripts}/${project}.csv" \ | ||
-w "${EBROOTNGS_DNA}/create_in-house_ngs_projects_workflow.csv" \ | ||
-rundir "${genScripts}/scripts" \ | ||
--runid "${runID}" \ | ||
-o workflowpath="${workflow};\ | ||
outputdir=scripts/jobs;mainParameters=${genScripts}/out.csv;\ | ||
group_parameters=${genScripts}/group_parameters.csv;\ | ||
groupname=${group};\ | ||
ngsversion=$(module list | grep -o -P 'NGS_DNA(.+)');\ | ||
environment_parameters=${GENSCRIPTS}/environment_parameters.csv;\ | ||
tmpdir_parameters=${GENSCRIPTS}/tmpdir_parameters_converted.csv;\ | ||
batchIDList=${EBROOTNGS_DNA}/batchIDList${BATCH}.csv;\ | ||
worksheet=${GENSCRIPTS}/${PROJECT}.csv" \ | ||
environment_parameters=${genScripts}/environment_parameters.csv;\ | ||
tmpdir_parameters=${genScripts}/tmpdir_parameters_converted.csv;\ | ||
batchIDList=${EBROOTNGS_DNA}/batchIDList${batch}.csv;\ | ||
worksheet=${genScripts}/${project}.csv" \ | ||
-weave \ | ||
--generate | ||
|
This file contains 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
This file contains 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