Skip to content

Commit 1d6731d

Browse files
committed
added files of template characterization-taxprofiler
1 parent fd69fcc commit 1d6731d

File tree

5 files changed

+146
-0
lines changed

5 files changed

+146
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# SETUP INTPUT SAMPLE SHEET
2+
ln -s ../00-reads .
3+
ln -s ../samples_id.txt .
4+
5+
# Function to print colored text
6+
print_color() {
7+
case "$2" in
8+
"red")
9+
echo -e "\e[1;31m$1\e[0m"
10+
;;
11+
"green")
12+
echo -e "\e[1;32m$1\e[0m"
13+
;;
14+
"blue")
15+
echo -e "\e[1;34m$1\e[0m"
16+
;;
17+
*)
18+
echo "$1"
19+
;;
20+
esac
21+
}
22+
23+
# Function to prompt with color
24+
prompt_with_color() {
25+
read -p "$(print_color $1 'blue') $2" response
26+
}
27+
28+
# Select whether to save trimmed reads
29+
trim_options=("Yes" "No")
30+
print_color "Do you want to save trimmed reads in outdir?" 'blue'
31+
select TRIMMED in "${trim_options[@]}"; do
32+
if [ -n "$TRIMMED" ]; then
33+
# rename trimmed
34+
if [ "$TRIMMED" == "Yes" ] || [ "$TRIMMED" == "y" ]; then
35+
SAVETRIMMED="true"
36+
else
37+
SAVETRIMMED="false"
38+
fi
39+
40+
break
41+
else
42+
print_color "Invalid input. Please select a valid option." 'red'
43+
fi
44+
done
45+
print_color "Selected trimmed file option: $TRIMMED save trimmed" 'green'
46+
47+
48+
# Samples sheet setup
49+
echo "sample,run_accession,instrument_platform,fastq_1,fastq_2,fasta" > samplesheet.csv
50+
cat samples_id.txt | while read in; do
51+
echo "${in},run1,ILLUMINA,00-reads/${in}_R1.fastq.gz,00-reads/${in}_R2.fastq.gz,"
52+
done >> samplesheet.csv
53+
54+
scratch_dir=$(echo $PWD | sed "s/\/data\/bi\/scratch_tmp/\/scratch/g")
55+
56+
# slurm sbatch file setup
57+
cat <<EOF > taxprofiler.sbatch
58+
#!/bin/sh
59+
#SBATCH --ntasks 1
60+
#SBATCH --cpus-per-task 2
61+
#SBATCH --mem 4G
62+
#SBATCH --time 2:00:00
63+
#SBATCH --partition middle_idx
64+
#SBATCH --output $(date '+%Y%m%d')_taxprofiler.log
65+
#SBATCH --chdir $scratch_dir
66+
67+
# module load Nextflow/23.10.0 singularity
68+
export NXF_OPTS="-Xms500M -Xmx10G"
69+
70+
nextflow run /data/bi/pipelines/nf-core-taxprofiler/nf-core-taxprofiler-1.1.8 \\
71+
-profile singularity \\
72+
-c ../../DOC/hpc_slurm_taxprofiler.config \\
73+
--input samplesheet.csv \\
74+
--outdir ./ \\
75+
--databases ../../DOC/databasesheet.csv \\
76+
--preprocessing_qc_tool fastqc \\
77+
--save_preprocessed_reads ${SAVETRIMMED} \\
78+
--perform_shortread_qc true \\
79+
--shortread_qc_tool fastp \\
80+
--perform_shortread_hostremoval true \\
81+
--hostremoval_reference /data/bi/references/eukaria/homo_sapiens/hg38/NCBI/genome/GCF_000001405.40_GRCh38.p14/GCF_000001405.40_GRCh38.p14_genomic.fna.gz \\
82+
--run_kraken2 true \\
83+
--run_bracken true \\
84+
--run_centrifuge true \\
85+
--run_kaiju true \\
86+
--run_metaphlan true \\
87+
--run_krona true \\
88+
-resume
89+
EOF
90+
91+
echo "sbatch taxprofiler.sbatch" > _01_nf_taxprofiler.sh
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
mkdir -p 00-reads
2+
3+
cd 00-reads; cat ../samples_id.txt | xargs -I % echo "ln -s ../../RAW/%_*R1*.fastq.gz %_R1.fastq.gz" | bash; cd -
4+
cd 00-reads; cat ../samples_id.txt | xargs -I % echo "ln -s ../../RAW/%_*R2*.fastq.gz %_R2.fastq.gz" | bash; cd -
5+
6+
mv ANALYSIS02_TAXPROFILING $(date '+%Y%m%d')_ANALYSIS02_TAXPROFILING
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tool,db_name,db_params,db_path
2+
kraken2,db1,,/data/bi/references/kraken/minikraken_8GB_20200312.tgz
3+
bracken,db2,,/data/bi/references/bracken/bracken_minikraken_8GB_20200312.tgz
4+
centrifuge,db3,,/data/bi/references/centrifuge/201612_centrifuge_index_p+h+v.tar.gz
5+
metaphlan,db4,,/data/bi/references/metaphlan/mpa_vJun23_CHOCOPhlAnSGB_20240/
6+
kaiju,db5,,/data/bi/references/kaiju/nr_euk_2023-05-10/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
HPC XTUTATIS CONFIGURATION
3+
*/
4+
5+
singularity {
6+
enabled = true
7+
autoMounts = true
8+
singularity.cacheDir = '/data/cnm/ratb/pipelines/singularity-images/'
9+
}
10+
11+
process {
12+
executor = 'slurm'
13+
queue = 'middle_idx'
14+
jobName = { "$task.name - $task.hash" }
15+
conda = null
16+
17+
errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' }
18+
19+
withName:'KAIJU_KAIJU' {
20+
errorStrategy = { task.exitStatus in [143,137,21,1] ? 'retry' : 'finish' }
21+
maxRetries = 3
22+
memory = { 72.GB * task.attempt }
23+
time = { 8.h }
24+
}
25+
}
26+
27+
params {
28+
max_memory = 376.GB
29+
max_cpus = 32
30+
max_time = '24.h'
31+
}
32+
33+
/*
34+
Custom base.config
35+
*/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DELIVERY_FOLDER="$(date '+%Y%m%d')_entrega01"
2+
mkdir -p $DELIVERY_FOLDER/taxprofiling
3+
4+
# Taxprofiling service
5+
cd $DELIVERY_FOLDER/taxprofiling
6+
7+
# Links to reports
8+
ln -s ../../../ANALYSIS/*ANALYSIS02_TAXPROFILING/results/multiqc/multiqc_report.html .

0 commit comments

Comments
 (0)