Skip to content

Commit

Permalink
Use pigz whenever available
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed May 21, 2024
1 parent 393d3e2 commit cbaae60
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions lib/miga/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module MiGA
# - String indicating release status:
# - rc* release candidate, not released as gem
# - [0-9]+ stable release, released as gem
VERSION = [1.3, 15, 1].freeze
VERSION = [1.3, 15, 2].freeze

##
# Nickname for the current major.minor version.
VERSION_NAME = 'mezzotint'

##
# Date of the current gem relese.
VERSION_DATE = Date.new(2024, 5, 6)
VERSION_DATE = Date.new(2024, 5, 21)

##
# References of MiGA
Expand Down
4 changes: 2 additions & 2 deletions manual/part2/requirements/apt-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

If you prefer to see code in action, the full installation process
with apt-get is available as a
[Notebook in Google Colab](https://colab.research.google.com/gist/lmrodriguezr/78f2f48eadce96bc2dd526fd194fb00a/miga_1-2_apt_installation.ipynb).
[Notebook in Google Colab](https://colab.research.google.com/gist/lmrodriguezr/78f2f48eadce96bc2dd526fd194fb00a).

## Packages

Expand All @@ -13,7 +13,7 @@ Run:
```bash
sudo apt-get update
sudo apt-get install \
ruby ruby-sqlite3 r-base sqlite3 python3-pip \
ruby ruby-sqlite3 r-base sqlite3 python3-pip pigz \
libcurl4-openssl-dev zlib1g zlib1g-dev \
ncbi-blast+ hmmer bedtools idba prodigal mcl barrnap \
diamond-aligner trnascan-se fastp fastani seqtk
Expand Down
11 changes: 9 additions & 2 deletions manual/part2/requirements/brew.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

If you prefer to see code in action, the full installation process
with homebrew is available as a
[Notebook in Google Colab](https://colab.research.google.com/drive/1d4bRsudagAeYqzgmWRicv18c8Y17XEFM).
[Notebook in Google Colab](https://colab.research.google.com/gist/lmrodriguezr/5b77ae113e92f2efee5060902eb78a16).

# Installing requirements using Homebrew

Expand Down Expand Up @@ -36,11 +36,18 @@ Now that you have Homebrew, execute:
brew tap brewsci/bio
# In Linux, replace 'temurin' with 'openjdk'
brew install \
r sqlite3 python temurin \
r sqlite3 python numpy pigz temurin \
blast hmmer bedtools prodigal gmp idba mcl krona \
barrnap diamond fastani faqcs falco seqtk fastp trnascan
```

Additionally, recent changes in `pip` might break some installations, and
as such we recommend pre-installing python packages in a brew environment:

```bash
pip install --break-system-packages pyhmmer pyrodigal
```

We also recommend installing the `sqlite3` gem beforehand using the brew
libraries, to avoid headaches down the road (but this is optional):

Expand Down
2 changes: 1 addition & 1 deletion manual/part2/requirements/conda.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you don't have Conda, you can follow the

If you prefer to see code in action, the full installation process
with conda is available as a
[Notebook in Google Colab](https://colab.research.google.com/gist/lmrodriguezr/c973df8d63c1b0d2c6ebddc39f3d92fd/miga_1-2_conda_installation.ipynb).
[Notebook in Google Colab](https://colab.research.google.com/gist/lmrodriguezr/c973df8d63c1b0d2c6ebddc39f3d92fd).

## Note for macOS users

Expand Down
2 changes: 1 addition & 1 deletion scripts/cds.bash
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fi

# Gzip
for ext in gff3 faa fna ; do
[[ -e "$DATASET.$ext" ]] && gzip -9 -f "$DATASET.$ext"
[[ -e "$DATASET.$ext" ]] && gzip -9f "$DATASET.$ext"
done

# Finalize
Expand Down
5 changes: 5 additions & 0 deletions scripts/miga.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function exists { [[ -e "$1" ]] ; }
# Evaluates if the first passed argument is a function
function fx_exists { [[ $(type -t "$1") == "function" ]] ; }

# Override gzip with pigz (if available)
if which -s pigz ; then
function gzip { pigz -p ${CORES:-2} "$@" ; }
fi

# Initiate a project-wide run
function miga_start_project_step {
local dir="$1"
Expand Down
10 changes: 4 additions & 6 deletions scripts/mytaxa.bash
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ else
ktImportText -o "$DATASET.html" -n biota "$DATASET.mytaxa.krona,$DATASET"

# Gzip and cleanup
[[ -e "../../../06.cds/$DATASET.gff2" ]] \
&& gzip -9 -f "../../../06.cds/$DATASET.gff2"
[[ -e "../../../06.cds/$DATASET.gff3" ]] \
&& gzip -9 -f "../../../06.cds/$DATASET.gff3"
gzip -9 -f "$DATASET.mytaxain"
gzip -9 -f "$DATASET.blast"
for i in "../../../06.cds/$DATASET.gff2" "../../../06.cds/$DATASET.gff3" \
"$DATASET.mytaxain" "$DATASET.blast" ; do
[[ -e $i ]] && gzip -9f $i
done
rm "$DATASET.daa"
fi

Expand Down
7 changes: 3 additions & 4 deletions scripts/mytaxa_scan.bash
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ else
awk "NR==$win" "$DATASET.wintax.genes" | tr "\\t" "\\n" \
> "$DATASET.reg/$i.ids"
if [[ "$FAA" == *.gz ]] ; then
gzip -c -d "$FAA" \
gzip -cd "$FAA" \
| FastA.filter.pl -q "$DATASET.reg/$i.ids" /dev/stdin \
> "$DATASET.reg/$i.faa"
else
Expand All @@ -81,8 +81,7 @@ else
fi
done
# Archive regions
tar -cf "$DATASET.reg.tar" "$DATASET.reg"
gzip -9 "$DATASET.reg.tar"
tar -c "$DATASET.reg" | gzip -9c > "$DATASET.reg.tar.gz"
rm -r "$DATASET.reg"
fi

Expand All @@ -91,7 +90,7 @@ else
[[ -e "$DATASET.$x" ]] && rm "$DATASET.$x"
done
[[ -s "$DATASET.mytaxa" && ! -s "$DATASET.mytaxa.gz" ]] \
&& gzip -9 -f "$DATASET.mytaxa"
&& gzip -9f "$DATASET.mytaxa"
fi

fi
Expand Down
2 changes: 1 addition & 1 deletion scripts/ssu.bash
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if [[ -s $fa ]] ; then

# Gzip
for x in gff ssu.all.fa rdp.tsv trna.txt ; do
[[ -e "${DATASET}.${x}" ]] && gzip -9 -f "${DATASET}.${x}"
[[ -e "${DATASET}.${x}" ]] && gzip -9f "${DATASET}.${x}"
done
fi

Expand Down
3 changes: 2 additions & 1 deletion scripts/trimmed_reads.bash
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ FastQ.tag.rb -i "$in1" -p "$b-" -s "/1" -o "$b.1.fastq.gz"
[[ -e "$in2" ]] && FastQ.tag.rb -i "$in2" -p "$b-" -s "/2" -o "$b.2.fastq.gz"

# Multitrim
CMD="multitrim.py --zip gzip --level 9 --threads $CORES -o $b"
CMD="multitrim.py --level 9 --threads $CORES -o $b"
which -s pigz && CMD="$CMD --zip pigz"
if [[ -s "$b.2.fastq.gz" ]] ; then
# Paired
$CMD -1 "$b.1.fastq.gz" -2 "$b.2.fastq.gz"
Expand Down

0 comments on commit cbaae60

Please sign in to comment.