Add scripts for phylogenetic analysis using MrBayes and RAxML

- Created `mbblock.txt` for MrBayes configuration.
- Implemented `mrbayes.sh` to convert FASTA to Nexus and run MrBayes.
- Developed `raxml.sh` to run modeltest-ng and raxml-ng on alignments.
- Added `04.filter_ogs.sh` to filter orthologous groups based on taxon count and sequence length.
- Implemented `01.run_mrbayes.sh` to execute MrBayes for multiple FASTA files.
- Created `02.mbsum.sh` to summarize MrBayes output while skipping high DSF analyses.
- Developed `03.run_raxml.sh` to run raxml-ng on filtered alignments.
This commit is contained in:
2025-12-20 23:33:05 +08:00
parent dba4833905
commit e467d67723
16 changed files with 353 additions and 1265 deletions
+1503
View File
File diff suppressed because it is too large Load Diff
+12
View File
@@ -0,0 +1,12 @@
begin mrbayes;
set nowarnings=yes;
set usebeagle=yes;
set autoclose=yes;
set seed=12345;
set swapseed=12345;
lset nst=6 rates=gamma;
mcmcp ngen=2000000 burninfrac=.25 samplefreq=1000 printfreq=10000 checkpoint=no
diagnfreq=10000 nruns=3 nchains=3 temp=0.40 swapfreq=10 stoprule=no;
mcmc;
sumt;
end;
+20
View File
@@ -0,0 +1,20 @@
#! /bin/bash
set -e
SCRIPTS=${SCRIPTS:-"$PROJECTHOME/99.scripts"}
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input_fasta> <output_nexus>"
exit 1
fi
in_fasta=$(readlink -f "$1")
out_nex=$2
# Convert fasta to nexus
out_dir=$(dirname "$out_nex")
mkdir -p "$out_dir"
seqmagick convert --output-format nexus --alphabet dna --input-format fasta "$in_fasta" "$out_nex"
# append MrBayes block to nexus file
cat "$SCRIPTS"/miscs/mbblock.txt >>"$out_nex"
# Run MrBayes
mb "$out_nex" >"${out_dir}"/mrbayes.log 2>&1
+20
View File
@@ -0,0 +1,20 @@
#! /bin/bash
set -e
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <alignment.fa> <output_prefix> <threads> <outgroup>"
echo "Run modeltest-ng and raxml-ng on a given alignment"
exit 1
fi
aln=$(readlink -f "$1")
out=$2
threads=$3
outgroup=$4
outdir=$(dirname "$out")
mkdir -p "$outdir"
# run modeltest-ng
modeltest-ng -p "$threads" -r 12345 --force -i "$aln" -d nt -t ml -o "$out".modeltest
# run raxml-ng
cmd=$(grep "raxml-ng" "$out".modeltest.out | tail -n 1 | sed 's/> //')
params="--all --bs-trees 1000 --outgroup $outgroup --redo --threads $threads --seed 12345 --prefix $out"
bash -c "$cmd $params" >/dev/null