Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bunch of hacks for control flow #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ process RepeatMasker1 {
set age, 'seqfile.outinner.out', 'seqfile.outinner.masked' into repeatMasker1Unclean

"""
# only run RepeatMasker if the previous processes have found anything, i.e. there is something in their output file
if [[ `wc -l repeats_to_mask_LTR.fasta | cut -c 1` != "0" ]]; then

RepeatMasker \
-lib repeats_to_mask_LTR.fasta \
-nolow \
Expand All @@ -203,6 +206,10 @@ RepeatMasker \

if [ ! -f seqfile.outinner.masked ]; then
cp seqfile.outinner seqfile.outinner.masked
fi

#otherwise create empty dummy files in order for following processes not to crash
else touch seqfile.outinner.masked seqfile.outinner.out;
fi
"""
}
Expand Down Expand Up @@ -251,6 +258,12 @@ outinner_blastx_parse.pl \

if [ ! -s passed_outinner_sequence.fasta ]; then
echo -e '>dummy empty sequence\nACTACTAC' > passed_outinner_sequence.fasta
fi
#this follows on from above, if 'old' or 'new' did not find anything, a dummy file needs to be created
#in order for following processes not to crash

if [[ `wc -l passed_outinner_sequence.fasta | cut -c 1` == "0" ]]; then
echo -e '>dummy empty sequence\nACTACTAC' > passed_outinner_sequence.fasta
fi
"""
}
Expand All @@ -273,6 +286,9 @@ process buildExemplars {
set age, 'LTR.lib' into exemplars

"""
#Only run the scripts if previous processes found something, otherwise don't bother and create a dummy file
if [[ `wc -l CRL_Step3_Passed_Elements.fasta | cut -c 1` != "0" ]]; then

CRL_Step4.pl \
--step3 CRL_Step3_Passed_Elements.fasta \
--resultfile seqfile.result \
Expand All @@ -297,6 +313,12 @@ CRL_Step5.pl \
--final LTR.lib \
--pcoverage 90 \
--pidentity 80

#This file needs to have at least one entry, hence the dummy entry, otherwise the pipeline crashes.
#I am however not sure if this dummy sequence will influence anything else downstream and it may have
#to be dealt with later
else echo -e '>dummy empty sequence\nACTACTAC' > LTR.lib;
fi
"""
}

Expand Down