系统发育树的循环
For loop for phylogenetic trees
我正在使用名为 RAxML 的系统发育软件,我想为每个 phylip 文件构建单个树。对于包含三个 phylip 文件的目录,我做了以下操作
##files in directory
Ortho1.phy Ortho6.Phy Ortho6.Phy
for f in /home/Single_trees/trimmed_alignment/*.phy; do raxmlHPC -f a -x 100 -m PROTGAMMAAUTO -p 100 -s $f -N 100 -n $f.tree; done;
但这总是给我一个错误,说 $ symbol is not allowed.
raxmlHPC: axml.c:5236: analyzeRunId: Assertion `0' failed.
错误字符/运行 ID 中不允许
有更好的方法吗?我尝试使用此 link 此处 https://rc.fas.harvard.edu/resources/documentation/submitting-large-numbers-of-jobs-to-odyssey/ 为非顺序命名文件使用作业数组,但无法实现它。
这是我尝试提交数组作业的方式:
#!/bin/bash -l
#
# raxml.sbatch
#
#SBATCH -J consensus # A single job name for the array
#SBATCH -p high # best partition for single core small jobs
#SBATCH -n 12 # one core
#SBATCH -N 1 # on one node
#SBATCH -t 100:00:00 # Running time of 2 hours
#SBATCH --mem 18000 # Memory request of 4 GB
#SBATCH -o raxml_%A_%a.out # Standard output
#SBATCH -e raxml_%A_%a.err # Standard error
module load raxml
for FILES in /home/aligned_fasta/.phy; do
echo ${FILES}
done;
# grab out filename from the array exported from our 'parent' shell
FILENAME=${FILES[$SLURM_ARRAY_TASK_ID]}
# make & move into new directory, and run!
mkdir ${FILENAME}_out
cd ${FILENAME}_out
raxmlHPC -f a -x 100 -m PROTGAMMAAUTO -p 100 -s $FILENAME -N 100 -n $FILENAME.tree
#Now, we grab all the appropriate files and submit them en-batch with an array:
# grab the files, and export it so the 'child' sbatch jobs can access it
导出文件=($(ls -1 .phy))
# get size of array
NUMPHY=${#FILES[@]}
# now subtract 1 as we have to use zero-based indexing (first cell is 0)
ZBNUMPHY=$(($NUMPHY - 1))
# now submit to SLURM
if [ $ZBNUMPHY -ge 0 ]; then
sbatch --array=0-$ZBNUMPHY raxml.sbatch
fi
我使用 sbatch --array=0-10 raxml.sh 提交,但没有成功。
刚刚想通了一些东西。基本上,我会重命名文件,使它们连续,我可以只使用 slurm。
ls *.phy | cat -n | while read num file; do mv $file ${file/./.$num.}; done
因此文件将是
Ortho1.1.phy Ortho6.2.Phy Ortho6.3.Phy
那么您可以通过以下方式进行:
#!/bin/bash -l
# SBATCH -J tree
###### Standard out and Standard Error output files with the job number in the name.
#SBATCH -o tre_%A.%a.out
#SBATCH -e tre_%A.%a.err
###### number of nodes
###SBATCH --nodes=6
###SBATCH --nodes=6
###### number of processors
#SBATCH -n 16
###SBATCH --cpus-per-task=4
###### Spread the tasks evenly among the nodes
####BATCH --ntasks-per-node=8
###### coupled with array
####SBATCH --ntasks=1-179
#SBATCH --time=300:00:00
#SBATCH -p high
#SBATCH --mem 24000
###### Want the node exclusively
### SBATCH --exclusive
#SBATCH --array=1-3
module load raxml
for i in $SLURM_ARRAY_TASK_ID.phy
do
echo $i
done
### tree
raxmlHPC-PTHREADS -f a -x 100 -m PROTGAMMAAUTO -p 100 -T 16 -s $i -N 100 -n $i.tree
这将为您提供单独的树,您可以使用这些树来构建共识树。
我认为您可能正在引导并获得共识系统发育,在这种情况下,RAxML 中有一个特殊情况可以执行此操作。当我有时间的时候,我会post在这里。
我正在使用名为 RAxML 的系统发育软件,我想为每个 phylip 文件构建单个树。对于包含三个 phylip 文件的目录,我做了以下操作
##files in directory
Ortho1.phy Ortho6.Phy Ortho6.Phy
for f in /home/Single_trees/trimmed_alignment/*.phy; do raxmlHPC -f a -x 100 -m PROTGAMMAAUTO -p 100 -s $f -N 100 -n $f.tree; done;
但这总是给我一个错误,说 $ symbol is not allowed.
raxmlHPC: axml.c:5236: analyzeRunId: Assertion `0' failed.
错误字符/运行 ID 中不允许
有更好的方法吗?我尝试使用此 link 此处 https://rc.fas.harvard.edu/resources/documentation/submitting-large-numbers-of-jobs-to-odyssey/ 为非顺序命名文件使用作业数组,但无法实现它。
这是我尝试提交数组作业的方式:
#!/bin/bash -l
#
# raxml.sbatch
#
#SBATCH -J consensus # A single job name for the array
#SBATCH -p high # best partition for single core small jobs
#SBATCH -n 12 # one core
#SBATCH -N 1 # on one node
#SBATCH -t 100:00:00 # Running time of 2 hours
#SBATCH --mem 18000 # Memory request of 4 GB
#SBATCH -o raxml_%A_%a.out # Standard output
#SBATCH -e raxml_%A_%a.err # Standard error
module load raxml
for FILES in /home/aligned_fasta/.phy; do
echo ${FILES}
done;
# grab out filename from the array exported from our 'parent' shell
FILENAME=${FILES[$SLURM_ARRAY_TASK_ID]}
# make & move into new directory, and run!
mkdir ${FILENAME}_out
cd ${FILENAME}_out
raxmlHPC -f a -x 100 -m PROTGAMMAAUTO -p 100 -s $FILENAME -N 100 -n $FILENAME.tree
#Now, we grab all the appropriate files and submit them en-batch with an array:
# grab the files, and export it so the 'child' sbatch jobs can access it
导出文件=($(ls -1 .phy))
# get size of array
NUMPHY=${#FILES[@]}
# now subtract 1 as we have to use zero-based indexing (first cell is 0)
ZBNUMPHY=$(($NUMPHY - 1))
# now submit to SLURM
if [ $ZBNUMPHY -ge 0 ]; then
sbatch --array=0-$ZBNUMPHY raxml.sbatch
fi
我使用 sbatch --array=0-10 raxml.sh 提交,但没有成功。
刚刚想通了一些东西。基本上,我会重命名文件,使它们连续,我可以只使用 slurm。
ls *.phy | cat -n | while read num file; do mv $file ${file/./.$num.}; done
因此文件将是
Ortho1.1.phy Ortho6.2.Phy Ortho6.3.Phy
那么您可以通过以下方式进行:
#!/bin/bash -l
# SBATCH -J tree
###### Standard out and Standard Error output files with the job number in the name.
#SBATCH -o tre_%A.%a.out
#SBATCH -e tre_%A.%a.err
###### number of nodes
###SBATCH --nodes=6
###SBATCH --nodes=6
###### number of processors
#SBATCH -n 16
###SBATCH --cpus-per-task=4
###### Spread the tasks evenly among the nodes
####BATCH --ntasks-per-node=8
###### coupled with array
####SBATCH --ntasks=1-179
#SBATCH --time=300:00:00
#SBATCH -p high
#SBATCH --mem 24000
###### Want the node exclusively
### SBATCH --exclusive
#SBATCH --array=1-3
module load raxml
for i in $SLURM_ARRAY_TASK_ID.phy
do
echo $i
done
### tree
raxmlHPC-PTHREADS -f a -x 100 -m PROTGAMMAAUTO -p 100 -T 16 -s $i -N 100 -n $i.tree
这将为您提供单独的树,您可以使用这些树来构建共识树。
我认为您可能正在引导并获得共识系统发育,在这种情况下,RAxML 中有一个特殊情况可以执行此操作。当我有时间的时候,我会post在这里。