File size: 2,029 Bytes
7718235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# $1 is the name of the scripts folder
# $2 is the name of output folder
# $3 is the gpu ids that used for training, seperated by comma
CUDA_VISIBLE_DEVICES=$3
echo "CUDA_VISIBLE_DEVICES="$CUDA_VISIBLE_DEVICES
for fold in {0..4}
do
    for task in $(cat scripts/gene.txt) $(cat scripts/gene.itan.txt) $(cat scripts/gene.large.window.txt) $(cat scripts/gene.pfams.txt); do
    echo "Begin "$task" fold "$fold 
    mkdir $2/$task
    # check if task has finished, unless the skip argument is present
    logdir=$(cat $1/$task.5fold/$task.fold.$fold.yaml | grep log_dir | sed 's/.*: //')
    num_epochs=$(cat $1/$task.5fold/$task.fold.$fold.yaml | grep num_epochs | sed 's/.*: //')
    data_file_test=$(cat $1/$task.5fold/$task.fold.$fold.yaml | grep data_file_test: | sed 's/.*: //')
    data_file_train=$(cat $1/$task.5fold/$task.fold.$fold.yaml | grep data_file_train: | sed 's/.*: //')
    if [ -f $logdir/FOLD.0/model.epoch.$num_epochs.pt ] && [ -f $logdir/FOLD.1/model.epoch.$num_epochs.pt ] && [ -f $logdir/FOLD.2/model.epoch.$num_epochs.pt ] && [ -f $logdir/FOLD.3/model.epoch.$num_epochs.pt ]; then
      echo "Begin "$task" fold "$fold
      mkdir $2/$task
      if [ ! -f $2/$task/testing.fold.$fold.4fold.csv ]; then
        python -W ignore::UserWarning:torch_geometric.data.collate:147 train.py \
            --conf $1/$task.5fold/$task.fold.$fold.yaml \
      	    --data-file-test $data_file_test \
            --mode interpret_4_fold --interpret-by both --out-dir $2/$task/testing.fold.$fold.4fold.csv
      fi
      if [ ! -f $2/$task/training.fold.$fold.4fold.csv ] && [[ ! $(cat scripts/gene.pfams.txt) == *"$task"* ]]; then
        python -W ignore::UserWarning:torch_geometric.data.collate:147 train.py \
            --conf $1/$task.5fold/$task.fold.$fold.yaml \
            --data-file-test $data_file_train \
            --mode interpret_4_fold --interpret-by both --out-dir $2/$task/training.fold.$fold.4fold.csv
      fi
    else
      echo $task" fold "$fold" not finished"
    fi
  done
done