Skip to content

Commit f94d96c

Browse files
committed
print a warning with random mutation augmentation
1 parent 7044766 commit f94d96c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/grelu/data/augment.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
The augmented output will be in the same format.
55
"""
66

7+
import warnings
78
from typing import List, Optional, Tuple, Union
89

910
import numpy as np
@@ -129,6 +130,13 @@ def __init__(
129130
self.shift_label = self.max_pair_shift > 0
130131
self.shift_seq = (self.max_seq_shift > 0) or (self.shift_label)
131132
self.mutate = (self.n_mutated_seqs > 0) and (self.n_mutated_bases > 0)
133+
if self.mutate:
134+
warnings.warn(
135+
"Augmentation by introducing random mutations should be used with caution, "
136+
+ "as it may result in models being insensitive to functional variation. This is an experimental "
137+
+ "feature and the recommended usage is to perform a subsequent round of fine-tuning without "
138+
+ "this augmentation (https://genomebiology.biomedcentral.com/articles/10.1186/s13059-023-02941-w)."
139+
)
132140

133141
# Create settings
134142
self.max_values = _get_multipliers(
@@ -152,7 +160,7 @@ def __len__(self) -> int:
152160
The total number of augmented sequences that can be produced from a single
153161
DNA sequence
154162
"""
155-
return 1 if self.mode == "random" else np.product(self.max_values)
163+
return 1 if self.mode == "random" else np.prod(self.max_values)
156164

157165
def _split(self, idx: int) -> List[tuple]:
158166
"""

0 commit comments

Comments
 (0)