I would like to apply a 1D convolution on fixed size DNA sequence using keras.
Dna sequence is 45 bases long. Each sequence has been one-hot encoded. There is one filter with kernel size = 3. See picture below :
I have 1000 sequences for my training.
The shape of x_train is then : (1000, 45, 4).
The target is True/False with shape : (1000,)
I tried to use keras like this :
K.clear_session()
model = Sequential()
#add model layers
model.add(Conv1D(1, kernel_size=1, activation="relu", input_shape =(1000,45)))
#model.add(Flatten())
#model.add(Dense(2, activation="softmax"))
model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
model.fit(x_train, y_train, epochs=10)
But I get the following error :
ValueError: Error when checking input: expected conv1d_1_input to have shape (1000, 45) but got array with shape (45, 4)