Skip to content

Commit

Permalink
added files of template characterization-taxprofiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-VM committed Aug 23, 2024
1 parent fd69fcc commit 1d6731d
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SETUP INTPUT SAMPLE SHEET
ln -s ../00-reads .
ln -s ../samples_id.txt .

# Function to print colored text
print_color() {
case "$2" in
"red")
echo -e "\e[1;31m$1\e[0m"
;;
"green")
echo -e "\e[1;32m$1\e[0m"
;;
"blue")
echo -e "\e[1;34m$1\e[0m"
;;
*)
echo "$1"
;;
esac
}

# Function to prompt with color
prompt_with_color() {
read -p "$(print_color $1 'blue') $2" response
}

# Select whether to save trimmed reads
trim_options=("Yes" "No")
print_color "Do you want to save trimmed reads in outdir?" 'blue'
select TRIMMED in "${trim_options[@]}"; do
if [ -n "$TRIMMED" ]; then
# rename trimmed
if [ "$TRIMMED" == "Yes" ] || [ "$TRIMMED" == "y" ]; then
SAVETRIMMED="true"
else
SAVETRIMMED="false"
fi

break
else
print_color "Invalid input. Please select a valid option." 'red'
fi
done
print_color "Selected trimmed file option: $TRIMMED save trimmed" 'green'


# Samples sheet setup
echo "sample,run_accession,instrument_platform,fastq_1,fastq_2,fasta" > samplesheet.csv
cat samples_id.txt | while read in; do
echo "${in},run1,ILLUMINA,00-reads/${in}_R1.fastq.gz,00-reads/${in}_R2.fastq.gz,"
done >> samplesheet.csv

scratch_dir=$(echo $PWD | sed "s/\/data\/bi\/scratch_tmp/\/scratch/g")

# slurm sbatch file setup
cat <<EOF > taxprofiler.sbatch
#!/bin/sh
#SBATCH --ntasks 1
#SBATCH --cpus-per-task 2
#SBATCH --mem 4G
#SBATCH --time 2:00:00
#SBATCH --partition middle_idx
#SBATCH --output $(date '+%Y%m%d')_taxprofiler.log
#SBATCH --chdir $scratch_dir

# module load Nextflow/23.10.0 singularity
export NXF_OPTS="-Xms500M -Xmx10G"

nextflow run /data/bi/pipelines/nf-core-taxprofiler/nf-core-taxprofiler-1.1.8 \\
-profile singularity \\
-c ../../DOC/hpc_slurm_taxprofiler.config \\
--input samplesheet.csv \\
--outdir ./ \\
--databases ../../DOC/databasesheet.csv \\
--preprocessing_qc_tool fastqc \\
--save_preprocessed_reads ${SAVETRIMMED} \\
--perform_shortread_qc true \\
--shortread_qc_tool fastp \\
--perform_shortread_hostremoval true \\
--hostremoval_reference /data/bi/references/eukaria/homo_sapiens/hg38/NCBI/genome/GCF_000001405.40_GRCh38.p14/GCF_000001405.40_GRCh38.p14_genomic.fna.gz \\
--run_kraken2 true \\
--run_bracken true \\
--run_centrifuge true \\
--run_kaiju true \\
--run_metaphlan true \\
--run_krona true \\
-resume
EOF

echo "sbatch taxprofiler.sbatch" > _01_nf_taxprofiler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mkdir -p 00-reads

cd 00-reads; cat ../samples_id.txt | xargs -I % echo "ln -s ../../RAW/%_*R1*.fastq.gz %_R1.fastq.gz" | bash; cd -
cd 00-reads; cat ../samples_id.txt | xargs -I % echo "ln -s ../../RAW/%_*R2*.fastq.gz %_R2.fastq.gz" | bash; cd -

mv ANALYSIS02_TAXPROFILING $(date '+%Y%m%d')_ANALYSIS02_TAXPROFILING
6 changes: 6 additions & 0 deletions bu_isciii/templates/characterization/DOC/databasesheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tool,db_name,db_params,db_path
kraken2,db1,,/data/bi/references/kraken/minikraken_8GB_20200312.tgz
bracken,db2,,/data/bi/references/bracken/bracken_minikraken_8GB_20200312.tgz
centrifuge,db3,,/data/bi/references/centrifuge/201612_centrifuge_index_p+h+v.tar.gz
metaphlan,db4,,/data/bi/references/metaphlan/mpa_vJun23_CHOCOPhlAnSGB_20240/
kaiju,db5,,/data/bi/references/kaiju/nr_euk_2023-05-10/
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
HPC XTUTATIS CONFIGURATION
*/

singularity {
enabled = true
autoMounts = true
singularity.cacheDir = '/data/cnm/ratb/pipelines/singularity-images/'
}

process {
executor = 'slurm'
queue = 'middle_idx'
jobName = { "$task.name - $task.hash" }
conda = null

errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' }

withName:'KAIJU_KAIJU' {
errorStrategy = { task.exitStatus in [143,137,21,1] ? 'retry' : 'finish' }
maxRetries = 3
memory = { 72.GB * task.attempt }
time = { 8.h }
}
}

params {
max_memory = 376.GB
max_cpus = 32
max_time = '24.h'
}

/*
Custom base.config
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DELIVERY_FOLDER="$(date '+%Y%m%d')_entrega01"
mkdir -p $DELIVERY_FOLDER/taxprofiling

# Taxprofiling service
cd $DELIVERY_FOLDER/taxprofiling

# Links to reports
ln -s ../../../ANALYSIS/*ANALYSIS02_TAXPROFILING/results/multiqc/multiqc_report.html .

0 comments on commit 1d6731d

Please sign in to comment.