我想准备几个.sh文件来运行一些模拟。
假设我想运行多次的命令是:
node_list = "Positive,Negative"
for nodes in $node_list; do
python3.7 path_to_script/the_script -m "file_mutation1.csv" -r "results_mutation1.csv"
done
其中
- _script是要运行的脚本
- -m是用于运行模拟的文件
- -r文件以保存结果
我有一个变种列表,所以我想创建一个循环,给予mutant_list = [TP53, NFKB, ABL1]
for nodes in $node_list; do
python3.7 path_to_script/the_script -m "file_mutation_TP53.csv" -r "results_mutation_TP53.csv"
done
for nodes in $node_list; do
python3.7 path_to_script/the_script -m "file_mutation_NFKB.csv" -r "results_mutation_NFKB.csv"
done
for nodes in $node_list; do
python3.7 path_to_script/the_script -m "file_mutation_ABL1.csv" -r "results_mutation_ABL1.csv"
done
等等。
然而,由于我有100个突变体,我想为每5个突变体创建一个单独的.sh文件。
预期输出为run_sim_1.sh
包含(为清楚起见,省略for nodes in $node_list; do / done
)
python3.7 path_to_script/the_script -m "file_mutation1.csv" -r "results_mutation1.csv"
python3.7 path_to_script/the_script -m "file_mutation2.csv" -r "results_mutation2.csv"
python3.7 path_to_script/the_script -m "file_mutation3.csv" -r "results_mutation3.csv"
python3.7 path_to_script/the_script -m "file_mutation4.csv" -r "results_mutation4.csv"
python3.7 path_to_script/the_script -m "file_mutation5.csv" -r "results_mutation5.csv"
run_sim_2.sh
,其中包含
python3.7 path_to_script/the_script -m "file_mutation6.csv" -r "results_mutation6.csv"
python3.7 path_to_script/the_script -m "file_mutation7.csv" -r "results_mutation7.csv"
python3.7 path_to_script/the_script -m "file_mutation8.csv" -r "results_mutation8.csv"
python3.7 path_to_script/the_script -m "file_mutation9.csv" -r "results_mutation9.csv"
python3.7 path_to_script/the_script -m "file_mutation10.csv" -r "results_mutation10.csv"
1条答案
按热度按时间8qgya5xd1#
您可以使用以下脚本:
counter
:计算for
循环中已处理的节点数。shcounter
:会计算已建立的.sh档案数目。运行这个脚本会创建3个文件。run_sim1.sh(节点1-〉5),runsim2.sh(节点6-〉10),runsim3.sh(节点11)。我想要一个不能被5整除的文件来显示我的算法可以处理它。