aertslab / CREsted

Other
26 stars 1 forks source link

Add support for decoding one hot encoded sequence back to a DNA seque… #4

Closed ghuls closed 4 months ago

ghuls commented 4 months ago

…nce.

Add support for decoding one hot encoded sequence back to a DNA sequence.

import numpy as np
from crested.tl._utils import one_hot_encode_sequence

one_hot_encoded_sequence = np.array([
   [1., 0., 0., 0.],
   [1., 0., 0., 0.],
   [0., 1., 0., 0.],
   [0., 0., 1., 0.],
   [0., 0., 0., 1.],
   [0., 0., 0., 1.],
   [1., 0., 0., 0.],
   [0., 0., 1., 0.],
   [0., 1., 0., 0.]],
   dtype=float32
)

hot_encoding_to_sequence(one_hot_encoded_sequence)) == "AACGTTAGC"