Skip to content

Commit

Permalink
address #25
Browse files Browse the repository at this point in the history
  • Loading branch information
lucidrains committed Apr 5, 2023
1 parent c35e742 commit e3aeba1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions enformer_pytorch/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,19 @@ def __call__(self, chr_name, start, end, return_augs = False):

seq = ('.' * left_padding) + str(chromosome[start:end]) + ('.' * right_padding)

should_rc_aug = self.rc_aug and coin_flip()

if self.return_seq_indices:
if self.rc_aug and coin_flip():
seq = str_to_seq_indices(seq)

if should_rc_aug:
seq = seq_indices_reverse_complement(seq)

return str_to_seq_indices(seq)
return seq

one_hot = str_to_one_hot(seq)

rc_aug = self.rc_aug and coin_flip()

if rc_aug:
if should_rc_aug:
one_hot = one_hot_reverse_complement(one_hot)

if not return_augs:
Expand All @@ -164,7 +166,7 @@ def __call__(self, chr_name, start, end, return_augs = False):
# for this particular genomic sequence

rand_shift_tensor = torch.tensor([rand_shift])
rand_aug_bool_tensor = torch.tensor([rc_aug])
rand_aug_bool_tensor = torch.tensor([should_rc_aug])

return one_hot, rand_shift_tensor, rand_aug_bool_tensor

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name = 'enformer-pytorch',
packages = find_packages(exclude=[]),
include_package_data = True,
version = '0.7.1',
version = '0.7.3',
license='MIT',
description = 'Enformer - Pytorch',
author = 'Phil Wang',
Expand Down

0 comments on commit e3aeba1

Please sign in to comment.