Skip to content

Commit

Permalink
add arguments in r script and run the hpc job with oneliners
Browse files Browse the repository at this point in the history
  • Loading branch information
savvas-paragkamian committed Sep 29, 2023
1 parent fd2b408 commit 2bae6b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 4 additions & 2 deletions scripts/isd_crete_dada2_taxonomy.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ library(dada2, lib.loc="/home1/s.paragkamian/software/R/4.1.1")

# Working Environment
# path of the sequences as retrieved from ENA
path <- "/home1/s.paragkamian/isd-crete/ena_data"
output_path <- "/home1/s.paragkamian/isd-crete/dada2_output"
args = commandArgs(trailingOnly=TRUE)

path <- args[1] #"/home1/s.paragkamian/isd-crete/ena_data"
output_path <- args[2]# "/home1/s.paragkamian/isd-crete/dada2_output"

setwd(output_path)

Expand Down
22 changes: 20 additions & 2 deletions scripts/isd_crete_hpc_job_dada2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#SBATCH --partition=fat
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=20
#SBATCH --ntasks-per-node=30
#SBATCH --mem=400G
#SBATCH --job-name="isd-species"
#SBATCH [email protected]
Expand All @@ -12,10 +12,28 @@

start=`date +%s`

data_path="/home1/s.paragkamian/isd-crete/ena_data"
output_path="/home1/s.paragkamian/isd-crete/dada2_output"
module purge # unloads all previous loads

module load R/4.1.1 #loads R/4.1.1
/home1/s.paragkamian/isd-crete/scripts/isd_crete_dada2_taxonomy.R
/home1/s.paragkamian/isd-crete/scripts/isd_crete_dada2_taxonomy.R $data_path $output_path


dada2=`date +%s`
runtime_dada2=$((dada2-start))
echo $((runtime_dada2/60)) " minutes for the DADA2 pipeline"
echo "start the helper oneliners"

cd $output_path
cd taxonomy

gawk -F"\t" 'BEGIN{print "file" "\t" "asv_id" "\t" "abundance"}(NR==1){split($0,asv,"\t")}(NR>1){split($0, data, "\t"); for (i=2; i<=length(data); ++i){print data[1] "\t" "asv"i-1 "\t" data[i]}}' seqtab_nochim.tsv > seqtab_nochim_long.tsv

gawk -F"\t" 'BEGIN{print "asv_id" "\t" "asv"}(NR==1){split($0,asv,"\t"); for (i in asv){print "asv"i "\t" asv[i]}}' seqtab_nochim.tsv > asv_fasta_ids.tsv

cd ../
/home1/s.paragkamian/isd-crete/scripts/isd_crete_reads_summary.sh -i filtered -o .

module purge

Expand Down

0 comments on commit 2bae6b8

Please sign in to comment.