| 66 | |
| 67 | |
| 68 | def get_optimal_window(mutation_position_relative, seq_len_wo_special, model_window): |
| 69 | half_model_window = model_window // 2 |
| 70 | if seq_len_wo_special <= model_window: |
| 71 | return [0,seq_len_wo_special] |
| 72 | elif mutation_position_relative < half_model_window: |
| 73 | return [0,model_window] |
| 74 | elif mutation_position_relative >= seq_len_wo_special - half_model_window: |
| 75 | return [seq_len_wo_special - model_window, seq_len_wo_special] |
| 76 | else: |
| 77 | return [max(0,mutation_position_relative-half_model_window), min(seq_len_wo_special,mutation_position_relative+half_model_window)] |
| 78 | |
| 79 | |
| 80 | def predict(cfg, task, dataset): |