Add MCMCtree workflow and SNaQ analysis scripts
- Updated `pixi.toml` to include new R package dependencies for MCMCtree workflow. - Modified markdown file to remove unnecessary simulation data discussion. - Introduced `.lintr` configuration for linting R scripts. - Created `mcmctree.ctl` control file for MCMCtree analysis. - Developed `mcmctree_workflow.r` script to orchestrate MCMCtree analysis with model testing and ESS checks. - Added `06.snaq.jl` script for SNaQ analysis with plotting capabilities. - Implemented `07.mcmctree.sh` bash script to run MCMCtree on multiple alignments in parallel.
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "Usage: $0 <input_fasta_dir> <extension> <output_nexus_dir>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_dir=$1
|
||||
extension=$2
|
||||
output_dir=$3
|
||||
mkdir -p "${output_dir}"
|
||||
for f in "${input_dir}"/*."${extension}"; do
|
||||
filename=$(basename -- "${f}")
|
||||
filename_noext="${filename%.*}"
|
||||
output_file="${output_dir}/${filename_noext}.nex"
|
||||
echo "Converting ${f} to ${output_file}"
|
||||
seqmagick convert --output-format nexus --alphabet dna --input-format fasta "${f}" "${output_file}"
|
||||
done
|
||||
+4
-4
@@ -104,10 +104,10 @@ R"dev.off"();
|
||||
|
||||
## expected vs. observed quartet concordance factors
|
||||
using CSV, DataFrames, Distributions, Random, RCall;
|
||||
inputCFfile = joinpath("bucky_1.CFs.csv");
|
||||
inputCFfile = joinpath("..","bucky","bucky_1","input.mb.CFs.csv");
|
||||
inputCF = readtableCF(inputCFfile);
|
||||
net3 = readsnaqnetwork("net3.out");
|
||||
topologymaxQpseudolik!(net3, inputCF);
|
||||
net4 = readsnaqnetwork("net4.out");
|
||||
topologymaxQpseudolik!(net4, inputCF);
|
||||
df_long = fittedquartetCF(inputCF, :long);
|
||||
|
||||
### Adding jitter to the points for better visualization
|
||||
@@ -127,6 +127,6 @@ R"dev.off"();
|
||||
|
||||
# Goodness of fit of the SNaQ networks
|
||||
using QuartetNetworkGoodnessFit;
|
||||
res1 = quarnetGoFtest!(net3, inputCF, true; seed=123, nsim=1000);
|
||||
res1 = quarnetGoFtest!(net4, inputCF, true; seed=123, nsim=1000);
|
||||
res1[[1,2,3]] # p-value, uncorrected z, σ
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
SCRIPTS=${SCRIPTS:-"$PROJECTHOME/99.scripts"}
|
||||
THREADS=${THREADS:-16}
|
||||
|
||||
if [ "$#" -ne 4 ]; then
|
||||
echo "Usage: $0 <aln_dir> <ml_dir> <out_dir> <alignment_ext>"
|
||||
echo "Run MCMCtree on orthogroup alignments with corresponding ML trees"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aln_dir=$1
|
||||
ml_dir=$2
|
||||
out_dir=$3
|
||||
ext=$4
|
||||
mkdir -p "$out_dir"
|
||||
echo -n >mcmctree.cmds
|
||||
ctlfile=$(readlink -f "$SCRIPTS/miscs/mcmctree.ctl")
|
||||
for i in "$aln_dir"/*."$ext"; do
|
||||
j=$(basename "$i" ."$ext")
|
||||
aln=$(readlink -f "$i")
|
||||
ml_tree=$(readlink -f "$ml_dir/${j}/${j}.raxml.bestTree")
|
||||
mkdir -p "${out_dir}/${j}"
|
||||
cmd="cd ${out_dir}/${j} && Rscript $SCRIPTS/miscs/mcmctree_workflow.r"
|
||||
params="-a $aln -t $ml_tree -c ${ctlfile} -p ${j}"
|
||||
echo "$cmd $params > mcmctree.log 2>&1" >>mcmctree.cmds
|
||||
done
|
||||
xargs -t -P "$THREADS" -I cmd -a mcmctree.cmds bash -c "cmd"
|
||||
echo "MCMCtree all completed."
|
||||
Reference in New Issue
Block a user