# tfio.genome.sequences_to_onehot

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/io/blob/v0.24.0/tensorflow_io/python/ops/genome_ops.py#L57-L96) |

Convert DNA sequences into a one hot nucleotide encoding.

    @tf.function
    tfio.genome.sequences_to_onehot(
        sequences
    )

### Used in the notebooks

| Used in the tutorials |
|---|
| - [](https://www.tensorflow.org/io/tutorials/genome) |

Each nucleotide in each sequence is mapped as follows:
A -\> \[1, 0, 0, 0\]
C -\> \[0, 1, 0, 0\]
G -\> \[0 ,0 ,1, 0\]
T -\> \[0, 0, 0, 1\]

If for some reason a non (A, T, C, G) character exists in the string, it is
currently mapped to a error one hot encoding \[1, 1, 1, 1\].

<br />

<br />

<br />

| ## Args ||
|---|---|
| `sequences` | A tf.string tensor where each string represents a DNA sequence |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| [`tf.RaggedTensor`](https://www.tensorflow.org/api_docs/python/tf/RaggedTensor) | The output sequences with nucleotides one hot encoded. |

<br />