The invention discloses
a DNA sequence reconstruction method and
system based on multi-scale attention and contrast learning, and relates to the technical field of
DNA storage
data reconstruction. Comprising the following steps: collecting a plurality of
DNA sequence copies, screening out abnormal length sequences, and constructing a standardized clustering
data set; performing one-hot coding and filling
processing on the
DNA sequence; extracting context dependent features and cross-
sequence variation features; an Inter-Sequence multi-head attention mechanism is constructed to calculate the similarity between the sequences, and a weighted sequence
tensor is generated; a global dependency relationship in the sequence is extracted through an Intra-Sequence multi-head attention mechanism; local offset features caused by
insertion and deletion errors are extracted through a multi-size convolutional network; inputting a double-layer long-short-
term memory network for sequence-level modeling, and outputting base reconstruction probability distribution; and constructing positive and
negative sample pairs, calculating comparison loss, combining
cross entropy loss to form a joint
loss function, and outputting a high-precision DNA
sequence reconstruction result. The method has high accuracy and robustness under the conditions of complex
noise and multiple types of errors.