Skip to content
Merged
Show file tree
Hide file tree
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
27 changes: 17 additions & 10 deletions pawsey_minion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ mamba env create --yes --prefix /scratch/$PAWSEY_PROJECT/$USER/software/minicond
mamba env create --yes --prefix /scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite_vamb --file ../atavide_lite_vamb.yaml
```

Make sure you build atavide_lite/bin:

```
pushd $HOME/GitHubs/atavide_lite/bin
make all
popd
```

## 0. Get your data.

Expand Down Expand Up @@ -122,7 +129,7 @@ We use these assemblies, e.g. for binning with VAMB. The assemblies are not used
to complete before submitting the subsequent jobs.

```
MEGAHITJOB=$(sbatch --parsable --dependency=afterok:$HOSTJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA --array=1-$NUM_READS:1 $SRC/megahit.slurm)
MEGAHITJOB=$(sbatch --parsable --dependency=afterok:$HOSTJOB --array=1-$NUM_READS:1 $SRC/megahit.slurm)
```

## 9. Convert to fasta.
Expand Down Expand Up @@ -180,10 +187,10 @@ SANKEYJOB=$(sbatch --parsable --dependency=afterok:$COUNTSSJOB $SRC/sankey_plot.
If you have the assembly from above, you can use VAMB for binning the contigs

```
VCJOB=$(sbatch --parsable --dependency=afterok:$MEGAHITJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb_concat.slurm)
VMJOB=$(sbatch --parsable --dependency=afterok:$VCJOB --array=1-$NUM_READS:1 --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb_minimap.slurm)
VAMBJOB=$(sbatch --parsable --dependency=afterany:$VMJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb.slurm)
CHECKMJOB=$(sbatch --parsable --dependency=afterany:$VAMBJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/checkm.slurm vamb/bins/ vamb/checkm)
VCJOB=$(sbatch --parsable --dependency=afterok:$MEGAHITJOB $SRC/vamb_concat.slurm)
VMJOB=$(sbatch --parsable --dependency=afterok:$VCJOB --array=1-$NUM_READS:1 $SRC/vamb_minimap.slurm)
VAMBJOB=$(sbatch --parsable --dependency=afterany:$VMJOB $SRC/vamb.slurm)
CHECKMJOB=$(sbatch --parsable --dependency=afterany:$VAMBJOB $SRC/checkm.slurm vamb/bins/ vamb/checkm)
```


Expand Down Expand Up @@ -221,11 +228,11 @@ SSJOB=$(sbatch --parsable --dependency=afterok:$MMSEQSJOB --array=1-$NUM_READS:1
COUNTSSJOB=$(sbatch --parsable --dependency=afterok:$SSJOB $SRC/count_subsystems.slurm)
SANKEYJOB=$(sbatch --parsable --dependency=afterok:$COUNTSSJOB $SRC/sankey_plot.slurm)

MEGAHITJOB=$(sbatch --parsable --dependency=afterok:$HOSTJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA --array=1-$NUM_READS:1 $SRC/megahit.slurm)
VCJOB=$(sbatch --parsable --dependency=afterok:$MEGAHITJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb_concat.slurm)
VMJOB=$(sbatch --parsable --dependency=afterok:$VCJOB --array=1-$NUM_READS:1 --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb_minimap.slurm)
VAMBJOB=$(sbatch --parsable --dependency=afterany:$VMJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/vamb.slurm)
CHECKMJOB=$(sbatch --parsable --dependency=afterany:$VAMBJOB --export=ATAVIDE_CONDA=$ATAVIDE_CONDA $SRC/checkm.slurm vamb/bins/ vamb/checkm)
MEGAHITJOB=$(sbatch --parsable --dependency=afterok:$HOSTJOB --array=1-$NUM_READS:1 $SRC/megahit.slurm)
VCJOB=$(sbatch --parsable --dependency=afterok:$MEGAHITJOB $SRC/vamb_concat.slurm)
VMJOB=$(sbatch --parsable --dependency=afterok:$VCJOB --array=1-$NUM_READS:1 $SRC/vamb_minimap.slurm)
VAMBJOB=$(sbatch --parsable --dependency=afterany:$VMJOB $SRC/vamb.slurm)
CHECKMJOB=$(sbatch --parsable --dependency=afterany:$VAMBJOB $SRC/checkm.slurm vamb/bins/ vamb/checkm)

```

22 changes: 22 additions & 0 deletions pawsey_minion/download_human.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
#SBATCH --job-name=human_download
#SBATCH --time=1-0
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=32G
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

DEST=/scratch/$PAWSEY_PROJECT/$USER/Databases/human

mkdir -p $DEST
cd $DEST

if [[ -e GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set.fna.gz ]]; then
echo "GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set.fna.gz already exists. Nothing to do";
touch GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set.fna.gz;
exit 0
fi

curl -LO https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/001/405/GCF_000001405.40_GRCh38.p14/GRCh38_major_release_seqs_for_alignment_pipelines/GCA_000001405.15_GRCh38_no_alt_plus_hs38d1_analysis_set.fna.gz

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject incomplete human database downloads

If this transfer is interrupted or receives an HTTP error, the script has neither set -e nor curl's --fail behavior (curl documentation), so it proceeds to the final echo and reports a successful Slurm job. Because -O writes directly to the final filename and the earlier guard checks only existence, a partial or error-response file is then accepted as a complete human database on every retry; propagate curl failures and download atomically before exposing the final filename.

Useful? React with 👍 / 👎.

echo "Downloaded human db to $DEST"
38 changes: 38 additions & 0 deletions pawsey_minion/download_taxon_db.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
#SBATCH --job-name=taxon_dld
#SBATCH --time=1-0
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=32G
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

TAXDIR="/scratch/$PAWSEY_PROJECT/$USER/Databases/NCBI/taxonomy/current"

mkdir -p $TAXDIR
cd $TAXDIR;

required_files=(
citations.dmp delnodes.dmp division.dmp gc.prt
gencode.dmp images.dmp merged.dmp names.dmp
nodes.dmp readme.txt
)

missing=0

for file in "${required_files[@]}"; do
if [[ ! -f "$file" ]]; then
echo "Missing: $file"
missing=1
fi
done

if [[ $missing -eq 1 ]]; then
echo "One or more files are missing. Downloading taxdump.tar.gz..."
curl -LO https://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz
tar zxf taxdump.tar.gz && rm -f taxdump.tar.gz
Comment on lines +32 to +33

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate taxonomy extraction failures

If the taxonomy transfer is interrupted or the archive is corrupt, curl or tar can return nonzero, but this script continues to the final echo "Done" and exits successfully. Slurm will therefore report a completed download even though required taxonomy files may be missing or partially extracted; make the download/extraction failure terminate the script and only expose validated files.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fix comments

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Testing

  • git diff --check
  • bash -n pawsey_minion/download_taxon_db.slurm pawsey_shortread/download_taxon_db.slurm
  • ⚠️ shellcheck pawsey_minion/download_taxon_db.slurm pawsey_shortread/download_taxon_db.slurm (ShellCheck is not installed in the environment.)
  • git status --porcelain (working tree clean after commit)

View task →

else
echo "All required files are present."
fi

echo "Done"
66 changes: 66 additions & 0 deletions pawsey_minion/download_uniref100.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
#SBATCH --job-name=MMSeqsDld100
#SBATCH --time=1-0
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=128G
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

# Use `mmseqs databases` to find information about the preformatted databases
# NOTE: Do not download the NT database unless you _really_ need it. The database is huge!


set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR

# test we have atavide_lite conda installed, and then activate it
eval "$(conda shell.bash hook)"
"$HOME/GitHubs/atavide_lite/pawsey_lib/check_atavide_lite_env.sh"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite"
conda activate $ATAVIDE_CONDA

CWD=`pwd`

#DB can also be UniRef100 UniRef100 GTDB etc
DB=UniRef100


required_files=(
UniRef100 UniRef100.dbtype UniRef100_h UniRef100_h.dbtype
UniRef100_h.index UniRef100.index UniRef100.lookup UniRef100_mapping
UniRef100.source UniRef100_taxonomy UniRef100.version
)

missing=0

DESTINATION=/scratch/$PAWSEY_PROJECT/$USER/Databases/$DB
TMP=/scratch/$PAWSEY_PROJECT/$USER/tmp
mkdir -p $DESTINATION $TMP

cd $DESTINATION

for file in "${required_files[@]}"; do
if [[ ! -f "$DB/$file" ]]; then
echo "Missing: $DB/$file"
missing=1
fi
done

if [[ $missing -eq 0 ]]; then
echo "All required files are present."
exit 0
fi

echo "Downloading required files"

cd $CWD
# delete the old Destination and make the dir to remove partial files.

rm -rf $DESTINATION && mkdir -p $DESTINATION
TPD=$(mktemp -d -p $TMP)
echo -e "Downloading to $DESTINATION/$DB and using temp location $TPD.\nNote we download the tarball and then uncompress, so there is usually nothing in the output for a while!" >&2
mmseqs databases --threads 8 $DB $DESTINATION/$DB $TPD



67 changes: 67 additions & 0 deletions pawsey_minion/download_uniref50.slurm
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
#SBATCH --job-name=MMSeqsDld
#SBATCH --time=1-0
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=128G
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

# Use `mmseqs databases` to find information about the preformatted databases
# NOTE: Do not download the NT database unless you _really_ need it. The database is huge!



set -euo pipefail
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR

# test we have atavide_lite conda installed, and then activate it
eval "$(conda shell.bash hook)"
"$HOME/GitHubs/atavide_lite/pawsey_lib/check_atavide_lite_env.sh"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite"
conda activate $ATAVIDE_CONDA

CWD=`pwd`

#DB can also be UniRef50 UniRef100 GTDB etc
DB=UniRef50


required_files=(
UniRef50 UniRef50.dbtype UniRef50_h UniRef50_h.dbtype
UniRef50_h.index UniRef50.index UniRef50.lookup UniRef50_mapping
UniRef50.source UniRef50_taxonomy UniRef50.version
)

missing=0

DESTINATION=/scratch/$PAWSEY_PROJECT/$USER/Databases/$DB
TMP=/scratch/$PAWSEY_PROJECT/$USER/tmp
mkdir -p $DESTINATION $TMP

cd $DESTINATION

for file in "${required_files[@]}"; do
if [[ ! -f "$DB/$file" ]]; then
echo "Missing: $DB/$file"
missing=1
fi
done

if [[ $missing -eq 0 ]]; then
echo "All required files are present."
exit 0
fi

echo "Downloading required files"

cd $CWD
# delete the old Destination and make the dir to remove partial files.

rm -rf $DESTINATION && mkdir -p $DESTINATION
TPD=$(mktemp -d -p $TMP)
echo -e "Downloading to $DESTINATION/$DB and using temp location $TPD.\nNote we download the tarball and then uncompress, so there is usually nothing in the output for a while!" >&2
mmseqs databases --threads 8 $DB $DESTINATION/$DB $TPD



10 changes: 7 additions & 3 deletions pawsey_minion/vamb.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
# test we have atavide_lite conda installed, and then activate it
eval "$(conda shell.bash hook)"
"$HOME/GitHubs/atavide_lite/pawsey_lib/check_atavide_lite_env.sh"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite_vamb"
conda activate $ATAVIDE_CONDA

module load pytorch/2.2.0-rocm5.7.3
# module load pytorch/2.2.0-rocm5.7.3
module load pytorch/2.7.1-rocm6.3.3

if [[ ! -e DEFINITIONS.sh ]]; then
echo "Please create a DEFINITIONS.sh file with SOURCE, FILEEND, HOSTREMOVED" >&2
Expand All @@ -35,11 +36,14 @@ if [[ ! -e $OUTDIR/contigs.fna.gz ]]; then
exit 1;
fi

mkdir -p $OUTDIR/mapped_reads

for READS in $(sort -R reads.txt); do
BAM=${READS/$FILEEND/.bam}
echo "READS: $READS BAM: $BAM" >&2;
if [[ -e $OUTDIR/mapped_reads/$BAM ]]; then
if [[ ! -e $OUTDIR/mapped_reads/$BAM ]]; then
echo "Bam file: '$OUTDIR/mapped_reads/$BAM' not found. Data generated" >&2;
Comment on lines 41 to 45

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — added mkdir -p $OUTDIR/mapped_reads inside the if [[ ! -e ... ]] block before the minimap2/samtools pipeline runs.

mkdir -p $OUTDIR/mapped_reads
minimap2 -t 16 -N 5 -ax map-ont $OUTDIR/contigs.mmi --split-prefix mmsplit$$ fastq/$READS | samtools view -F 3584 -b --threads 16 | samtools sort -@ 16 -o $OUTDIR/mapped_reads/$BAM -
fi
done
Expand Down
2 changes: 1 addition & 1 deletion pawsey_minion/vamb_concat.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
# test we have atavide_lite conda installed, and then activate it
eval "$(conda shell.bash hook)"
"$HOME/GitHubs/atavide_lite/pawsey_lib/check_atavide_lite_env.sh"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite"
ATAVIDE_CONDA="/scratch/$PAWSEY_PROJECT/$USER/software/miniconda3/atavide_lite_vamb"
conda activate $ATAVIDE_CONDA

mkdir -p vamb
Expand Down
7 changes: 7 additions & 0 deletions pawsey_shortread/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ mamba env create --yes --prefix /scratch/$PAWSEY_PROJECT/$USER/software/minicond

This creates an `atavide_lite` and `atavide_lite_vamb` conda environments for us to use.

Make sure you build atavide_lite/bin:

```
pushd $HOME/GitHubs/atavide_lite/bin
make all
popd
```

## 0. Get your data.

Expand Down
4 changes: 2 additions & 2 deletions pawsey_shortread/download_human.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=32G
#SBATCH -o slurm/human_download-%j.out
#SBATCH -e slurm/human_download-%j.err
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

DEST=/scratch/$PAWSEY_PROJECT/$USER/Databases/human

Expand Down
4 changes: 2 additions & 2 deletions pawsey_shortread/download_taxon_db.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=32G
#SBATCH -o slurm_output/taxon_download-%j.out
#SBATCH -e slurm_output/taxon_download-%j.err
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

TAXDIR="/scratch/$PAWSEY_PROJECT/$USER/Databases/NCBI/taxonomy/current"

Expand Down
4 changes: 2 additions & 2 deletions pawsey_shortread/download_uniref50.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=128G
#SBATCH -o mmseqsdld-%j.out
#SBATCH -e mmseqsdld-%j.err
#SBATCH -o %x-%j.out
#SBATCH -e %x-%j.err

# Use `mmseqs databases` to find information about the preformatted databases
# NOTE: Do not download the NT database unless you _really_ need it. The database is huge!
Expand Down
2 changes: 1 addition & 1 deletion pawsey_shortread/mmseqs_easy_taxonomy100.slurm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


#SBATCH --job-name=mmseqsET100
#SBATCH --time=1-0
#SBATCH --time=06:00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=480G
Expand Down