-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Find Tracheophyta reads putatively belonging to Pseudotsuga menziesii #### | ||
# Check the validity of the parallelization argument #### | ||
if [[ $# -lt 1 ]]; then | ||
echo 'Error: Please specify the number of threads to launch' | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -gt 1 ]]; then | ||
echo 'Error: Too many arguments have been provided' | ||
exit 1 | ||
fi | ||
|
||
if [[ $1 =~ [^0-9]+ ]]; then | ||
echo 'Error: Only integer arguments are accepted' | ||
exit 1 | ||
fi | ||
|
||
if [[ $1 -lt 1 ]]; then | ||
echo 'Error: At least one thread is needed' | ||
exit 1 | ||
fi | ||
|
||
# Set or make directories for input, output and log files #### | ||
in1='03-denoise/filter' | ||
in2='01-demultiplex' | ||
out='03-host' | ||
logs="${out}/logs" | ||
rm -r $out | ||
mkdir -p $logs | ||
touch $out/README.md | ||
|
||
# Use ITSxpress to single out Tracheophyta ITS2 (not sure of specificity) #### | ||
for fwd in $(find $in1 -name "*fun_rev-rc-R1.fq.gz" | grep -f data/nano-k.txt); do | ||
|
||
# Make the name of the corresponding reverse read #### | ||
rev=$(echo $fwd | sed 's/R1.fq.gz/R2.fq.gz/') | ||
|
||
# Make a sample name for each file #### | ||
sample=$(basename $fwd | awk -F '-' '{print $1"-"$2"-"$3"-"$4"-"$5"-"$6}') | ||
|
||
# Extract ITS #### | ||
itsxpress --fastq $fwd --fastq2 $rev --region ITS2 \ | ||
--taxa Tracheophyta --log $logs/${sample}-itsxpress.txt --outfile ${sample}.fq.gz --threads $1 | ||
|
||
done |