-
Notifications
You must be signed in to change notification settings - Fork 4
More updates #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More updates #33
Changes from all commits
cd9c516
a8432a0
dd415ba
eae0b75
2297d14
538e73f
7d66ebf
6b601df
119151a
a0ebd16
e16ec45
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| echo "Downloaded human db to $DEST" | ||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the taxonomy transfer is interrupted or the archive is corrupt, Useful? React with 👍 / 👎.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @codex fix comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Summary
Testing
|
||
| else | ||
| echo "All required files are present." | ||
| fi | ||
|
|
||
| echo "Done" | ||
| 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 | ||
|
|
||
|
|
||
|
|
| 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 | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed — added |
||
| 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this transfer is interrupted or receives an HTTP error, the script has neither
set -enor curl's--failbehavior (curl documentation), so it proceeds to the finalechoand reports a successful Slurm job. Because-Owrites 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 👍 / 👎.