Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
ANALYSIS OF NANOPORE SIGNAL USING A MACHINE-LEARNING TECHNIQUE
Document Type and Number:
WIPO Patent Application WO/2020/109773
Kind Code:
A1
Abstract:
A signal derived from a polymer comprising a series of polymer units during translocation of the polymer with respect to a nanopore is analysed using a machine learning technique. A series of weight distributions is output, each comprising weights in respect of transitions between labels over a set of labels representing the possible types of polymer unit in the polymer. An estimate of the series of polymer units from the weight distributions. Use of weights in respect of the transitions increases the accuracy of the technique.

Inventors:
MASSINGHAM TIMOTHY LEE (GB)
Application Number:
PCT/GB2019/053334
Publication Date:
June 04, 2020
Filing Date:
November 26, 2019
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
OXFORD NANOPORE TECH LTD (GB)
International Classes:
C12Q1/6869; G01N33/487
Domestic Patent References:
WO2013041878A12013-03-28
WO2015173587A12015-11-19
WO2013153359A12013-10-17
WO2012107778A22012-08-16
WO2016034591A22016-03-10
WO2010109197A22010-09-30
WO2015140535A12015-09-24
WO2014064444A12014-05-01
WO2012005857A12012-01-12
WO2014064443A22014-05-01
WO2016181118A12016-11-17
WO2009035647A12009-03-19
WO2011046706A12011-04-21
WO2012138357A12012-10-11
WO2016187519A12016-11-24
WO2005124888A12005-12-29
WO2000079257A12000-12-28
WO2000028312A12000-05-18
WO2009077734A22009-06-25
WO2011067559A12011-06-09
WO2010086603A12010-08-05
WO2012033524A22012-03-15
WO2010086622A12010-08-05
WO2013014451A12013-01-31
WO2008102210A22008-08-28
WO2009007734A12009-01-15
WO2010122293A12010-10-28
WO2014004443A12014-01-03
Foreign References:
GB2019052456W2019-09-04
Other References:
LANDRY MATTHEW ET AL: "Analysis of nanopore detector measurements using Machine-Learning methods, with application to single-molecule kinetic analysis", BMC BIOINFORMATICS, BIOMED CENTRAL, LONDON, GB, vol. 8, no. Suppl 7, 1 November 2007 (2007-11-01), pages S12, XP021027669, ISSN: 1471-2105, DOI: 10.1186/1471-2105-8-S7-S12
VLADIMÍR BOZA ET AL: "DeepNano: Deep recurrent neural networks for base calling in MinION nanopore reads", PLOS ONE, vol. 12, no. 6, 5 June 2017 (2017-06-05), pages e0178751, XP055669713, DOI: 10.1371/journal.pone.0178751
MARCUS STOIBER ET AL: "BasecRAWller: Streaming Nanopore Basecalling Directly from Raw Signal", BIORXIV, 1 May 2017 (2017-05-01), XP055472754, Retrieved from the Internet DOI: 10.1101/133058
YU LI ET AL: "DeepSimulator: a deep simulator for Nanopore sequencing", BIOINFORMATICS., vol. 34, no. 17, 6 April 2018 (2018-04-06), GB, pages 2899 - 2908, XP055563771, ISSN: 1367-4803, DOI: 10.1093/bioinformatics/bty223
TENG ET AL.: "Chiron: Translating nanopore raw signal directly into nucleotide sequence using deep learning", GIGASCIENCE, 1 May 2018 (2018-05-01)
STODDART D ET AL., PROC NATL ACAD SCI, vol. 105, no. 52, 2008, pages 20647 - 52
STODDART D ET AL., ANGEW CHEM INT ED ENGL., vol. 49, no. 3, 2010, pages 556 - 9
STODDART D ET AL., NANO LETT., vol. 10, no. 9, 8 September 2010 (2010-09-08), pages 3633 - 7
GONZALEZ-PEREZ ET AL., LANGMUIR, vol. 25, 2009, pages 10447 - 10450
IVANOV AP ET AL., NANO LETT., vol. 11, no. 1, 12 January 2011 (2011-01-12), pages 279 - 85
LIEBERMAN KR ET AL., J AM CHEM SOC., vol. 132, no. 50, 2010, pages 17961 - 72
LUAN B ET AL., PHYS REV LETT., vol. 104, no. 23, 2010, pages 238103
J. AM. CHEM. SOC., vol. 131, 2009, pages 1652 - 1653
SONI GV ET AL., REV SCI INSTRUM., vol. 81, no. 1, January 2010 (2010-01-01), pages 014301
HOCHREITERSCHMIDHUBER, LONG SHORT-TERM MEMORY, NEURAL COMPUTATION, vol. 9, no. 8, 1997, pages 1735 - 1780
MCCALLUM ET AL., MAXIMUM ENTROPY MARKOV MODELS FOR INFORMATION EXTRACTION AND SEGMENTATION, PROCEEDINGS OF ICML, 2000, pages 591 - 598
GRAVES ET AL.: "Proceedings of the 23rd international conference on Machine learning", 2006, ACM, article "Connectionist temporal classification labelling unsegmented sequence data with recurrent neural networks", pages: 369 - 376
Attorney, Agent or Firm:
J A KEMP LLP (GB)
Download PDF:
Claims:
Claims

1. A method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the method comprising:

analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distribution comprising weights in respect of transitions between labels over a set of labels, including labels representing the possible types of polymer unit; and

deriving an estimate of the series of polymer units from the weight distributions.

2. A method according to claim 1, wherein at least one transition between labels is not allowed and other transitions are allowed, the weight distributions each comprising weights in respect of transitions that are allowed.

3. A method according to claim 2, wherein the weight distributions each comprise null weights in respect of transitions that are not allowed.

4. A method according to claim 2 or 3, wherein the step of deriving an estimate of the series of polymer units takes into account a transition matrix representing whether transitions between labels are allowed or not allowed.

5. A method according to any one of claims 2 to 4, wherein

the set of labels include a first and a second label in respect of each type of polymer unit, the first label representing the start of an instance of the type of polymer unit, and the second label representing a stay in the instance of the type of polymer unit, wherein

transitions from each first label to the first label for any other type of polymer unit are allowed,

transitions from each first label to the first label for the same type of polymer unit are allowed,

transitions from each first label to the second label for the same type of polymer unit are allowed,

transitions from each first label to the second label for any other type of polymer unit are not allowed,

transitions from each second label to the first label for the same type of polymer unit or the first label for any other type of polymer unit are allowed, and

transitions from each second label to the second label for the same type of polymer unit are allowed, and

transitions from each second label to the second label for any other type of polymer unit are not allowed.

6. A method according to any one of claims 2 to 5, wherein the set of possible types of polymer unit includes a type of polymer unit that always appears in a known sequence of polymer units, transitions in accordance with the known sequence being allowed and transitions contrary to the known sequence being not allowed.

7. A method according to any one of the preceding claims, wherein consecutive instances of polymer units of the same type in the series of polymer units are represented in an encoded form.

8. A method according to claim 7, wherein the labels include plural labels in respect of each type of polymer unit, wherein the plural labels in respect of each type of polymer unit represent consecutive instances of the type of polymer unit in the series of polymer units.

9. A method according to claim 8, wherein the plural labels for each type of polymer unit have a predetermined cyclical order, whereby some transitions between labels are allowed by the predetermined cyclical order and other transitions between are not allowed by the predetermined cyclical order, the weight distributions each including weights in respect of transitions that are allowed by the predetermined cyclical order.

10. A method according to claim 8 or 9, wherein the plural labels for each type of polymer unit are two labels for each type of polymer unit.

11. A method according to claim 7, wherein consecutive instances of the same type of polymer unit in the series of polymer units are represented in a run-length encoded form.

12. A method according to claim 11, wherein the labels include plural labels in respect of different run-lengths of each type of polymer unit.

13. A method according to claim 11, wherein

the labels include a label in respect of each type of polymer unit, and

the weight distributions comprise further weights over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

14. A method according to claim 13, wherein the further weights comprise a categorical distribution of weights over a set of possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

15. A method according to claim 13, wherein the further weights comprise parameters of a parameterised distribution over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

16. A method according to any one of claims 13 to 15, wherein the weight distributions comprise further weights over possible lengths of consecutive instances of the same type of polymer unit (a) for possible pairs of the type of the given polymer unit and the type of the preceding polymer unit, (b) for possible pairs of the type of the given polymer unit and the type of the following polymer unit, or (c) for possible triplets of the type of the given polymer unit, the type of the preceding polymer unit, and the type of the following polymer unit.

17. A method according to any one of the preceding claims, wherein the possible types of polymer unit include a type of polymer unit that has unmodified and modified forms.

18. A method according to claim 17, wherein the set of labels include a label in respect of the type of polymer unit that has unmodified and modified forms.

19. A method according to claim 18, wherein each weight distribution comprises further weights for the unmodified and modified forms of each of the type of polymer unit that has the unmodified and modified forms.

20. A method according to any one of the preceding claims, wherein the set of labels includes at least one label representing each type of polymer unit.

21. A method according to any one of the preceding claims, wherein the set of labels further include at least one label representing a blank and/or a stay in the series of polymer units.

22. A method according to any one of the preceding claims, wherein the machine learning technique is a neural network comprising at least one recurrent layer.

23. A method according to claim 22, wherein the at least one recurrent layer is a bidirectional recurrent layer.

24. A method according to claim 22 or 23, wherein the neural network applies a global normalisation of the weight distributions over all paths of labels through the series of weight distributions.

25. A method according to any one of claims 22 to 24, wherein the neural network includes at least one convolutional layer arranged before the at least one recurrent layer and which performs a convolution of windowed sections of the signal.

26. A method according to any one of the preceding claims, wherein the weights represent posterior probabilities.

27. A method according to any one of the preceding claims, wherein the step of deriving an estimate of the series of polymer units from the weight distributions is performed using connectionist temporal classification.

28. A method according to any one of the preceding claims, wherein the step of deriving an estimate of a polymer unit from the weight distributions comprises deriving a label in respect of respective weight distribution and run-length compressing the derived labels.

29. A method according to any one of the preceding claims, wherein the step of deriving an estimate of the series of polymer units from the weight distributions comprises estimating the most likely path of labels through the series of weight distributions on the basis of the weight distributions, and deriving the estimate of the series of polymer units from the path of labels estimated as most likely.

30. A method according to any one of claims 1 to 28, wherein the step of deriving an estimate of the series of polymer units from the weight distributions comprises estimating the labels that are most likely in respect of each weight distribution, taking into account forwards and backwards paths of labels through the series of weight distributions, and deriving the estimate of the series of polymer units from the labels estimated as most likely.

31. A method according to any one of the preceding claims, wherein the nanopore is a protein pore.

32. A method according to any one of the preceding claims, wherein the polymer is a polynucleotide, and the polymer units are nucleotides.

33. A method according to any one of the preceding claims, wherein the signal is derived from measurements of one or more of the following properties: ionic current, impedance, a tunnelling property, a field effect transistor voltage and an optical property.

34. A method according to any one of the preceding claims, the method being performed in a computer apparatus.

35. A method according to any one of the preceding claims, further comprising deriving the signal from the polymer during translocation of the polymer with respect to a nanopore.

36. An analysis apparatus for analysing a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the analysis apparatus comprising:

a machine learning unit arranged to perform a machine technique on the signal and to output a series of weight distributions , each weight distributions comprising weights in respect of transitions between labels over a set of labels including labels representing the possible types of polymer unit; and

an estimation unit arranged to derive an estimate of the series of polymer units from the weight distributions.

37. A nanopore measurement and analysis system comprising:

a measurement device arranged to derive a signal from a polymer during translocation of the polymer with respect to a nanopore; and

an analysis apparatus according to claim 36.

38. A method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the method comprising:

analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distribution comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit; and

deriving an estimate of the series of polymer units from the weight distributions, wherein the step of deriving an estimate of the series of polymer units takes into account a transition matrix representing whether transitions between labels are allowed or not allowed, at least one transition between labels being represented as not allowed and other transitions being represented as allowed.

39. An analysis apparatus for analysing a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the analysis apparatus comprising:

a machine learning unit arranged to perform a machine technique on the signal and to output a series of weight distributions, each weight distributions comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit; and

an estimation unit arranged to derive an estimate of the series of polymer units from the weight distributions,

wherein the estimation unit is arranged to takes into account a transition matrix representing whether transitions between labels are allowed or not allowed, at least one transition between labels being represented as not allowed and other transitions being represented as allowed.

40. A method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the method comprising:

analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distributions comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit, wherein consecutive instances of the same type of polymer unit in the series of polymer units are represented in a run-length encoded form; and

deriving an estimate of the series of polymer units from the weight distributions.

41. An analysis apparatus for analysing a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit,

the analysis apparatus comprising:

a machine learning unit arranged to perform a machine technique on the signal and to output a series of weight distributions, each weight distributions comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit, wherein consecutive instances of the same type of polymer unit in the series of polymer units are represented in a run-length encoded form; and

an estimation unit arranged to derive an estimate of the series of polymer units from the weight distributions.

Description:
Analysis of Nanopore Signal Using a Machine-Learning Technique

The present invention relates to the analysis of a signal derived from a polymer, for example but without limitation a polynucleotide, during translocation of the polymer with respect to a nanopore.

Measurement systems for estimating a target sequence of polymer units in a polymer using a nanopore wherein the polymer is translocated with respect to the nanopore are known. Some property of the system depends on the polymer units in the nanopore, and measurements of that property are taken. The property depends on the identity of the polymer units translocating with respect to the nanopore and so the signal over time allows the sequence of polymer units to be estimated. Each polymer unit can be quite small compared to dimensions of the pore, allowing multiple polymer units to affect the signal at a given period of time. Longer range effects may also be present due to interactions of the polymer strand with the nanopore, intra-strand properties like winding or stacking, or interactions between the polymer units and any system used to control their translocation. The signal forms a read which must be decoded to estimate the underlying polymer units.

Such nanopore measurement systems can provide signals representing long continuous reads of polynucleotides ranging from hundreds to hundreds of thousands (and potentially more) nucleotides. This type of measurement system using a nanopore has considerable promise, particularly in the field of sequencing a polynucleotide such as DNA or RNA, and has been the subject of much recent development.

However, the accuracy of estimation of the polymer units is limited by the

measurement systems being extremely sensitive. In practice, estimation with high accuracy requires machine learning techniques and the present invention is concerned with improving such an analysis to increase the accuracy of estimation.

Early analysis techniques used a Hidden Markov Model (HMM) which explicitly models possible k-mers comprising groups of consecutive polymer units. More recently techniques have been developed that use a recurrent neural network (RNN). Use of an RNN can improve accuracy by allowing long range information to be taken into account. RNNs are particularly useful as the speed of the read increases with the result that the assumptions underlying explicit signal modelling approaches like the HMM are less valid. By way of example, Teng et al,“Chiron: Translating nanopore raw signal directly into nucleotide sequence using deep learning”, Gigascience, 2018 May 1; 7(5) [Reference 1] discloses a method of sequencing polymer nucleotides using an RNN to which the raw signal is input. The RNN outputs a series of posterior probability distributions comprising posterior probabilities in respect of labels that represent the four possible types of base and a blank. These are decoded by a connectionist temporal classification decoder to derive an estimate of the series of polymer units, by estimating the most likely polymer units from the posterior probabilities.

According to a first aspect of the present invention, there is provided a method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit, the method comprising: analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distribution comprising weights in respect of transitions between labels over a set of labels including labels representing the possible types of polymer unit; and deriving an estimate of the series of polymer units from the weight distributions.

The set of labels can include labels representing blanks and/or stays. In other words, the set can be said to represent the possible types of polymer units.

The transitions can be between one label and another. The transitions can be between consecutive labels.

Thus, the method provides weights that refer to labels which represent the possible types of polymer unit, rather than representing a k-mer comprising k polymer units.

However, the method derives weights in respect of transitions between labels, rather than weights in respect of the labels themselves. Such a method provides advantages over a comparative method that derives a series of weights in respect of labels over a set of labels including labels that represent the possible types of polymer unit. By providing weights in respect of transitions between labels over the set of labels, additional information is provided that permits estimation of the series of polymer units in a manner that is more accurate. This is because the weights provide information on possible paths of labels, whereas weights in respect of labels do not.

For example, there are situations where a label for a particular position that is predicted by weights in respect of the labels is not correct, whereas a consideration of the paths of labels through that position may predict a different label that is correct. In this manner additional information is fed into the estimate, thereby improving the accuracy.

By way of example, this technique allows better estimation of regions of repetitive sequences, e.g. homopolymers, including regions where short sequences of one or more polymer units are repeated.

Preferably, at least one transition between labels is not allowed and other transitions are allowed, the weight distributions each comprising weights in respect of transitions that are allowed. In that case, the weight distributions may each comprise null weights in respect of transitions that are not allowed or the step of deriving an estimate of the series of polymer units may take into account a transition matrix representing whether transitions between labels are allowed or not allowed.

In one type of representation, the set of labels may include a first and a second label in respect of each type of polymer unit, the first label representing the start of an instance of the type of polymer unit, and the second label representing a stay in the instance of the type of polymer unit, wherein transitions from each first label to the first label for any other type of polymer unit are allowed, transitions from each first label to the first label for the same type of polymer unit are allowed, transitions from each first label to the second label for the same type of polymer unit are allowed, transitions from each first label to the second label for any other type of polymer unit are not allowed, transitions from each second label to the first label for the same type of polymer unit or the first label for any other type of polymer unit are allowed, and transitions from each second label to the second label for the same type of polymer unit are allowed, and transitions from each second label to the second label for any other type of polymer unit are not allowed.

A“stay” represents a situation in which the method determines that the label does not change, which may be considered as two weight distributions corresponding to the same instance of a polymer unit.

The set of possible types of polymer unit may include a type of polymer unit that always appears in a known sequence of polymer units, transitions in accordance with the known sequence being allowed and transitions contrary to the known sequence being not- allowed.

The labels consecutive instances of polymer units of the same type in the series of polymer units may be represented in an encoded form.

The labels may include plural labels, for example two labels, in respect of each type of polymer unit, wherein the plural labels in respect of each type of polymer unit represent consecutive instances of the type of polymer unit in the series of polymer units.

The plural labels for each type of polymer unit may have a predetermined cyclical order, whereby some transitions between labels are allowed by the predetermined cyclical order and other transitions between are not allowed by the predetermined cyclical order, the weight distributions including weights in respect of transitions that are allowed by the predetermined cyclical order. The consecutive instances of the same type of polymer unit in the series of polymer units are represented in in a run-length encoded form.

The labels may include labels in respect of different run-lengths of each type of polymer unit.

The labels may include a label in respect of each type of polymer unit, and the weight distributions may comprise further weights over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

The further weights may comprise a categorical distribution of weights over a set of possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

The further weights may comprise parameters of a parameterised distribution over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

If the possible types of polymer unit include a type of polymer unit that has unmodified and modified forms, then the set of labels may include a label representing the type of polymer unit that has unmodified and modified forms, and each weight distribution may comprise further weights for the unmodified and modified forms of each of said at least one type of polymer unit that has the unmodified and modified forms. The unmodified form of a polymer unit may be described as a canonical polymer unit and the modified form of a polymer unit may be described as a non-canonical polymer unit. A modified (or non- canonical) polymer unit typically affects a signal differently from a corresponding unmodified (canonical) polymer unit.

In some embodiments, a polymer comprising one or more non-canonical polymer units may be prepared and subsequently analysed as described in detail in International Patent Application No. PCT/GB2019/052456, filed 4 September 2019, to which reference is made and which is incorporated herein by reference. In one example, a proportion of canonical polymer units (e.g. amino acids) may be converted to a corresponding non- canonical polymer unit (e.g. amino acid) in a non-deterministic manner, e.g. by chemical conversion or by enzymatic conversion. In that case, when deriving an estimate of the series of polymer units (“calling”), the non-canonical bases may be estimated (“called”) as being the corresponding canonical base. In this manner, by recognising a non-canonical polymer unit as a canonical polymer unit in the analysis, the initial conversion can provide a way to provide a signal with more information, for example having a consequence that any errors present in the analysis of the signal will be non-systematic, thereby leading to an

improvement in the accuracy of the estimation.

The set of labels may include at least one label in respect of each type of polymer unit and at least one label in respect of a blank in the series of polymer units.

The machine learning technique may be a neural network comprising at least one recurrent layer, which may be a bidirectional recurrent layer.

The neural network may apply a global normalisation of the weight distributions over all paths through the series of weight distributions.

The neural network may include plural convolutional layers arranged before the recurrent layers and which perform a convolution of windowed sections of signal.

The weights may represent posterior probabilities.

The step of deriving an estimate of the series of polymer units from the weight distributions may be performed using connectionist temporal classification.

The step of deriving an estimate of the series of polymer units from the weight distributions may comprises deriving a label in respect of each weight distribution and run- length compressing the derived labels.

The step of deriving an estimate of the series of polymer units from the weight distributions may comprise estimating the most likely path of labels through the series of weight distributions on the basis of the weight distributions, the estimate of the series of polymer units being derived from the path of labels estimated as most likely.

Alternatively, the step of deriving an estimate of the series of polymer units from the weight distributions may comprise estimating the labels that are most likely in respect of each weight distribution, taking into account forwards and backwards paths of labels through the series of weight distributions, the estimate of the series of polymer units being derived from the labels estimated as most likely.

According to a second aspect of the present invention, there is provided a method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit, the method comprising: analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distributions comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit; and deriving an estimate of the series of polymer units from the weight distributions, wherein the step of deriving an estimate of the series of polymer units takes into account a transition matrix representing whether transitions between labels are allowed or not allowed, at least one transition between labels being represented as not allowed and other transitions being represented as allowed.

According to a third aspect of the present invention, there is provided a method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit, the method comprising: analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distributions comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit, wherein consecutive instances of the same type of polymer unit in the series of polymer units are represented in a run-length encoded form; and deriving an estimate of the series of polymer units from the weight distributions.

Any features of the first aspect can apply in any combination to the second and third aspects of the invention.

Further according to the present invention, the method may be implemented by a computer program executed in a computer apparatus or there may be provided an analysis apparatus arranged to implement a similar method to any of the aspects of the present invention.

Yet further according to the present invention, there may be provided a nanopore measurement and analysis system comprising such an analysis apparatus in combination with a measurement system arranged to derive a signal from a polymer during translocation of the polymer with respect to a nanopore.

To allow better understanding, embodiments of the present invention will now be described by way of non-limitative example with reference to the accompanying drawings, in which:

Fig. 1 is a schematic diagram of a nanopore measurement and analysis system;

Fig. 2 is a plot of a typical signal over time;

Fig. 3 is a diagram of a neural network in an analysis system;

Fig. 4 is a plot of part of the signal illustrating the operation of a windowing section of the neural network;

Fig. 5 is a diagram of a recurrent layer of an RNN;

Fig. 6 is a diagram of a non-recurrent layer;

Fig. 7 is a diagram a unidirectional layer;

Fig. 8 is a diagram of a bidirectional recurrent layer that combines a‘forward’ and ‘backward’ recurrent layer; Fig. 9 is a diagram of an alternative bidirectional recurrent layer that combines ‘forward’ and‘backward’ recurrent layer in an alternating fashion;

Fig. 10 is table of a weight distribution where the weights are in respect of transitions between labels representing four types of polynucleotide;

Fig. 11 is table of a weight distribution where the weights are in respect of transitions between labels representing four types of polynucleotide and a blank;

Fig. 12 is table of a weight distribution where the weights are in respect of transitions between labels representing five types of polynucleotide, one of which is methylated-C, and a blank

Fig. 13 is table of a weight distribution where the weights are in respect of transitions between labels including two labels in respect of each of four types of polynucleotide;

Fig. 14 is table of a weight distribution where the weights represent homopolymers using a flip-flop representation;

Fig. 15 is a plot of residual currents for four bases using a 6-mer model of signal and approximate location of relative to read head and other components of the system;

Fig. 16 is table of a weight distribution where the weights represent homopolymers using a run-length encoded representation;

Fig. 17 is table of a weight distribution where the weights represent homopolymers using a different formulation of a run-length encoded representation;

Fig. 18 is a table of further weights of a weight distribution, which represent a categorical distribution over a set of possible lengths for each possible type of homopolymer;

Fig. 19 is a table of further weights of a weight distribution, which represent a parameterised distribution over possible lengths for each possible type of homopolymer;

Fig. 20 is a plot of two distributions represented by different values of mean and variance parameters;

Fig. 21 is a table of possible distributions that may be used to represent

homopolymers;

Fig. 22 is a table of further weights of a weight distribution, which represent a categorical distribution over a set of possible lengths for each possible pair of polymer unit;

Fig. 23 is a table of further weights of a weight distribution, which represent a categorical distribution over a set of possible lengths for each possible triplet of polymer unit;

Fig. 24 is a table of a weight distribution where the set of labels is expanded to include a label in respect of a modified polymer unit;

Fig. 25 is a table of further weights for unmodified and modified forms of a type of polymer unit in a factored representation of modifications;

Fig. 26 is a plot of a signal and polymer units estimated therefrom for a 5-base representation;

Fig. 27 is a flow diagram of a method performed by a decoder of the neural network; and

Figs. 28 to 30 are definitions of different decoding algorithms;

Fig. 31 is a definition of a further decoding algorithm;

Fig. 32 is a definition of an algorithm for constructing an objective transition matrix for a flip-flop representation;

Fig. 33 is a definition of an objective function for training over all paths;

Fig. 34 is a definition of an algorithm for constructing an objective transition matrix for a multi-stay representation;

Fig. 35 is a definition of an algorithm for constructing an objective transition matrix for a run-length encoded representation;

Fig. 36 is a plot of a signal and polymer units estimated therefrom illustrating an example of a long homopolymer;

Fig. 37 is a definition of an objective function for training for the best path;

Fig. 38 is a table of functors;

Fig. 39 is a plot of a signal and polymer units estimated therefrom illustrating an example where a flip-flop representation is trained using sharpening; and

Fig. 40 is a table illustrating alignment of an estimated series of polymer units to a reference for representations that are trained without and with sharpening.

Fig. 1 illustrates a nanopore measurement and analysis system 1 comprising a measurement system 2 and an analysis system 3. The measurement system 2 derives a signal from a polymer comprising a series of polymer units during translocation of the polymer with respect to a nanopore. The analysis system 3 performs a method of analysing the signal to derive an estimate of the series of polymer units.

In general, the polymer may be of any type, for example a polynucleotide (or nucleic acid), a polypeptide such as a protein, or a polysaccharide. The polymer may be natural or synthetic. The polynucleotide may comprise a homopolymer region. The homopolymer region may comprise between 5 and 15 nucleotides.

In the case of a polynucleotide or nucleic acid, the polymer units may be nucleotides. The nucleic acid is typically deoxyribonucleic acid (DNA), ribonucleic acid (RNA), cDNA or a synthetic nucleic acid known in the art, such as peptide nucleic acid (PNA), glycerol nucleic acid (GNA), threose nucleic acid (TNA), locked nucleic acid (LNA) or other synthetic polymers with nucleotide side chains. The PNA backbone is composed of repeating N-(2-aminoethyl)-glycine units linked by peptide bonds. The GNA backbone is composed of repeating glycol units linked by phosphodiester bonds. The TNA backbone is composed of repeating threose sugars linked together by phosphodiester bonds. LNA is formed from ribonucleotides as discussed above having an extra bridge connecting the 2' oxygen and 4' carbon in the ribose moiety. The nucleic acid may be single- stranded, be double- stranded or comprise both single-stranded and double-stranded regions. The nucleic acid may comprise one strand of RNA hybridised to one strand of DNA. Typically cDNA, RNA, GNA, TNA or LNA are single stranded.

The polymer units may be any type of nucleotide. The nucleotide can be naturally occurring or artificial. For instance, the method may be used to verify the sequence of a manufactured oligonucleotide. A nucleotide typically contains a nucleobase, a sugar and at least one phosphate group. The nucleobase and sugar form a nucleoside. The nucleobase is typically heterocyclic. Suitable nucleobases include purines and pyrimidines and more specifically adenine, guanine, thymine, uracil and cytosine. The sugar is typically a pentose sugar. Suitable sugars include, but are not limited to, ribose and deoxyribose. The nucleotide is typically a ribonucleotide or deoxyribonucleotide. The nucleotide typically contains a monophosphate, diphosphate or triphosphate.

The nucleotide can be a modified base, such as a damaged or epigenetic base. For instance, the nucleotide may comprise a pyrimidine dimer. Such dimers are typically associated with damage by ultraviolet light and are the primary cause of skin melanomas.

The nucleotide can be labelled or modified to act as a marker with a distinct signal. This technique can be used to identify the absence of a base, for example, an abasic unit or spacer in the polynucleotide. The method could also be applied to any type of polymer.

In the case of a polypeptide, the polymer units may be amino acids that are naturally occurring or synthetic.

In the case of a polysaccharide, the polymer units may be monosaccharides.

Particularly where the measurement system 2 comprises a nanopore and the polymer comprises a polynucleotide, the polynucleotide may be long, for example at least 5kB (kilo- bases), i.e. at least 5,000 nucleotides, or at least 30kB(kilo-bases), i.e. at least 30,000 nucleotides, or at least lOOkB (kilo-bases), i.e. at least 100,000 nucleotides.

The nature of the measurement system 2 and the resultant signal is as follows.

The measurement system 2 is a nanopore system that comprises one or more nanopores. In a simple type, the measurement system 2 has only a single nanopore, but a more practical measurement systems 2 employ many nanopores, typically in an array, to provide parallelised collection of information.

The signal may be recorded during translocation of the polymer with respect to the nanopore, typically through the nanopore.

The nanopore is a pore, typically having a size of the order of nanometres, that may allow the passage of polymers therethrough.

The nanopore may be a protein pore or a solid state pore. The dimensions of the pore may be such that only one polymer may translocate the pore at a time.

Where the nanopore is a protein pore, it may have the following properties.

The biological pore may be a transmembrane protein pore. Transmembrane protein pores for use in accordance with the invention can be derived from b-barrel pores or a-helix bundle pores b-barrel pores comprise a barrel or channel that is formed from b-strands. Suitable b-barrel pores include, but are not limited to, b-toxins, such as a-hemolysin, anthrax toxin and leukocidins, and outer membrane proteins/porins of bacteria, such as

Mycobacterium smegmatis porin (Msp), for example MspA, MspB, MspC or MspD, lysenin,, outer membrane porin F (OmpF), outer membrane porin G (OmpG), outer membrane phospholipase A and Neisseria auto transporter lipoprotein (NalP). a-helix bundle pores comprise a barrel or channel that is formed from a-helices. Suitable a-helix bundle pores include, but are not limited to, inner membrane proteins and a outer membrane proteins, such as WZA and ClyA toxin. The transmembrane pore may be derived from Msp or from a-hemolysin (a-HL). The transmembrane pore may be derived from lysenin. Suitable pores derived from lysenin are disclosed in WO 2013/153359. Suitable pores derived from MspA are disclosed in WO-2012/107778. The pore may be derived from CsgG, such as disclosed in WO-2016/034591. The pore may be a DNA origami pore.

The protein pore may be a naturally occurring pore or may be a mutant pore. Typical pores are described in WO-2010/109197, Stoddart D et al., Proc Natl Acad Sci,

12;106(19):7702-7, Stoddart D et al., Angew Chem Int Ed Engl. 2010;49(3):556-9, Stoddart D et al., Nano Lett. 2010 Sep 8;10(9):3633-7, Butler TZ et al., Proc Natl Acad Sci

2008;105(52):20647-52, and WO-2012/107778.

The protein pore may be one of the types of protein pore described in

WO-2015/140535 and may have the sequences that are disclosed therein.

The protein pore may be inserted into an amphiphilic layer such as a biological membrane, for example a lipid bilayer. An amphiphilic layer is a layer formed from amphiphilic molecules, such as phospholipids, which have both hydrophilic and lipophilic properties. The amphiphilic layer may be a monolayer or a bilayer. The amphiphilic layer may be a co-block polymer such as disclosed in Gonzalez-Perez et al., Langmuir, 2009, 25, 10447-10450 or WO2014/064444. Alternatively, a protein pore may be inserted into an aperture provided in a solid state layer, for example as disclosed in W02012/005857.

A suitable apparatus for providing an array of nanopores is disclosed in

WO-2014/064443. The nanopores may be provided across respective wells wherein electrodes are provided in each respective well in electrical connection with an ASIC for measuring current flow through each nanopore. A suitable current measuring apparatus may comprise the current sensing circuit as disclosed in WO-2016/181118.

The nanopore may comprise an aperture formed in a solid state layer, which may be referred to as a solid state pore. The aperture may be a well, gap, channel, trench or slit provided in the solid state layer along or into which analyte may pass. Such a solid-state layer is not of biological origin. In other words, a solid state layer is not derived from or isolated from a biological environment such as an organism or cell, or a synthetically manufactured version of a biologically available structure. Solid state layers can be formed from both organic and inorganic materials including, but not limited to, microelectronic materials, insulating materials such as Si3N4, A1203, and SiO, organic and inorganic polymers such as polyamide, plastics such as Teflon® or elastomers such as two-component addition-cure silicone rubber, and glasses. The solid state layer may be formed from graphene. Suitable graphene layers are disclosed in WO-2009/035647, WO-2011/046706 or WO-2012/138357. Suitable methods to prepare an array of solid state pores is disclosed in WO-2016/187519.

Such a solid state pore is typically an aperture in a solid state layer. The aperture may be modified, chemically, or otherwise, to enhance its properties as a nanopore. A solid state pore may be used in combination with additional components which provide an alternative or additional measurement of the polymer such as tunnelling electrodes (Ivanov AP et al., Nano Lett. 2011 Jan 12; 11( l):279-85), or a field effect transistor (FET) device (as disclosed for example in WO-2005/124888). Solid state pores may be formed by known processes including for example those described in WO-OO/79257.

The nanopore may be a hybrid of a solid state pore with a protein pore.

The measurement system 2 takes a series of measurements of a property that depends on the polymer units translocating with respect to the pore may be measured. The series of measurements form a signal The property that is measured may be associated with an interaction between the polymer and the pore. Such an interaction may occur at a constricted region of the pore.

In one type of measurement system 2, property that is measured may be the ion current flowing through a nanopore. These and other electrical properties may be measured using standard single channel recording equipment as describe in Stoddart D et al., Proc Natl Acad Sci, 12;106(19):7702-7, Lieberman KR et al, J Am Chem Soc. 2010;132(50):17961-72, and WO-2000/28312. Alternatively, measurements of electrical properties may be made using a multi-channel system, for example as described in WO-2009/077734, WO- 2011/067559 or WO-2014/064443.

Ionic solutions may be provided on either side of the membrane or solid state layer, which ionic solutions may be present in respective compartments. A sample containing the polymer analyte of interest may be added to one side of the membrane and allowed to move with respect to the nanopore, for example under a potential difference or chemical gradient. The signal may be derived during the movement of the polymer with respect to the pore, for example taken during translocation of the polymer through the nanopore. The polymer may partially translocate the nanopore.

In order to allow measurements to be taken as the polymer translocates through a nanopore, the rate of translocation can be controlled by a polymer binding moiety. Typically the moiety can move the polymer through the nanopore with or against an applied field. The moiety can be a molecular motor using for example, in the case where the moiety is an enzyme, enzymatic activity, or as a molecular brake. Where the polymer is a polynucleotide there are a number of methods proposed for controlling the rate of translocation including use of polynucleotide binding enzymes. Suitable enzymes for controlling the rate of translocation of polynucleotides include, but are not limited to, polymerases, helicases, exonucleases, single stranded and double stranded binding proteins, and topoisomerases, such as gyrases. For other polymer types, moieties that interact with that polymer type can be used. The polymer interacting moiety may be any disclosed in WO-2010/086603, WO-2012/107778, and Lieberman KR et al, J Am Chem Soc. 2010;132(50):17961-72), and for voltage gated schemes (Luan B et al., Phys Rev Lett. 2010; 104(23):238103).

The polymer binding moiety can be used in a number of ways to control the polymer motion. The moiety can move the polymer through the nanopore with or against the applied field. The moiety can be used as a molecular motor using for example, in the case where the moiety is an enzyme, enzymatic activity, or as a molecular brake. The translocation of the polymer may be controlled by a molecular ratchet that controls the movement of the polymer through the pore. The molecular ratchet may be a polymer binding protein. For

polynucleotides, the polynucleotide binding protein is preferably a polynucleotide handling enzyme. A polynucleotide handling enzyme is a polypeptide that is capable of interacting with and modifying at least one property of a polynucleotide. The enzyme may modify the polynucleotide by cleaving it to form individual nucleotides or shorter chains of nucleotides, such as di- or trinucleotides. The enzyme may modify the polynucleotide by orienting it or moving it to a specific position. The polynucleotide handling enzyme does not need to display enzymatic activity as long as it is capable of binding the target polynucleotide and controlling its movement through the pore. For instance, the enzyme may be modified to remove its enzymatic activity or may be used under conditions which prevent it from acting as an enzyme. Such conditions are discussed in more detail below.

Preferred polynucleotide handling enzymes are polymerases, exonucleases, helicases and topoisomerases, such as gyrases. The polynucleotide handling enzyme may be for example one of the types of polynucleotide handling enzyme described in WO-2015/140535 or WO-2010/086603.

Translocation of the polymer through the nanopore may occur, either cis to trans or trans to cis, either with or against an applied potential. The translocation may occur under an applied potential which may control the translocation.

Exonucleases that act progressively or processively on double stranded DNA can be used on the cis side of the pore to feed the remaining single strand through under an applied potential or the trans side under a reverse potential. Likewise, a helicase that unwinds the double stranded DNA can also be used in a similar manner. There are also possibilities for sequencing applications that require strand translocation against an applied potential, but the DNA must be first“caught” by the enzyme under a reverse or no potential. With the potential then switched back following binding the strand will pass cis to trans through the pore and be held in an extended conformation by the current flow. The single strand DNA exonucleases or single strand DNA dependent polymerases can act as molecular motors to pull the recently translocated single strand back through the pore in a controlled stepwise manner, trans to cis, against the applied potential. Alternatively, the single strand DNA dependent polymerases can act as a molecular brake slowing down the movement of a polynucleotide through the pore. Any moieties, techniques or enzymes described in WO-2012/107778 or WO- 2012/033524 could be used to control polymer motion.

However, the measurement system 2 may be of alternative types that comprise one or more nanopores. Similarly, the properties that are measured may be of types other than ion current. Some examples of alternative types of property include without limitation: electrical properties and optical properties. A suitable optical method involving the measurement of fluorescence is disclosed by J. Am. Chem. Soc. 2009, 131 1652-1653. Possible electrical properties include: ionic current, impedance, a tunnelling property, for example tunnelling current (for example as disclosed in Ivanov AP et al., Nano Lett. 2011 Jan 12;l l(l):279-85), and a FET (field effect transistor) voltage (for example as disclosed in WO2005/124888). One or more optical properties may be used, optionally combined with electrical properties (Soni GV et al., Rev Sci Instrum. 2010 Jan;81(l):014301). The property may be a transmembrane current, such as ion current flow through a nanopore. The ion current may typically be the DC ion current, although in principle an alternative is to use the AC current flow (i.e. the magnitude of the AC current flowing under application of an AC voltage).

In some types of the measurement system 2, the signal may be characterised as comprising measurements from a series of events, where each event provides a group of measurements. Fig. 2 illustrates a typical example of such a signal 10 in the case of measurement of current. The group of measurements from each event have a level that is similar, although subject to some variance. This may be thought of as a noisy step wave with each step corresponding to an event. The events may have biochemical significance, for example arising from a given state or interaction of the measurement system 2. This may in some instances arise from translocation of the polymer through the nanopore occurring in a ratcheted manner. However, this type of signal is not produced by all types of measurement system and the methods described herein are not dependent on the type of signal. For example, when translocation rates approach the measurement sampling rate, for example, measurements are taken at 1 times, 2 times, 5 times or 10 times the translocation rate of a polymer unit, events may be less evident or not present, compared to slower sequencing speeds or faster sampling rates.

In addition, where events are present, typically there is no a priori knowledge of number of measurements in the group, which varies unpredictably. These factors of variance and lack of knowledge of the number of measurements can make it hard to distinguish some of the groups, for example where the group is short and/or the levels of the measurements of two successive groups are close to one another.

The group of measurements corresponding to each event typically has a level that is consistent over the time scale of the event, but for most types of the measurement system 2 will be subject to variance over a short time scale. Such variance can result from measurement noise, for example arising from the electrical circuits and signal processing, notably from the amplifier in the particular case of electrophysiology. Such measurement noise is inevitable due the small magnitude of the properties being measured. Such variance can also result from inherent variation or spread in the underlying physical or biological system of the measurement system 2, for example a change in interaction, which might be caused by a conformational change of the polymer.

Most types of the measurement system 2 will experience such inherent variation to greater or lesser extents. For any given types of the measurement system 2, both sources of variation may contribute or one of these noise sources may be dominant.

With increase in the sequencing rate, being the rate at which polymer units translocate with respect to the nanopore, then the events may become less pronounced and hence harder to identify, or may disappear. Thus, analysis methods that rely on detecting such events detection may become less efficient at as the sequencing rate increases.

However, the methods disclosed herein are not dependent on detecting such events. The methods described below are effective even at relatively high sequencing rates, including sequencing rates at which the polymer translocates at a rate of at least 10 polymer units per second, preferably 100 polymer units per second, more preferably 500 polymer units per second, or more preferably 1000 polymer units per second.

The sample rate is the rate of measurements in the signal. Typically, the sample rate is higher than the sequencing rate. For example, the sample rate may be in a range from a 100 Hz to 30 kHz, but this is not limitative. In practice the sample rate may depend on the nature of the measurement system 2.

In some cases, the method may use plural series of measurements that are

measurements of series of polymer units that are related. For example, the plural series of measurements may be series of measurements of separate polymers having related sequences, or may be series of measurements of different regions of the same polymer having related sequences.

In the case of polynucleotides, the plural series of polymer units may be related by being complementary, so that one series of polymer units is referred to as a template and the other series of polymer units that is a complementary thereto is referred to as a complement. In this case, measurements of the template and the complement may be taken using any suitable technique, for example being taken sequentially using a polynucleotide binding protein or via polynucleotide sample preparation. Suitable methods include those described in WO-2010/086622 or WO-2013/014451. Any of the methods disclosed herein relating to a single series of polymer units may be applied to plural series of measurements, such as a template and complement, for example by using the methods described in WO-2010/086622 or WO-2013/014451.

The series of measurements form a raw signal that is analysed by the analysis system 3. The raw signal may be pre-processed in the measurement system 2 before supply to the analysis system 2 or as an initial stage in the analysis system 3, for example filtered to reduce noise. In such cases, the analysis below is performed on the pre-processed signal.

The analysis system 3 may be physically associated with the measurement system 2, and may also provide control signals to the measurement system 2. In that case, the nanopore measurement and analysis system 1 comprising the measurement system 2 and the analysis system 3 may be arranged as disclosed in any of WO-2008/102210, WO-2009/07734, WO- 2010/122293, WO-2011/067559 or WO2014/04443.

Alternatively, the analysis system 3 may implemented in a separate apparatus, in which case the series of measurement is transferred from the measurement system 2 to the analysis system 3 by any suitable means, typically a data network. For example, one convenient cloud-based implementation is for the analysis system 3 to be a server to which the input signal 11 is supplied over the internet.

The analysis system 3 may be implemented by a computer apparatus executing a computer program or may be implemented by a dedicated hardware device, or any combination thereof. In either case, the data used by the method is stored in a memory in the analysis system 3.

In the case of a computer apparatus executing a computer program, the computer apparatus may be any type of computer system but is typically of conventional construction. The computer program may be written in any suitable programming language. The computer program may be stored on a computer-readable storage medium, which may be of any type, for example: a recording medium which is insertable into a drive of the computing system and which may store information magnetically, optically or opto-magnetically; a fixed recording medium of the computer system such as a hard drive; or a computer memory.

In the case of the computer apparatus being implemented by a dedicated hardware device, then any suitable type of device may be used, for example an FPGA (field programmable gate array) or an ASIC (application specific integrated circuit). In a preferred embodiment, portions of the computer program may be implemented using hardware amenable to parallelisation of calculations such as a Graphics processing unit (GPU).

A method of using the nanopore measurement and analysis system 1 is performed as follows.

Firstly, a signal 10 is derived using the measurement system 2. For example, the polymer is caused to translocate with respect to the pore, for example through the pore, and the signal is derived during the translocation of the polymer. The polymer may be caused to translocate with respect to the pore by providing conditions that permit the translocation of the polymer, whereupon the translocation may occur spontaneously. During the

translocation, the signal 10 is derived.

Secondly, the analysis system 3 performs a method of analysing the signal 10 as will now be described.

The analysis system 3 analyses the signal using a neural network 20. The parameters of the neural network 20 take values during the training that is described further below, and as such the recurrent neural network is not dependent on the measurements having any particular form or the measurement system 2 having any particular property. For example, the recurrent neural network is not dependent on the measurements being dependent on k-mers comprising k consecutive polymer units.

An example of a suitable neural network 20 is shown in Fig. 3 and includes a windowing unit 30, a CNN (convolutional neural network) 40, an RNN (recurrent neural network) 50 and a decoder 80 , which successively process the signal as follows.

The windowing unit 30 windows the signal 10 to derive successive windowed sections 31 of the the signal 10, for example as illustrated in Fig. 4. The windowed sections 11 are supplied to the CNN 40.

The windowed sections 31 have a length 32, and a stride 33 between successive windowed sections 31, both of which may be counted in time or in numbers of samples of the signal 10. The stride 33 may be a single sample or plural samples. If the stride 33 is a single sample then, ignoring edge effects, there are the same number of windowed sections 31 as samples in the signal 10. If the stride 33 is larger than a single sample, then the windowing unit 30 performs downsampling and there are less windowed sections 31 than samples in the signal 10. Typically, the stride 33 is less than the length 33, such that the windowed sections 10 overlap in the signal 10.

By way of example, the length 32 may be 4.75 ms and the stride may be 0.5 ms.

By way of further example, the length may be 19 samples, and the stride may be 2 samples.

The CNN 40 comprises at least one convolutional layer. The at least one

convolutional layer performs a convolution of each windowed section 11 to derive a feature vector 41 in respect of each windowed section 31. That is done irrespective of any events that may be evident in the signal, and so is equally applicable to signals where such events are or are not evident, or to signals where events are provided during pre-processing.. The feature vectors 41 are supplied to the RNN 50.

The CNN 40 is trained together with the RNN 50 as discussed below.

The CNN 40 may take any form.

In one example, the CNN 40 may be a single convolutional layer, defined by an affine transform with weights W and bias b, and an activation function g. Here I t-j.t+k represents a window of measurements of the raw signal 20 containing the t—j to the t + k

measurements inclusive, and O t is the output feature vector.

y t = AI t-j.t+k + b Affine transform

O t = g(y t ) Activation

The hyperbolic tangent is a suitable activation function but many more alternatives are known in the art, including but not restricted to: the Rectifying Linear Unit (ReLU), Exponential Linear Unit (ELU), softplus unit, and sigmoidal unit. Plural convolutional layers may also be used.

In another example, the CNN 40 may take the same form as the CNN in Reference 1.

A straight convolutional network, as described, has the disadvantage that there is a dependence on the exact position of detected features in the raw signal and this also implies a dependence on the spacing between the features. The dependence can be alleviated by using the output sequence of feature vectors generated by the first convolution as input into a second‘pooling’ network that acts on the order statistics of its input.

By way of example, where the pooling network is a single layer neural network, the following equations describe how the output relates to the input vectors. Letting f be an index over input features, so Af is the weight matrix for feature /, and let S be a functor that returns some or all of the order statistics of its input:

One useful yet computationally efficient example of such a layer is that which returns a feature vector, the same size as the number of input features, whose elements are the maximum value obtained for each respective feature. Letting the functor S M return only the last order statistic, being the maximum value obtained in its input, and letting U f be the (single column) matrix that consists entirely of zeros other than a unit value at its (/, 1) element:

Since the matrices U f are extremely sparse, for reasons of computation efficiency, the matrix multiplications may be performed implicitly: here effect of åf UfXf is to set element f of the output feature vector to Xf.

The convolutions and / or pooling may be performed only calculating their output for every nth position (a stride of n) and so down-sampling their output. Down-sampling can be advantageous from a computational perspective since the rest of the network has to process fewer blocks (faster compute) to achieve a similar accuracy.

Adding a stack of convolution layers solves many of the problems described above: the feature detection learned by the convolution can function both as nanopore- specific feature detectors and summary statistics without making any additional assumptions about the system; feature uncertainty is passed down into the rest of the network by relative weights of different features and so further processing can take this information into account leading to more precise predictions and quantification of uncertainty.

The RNN 50 outputs a series of weight distributions. The RNN 50 comprises at least one recurrent layer 52, the or each recurrent layer being followed by a feed-forward layer 53. Fig. 5 illustrates the RNN for the case of a single recurrent layer 52 whereas in general there may be any plural number of recurrent layers 52 and subsequent feed-forward layers 53. This provides a flexible choice of unit architecture. The layers may have different parameters, be different sizes or even be composed of different unit types.

The or each recurrent layer 52 is preferably bidirectional to allow the influence of each input feature vector to propagate in both directions through the RNN. An alternative preferred embodiment comprises multiple uni-directional recurrent layers, arranged in alternating directions, for example layers arranged in successive directions of reverse, forwards, reverse, forwards, reverse. These bidirectional architectures allow the RNN 50 to accumulate and propagate information in a manner unavailable to HMMs. An additional advantage of recurrent layers is that they do not require an exact scaling of signal to model (or vice versa), e.g. via an iterative procedure.

For the subsampling in the feed-forward layer 53, separate affine transforms are applied to the output vectors for the forward and backwards layer at each column, followed by summation; this is equivalent to applying an affine transform to the vector formed by concatenation of the input and output. An activation function is then applied element-wise to the resultant matrix.

The recurrent layers 52 may use several types of neural network unit as will now be described. The types of unit fall into two general categories depending on whether or not they are‘recurrent’. Whereas non-recurrent units treat each step in the sequence independently, a recurrent unit is designed to be used in a sequence and pass a state vector from one step to the next.

In order to show diagrammatically the difference between non-recurrent units and recurrent units, Fig. 6 shows a non-recurrent layer 60 of non-recurrent units 61 and Figs. 7 to 9 show three different layers 62 to 64 of respective non-recurrent units 64 to 66. In each of Figs. 6 to 9, the arrows show connections along which vectors are passed, arrows that are split being duplicated vectors and arrows which are combined being concatenated vectors.

In the non-recurrent layer 60 of Fig. 6, the non-recurrent units 61 have separate inputs and outputs which do not split or concatenate.

The recurrent layer 62 of Fig. 7 is a unidirectional recurrent layer in which the output vectors of the recurrent units 65 are split and passed to unidirectionally to the next recurrent unit 65 in the recurrent layer.

While not a discrete unit in its own right, the bidirectional recurrent layers 63 and 64 of Figs. 8 and 9 each have a repeating unit- like structure made from simpler recurrent units 66 and 67, respectively.

In the bidirectional recurrent layer 63 of Fig. 8, the bidirectional recurrent layer 63 consists of two sub-layers 68 and 69 of recurrent units 66, being a forwards sub-layer 68 having the same structure as the unidirectional recurrent layer 62 of Fig. 7 and a backward sub- layer 69 having a structure that is reversed from the unidirectional recurrent layer 62 of Fig. 7 as though time were reversed, passing state vectors from one unit 66 to the previous unit 66. Both the forwards and backwards sub-layers 68 and 69 receive the same input and their outputs from corresponding units 66 are concatenated together to form the output of the bidirectional recurrent layer 63. It is noted that there are no connections between any unit 66 within the forwards sub-layer 68 and any unit within the backwards sub-layer 69.

The alternative bidirectional recurrent layer 64 of Fig. 9 similarly consists of two sub layers 70 and 71 of recurrent units 67, being a forwards sub-layer 68 having the same structure as the unidirectional recurrent layer 62 of Fig. 7 and a backwards sub-layer 69 having a structure that is reversed from the unidirectional recurrent layer 62 of Fig. 7 as though time were reversed. Again the forwards and backwards sub-layers 68 and 69 receive the same inputs, However, in contrast to the bidirectional recurrent layer 63 of Fig. 8, the outputs of forwards sub-layer 68 are the inputs of the backwards sub-layer 69 and the outputs of the backwards sub-layer 69 form the output of the bidirectional recurrent layer 64 (the forwards and backwards sub-layers 68 and 69 could be reversed).

A generalisation of the bidirectional recurrent layer 64 shown in Fig. 9 would be a stack of recurrent layers consisting of plural‘forwards’ and‘backward’ recurrent sub-layers, where the output of each layer is the input for the next layer.

The bidirectional recurrent layers 52 of the RNN 50 may take the form of either of the bidirectional recurrent layers 63 and 64 of Figs. 8 and 9. In general, the bidirectional recurrent layers 34 of Fig. 3 could be replaced by a non-recurrent layer, for example the non recurrent layer 60 of Fig. 6, or by a unidirectional recurrent layer, for example the recurrent layer 62 of Fig. 7, but improved performance is achieved by use of bidirectional recurrent layers 34.

The feed-forward layers 53 will now be described.

The feed-forward layers 53 comprise feed-forward units 54 that process respective vectors. The feed-forward units 54 are the standard unit in classical neural networks, that is an affine transform is applied to the input vector and then a non-linear function is applied element-wise. The feed-forward layers 53 all use the hyperbolic tangent for the non-linear function, although many others may be used with little variation in the overall accuracy of the network.

If the input vector at step t is I t , and the weight matrix and bias for the affine transform are A and b respectively, then the output vector O t is:

y t = AI t + b Affine transform

O t = tanh(y t ) Non— linearity

The weight distributions of the RNN 50 are normalised globally. This is discussed in more detail below.

The non-recurrent units 62 and recurrent units 65 to 67 treat each event

independently, but may be replaced by Long Short-Term Memory units having a form as will now be described.

Long Short-Term Memory (LSTM) units were introduced in Hochreiter and

Schmidhuber, Long short-term memory, Neural Computation, 9 (8): 1735-1780, 1997. An LSTM unit is a recurrent unit and so passes a state vector from one step in the sequence to the next. The LSTM is based around the notation that the unit is a memory cell: a hidden state containing the contents of the memory is passed from one step to the next and operated on via a series of gates that control how the memory is updated. One gate controls whether each element of the memory is wiped (forgotten), another controls whether it is replaced by a new value, and a final gate that determines whether the memory is read from and output. What makes the memory cell differentiable is that the binary on / off logic gates of the conceptual computer memory cell are replaced by notional probabilities produced by a sigmoidal function and the contents of the memory cells represent an expected value.

Firstly the standard implementation of the LSTM is described and then the‘peep hole’ modification that is actually used in the basic method.

The standard LSTM is as follows.

The probabilities associated with the different operations on the LSTM units are defined by the following set of equations. Letting I t be input vector for step t, O t be the output vector and let the affine transform indexed by x that has bias b x and weight matrices W xl and W x0 for the input and previous output respectively; s is the non-linear sigmoidal transformation.

f t = a(W fl I t + W fo O t-± + b f ) Forget probability u t = a(W ut I t + W u0 O t -± + b u ) Update probability o t = o(W 0l I t + W o0 O t _ ! + b 0 ) Output probability

Given the update vectors defined above and letting the _ operator represent element wise (Hadamard) multiplication, the equations to update the internal state S t and determine the new output are:

v t = tanh(M7 v/ / t + W v0 O t- + b v ) Value to update with

S t = S t -i ° f t + v t ° u t Update memory cell

O t = tanh(s t ) ° o t Read from memory cell

The peep-hole modification is as follows.

The’peep-hole’ modification (Gers and Schmidhuber, 2000) adds some additional connections to the LSTM architecture allowing the forget, update and output probabilities to ’peep at’ (be informed by) the hidden state of the memory cell. The update equations for the network are as above but, letting P x be a‘peep’ vector of length equal to the hidden state, the three equations for the probability vectors become:

f t = a(W fl I t + W fo O t-1 + b f + P f _ ° S t-1 ) Forget probabilty u t = a(W UI I t + W u oO t-ί + b u + P u _ ° S t -i ) Update probability o t = o(W 0l I t + W o0 O t-± + b 0 + P 0 _ o S f ) Output probability

The non-recurrent units 62 and recurrent units 65 to 67 may alternatively be replaced by Gated Recurrent Units having a form as follows.

The Gated Recurrent Unit (GRU) has been found to be quicker to run but initially found to yield poorer accuracy. The architecture of the GRU is not as intuitive as the LSTM, dispensing with the separation between the hidden state and the output and also combining the‘forget’ and‘input gates’.

o t = a(W 0l I t + W o sS^ + b 0 ) Output probability u t = 5 t-! o a(W UI l t + \V n sS t-! + b u ) Update from state v t = tanh(W v/ / t + W vR u t + b v ) Value to update with

S t = (1— o t ) o 5 t-! + o t o v t Update state

While there are the same number of columns output as there are events, it is not correct to assume that each column is identified with a single event in the input to the network since its contents are potentially informed by the entire input set of events because of the presence of the bidirectional layers. Any correspondence between input events and output columns is through how they are labelled with symbols in the training set.

In another example, the RNN 50 may take the same form as the RNN in Reference 1.

The series of weight distributions 51 output by the RNN 50 will now be discussed.

A weight distribution 51 is output in respect of successive time-steps to form a series of weight distributions. The time-step may in principle be of the same length as the sample period of the signal 10, but is typically longer than the sample period of the signal 10 due to oversampling in the neural network 20. However, the time-steps of are a regular length, for example corresponding to the stride 13 of the windowing unit 30, which contrast to systems where event-calling is performed and so the time-steps between successive weight distributions 51 corresponds the length of successively detected events, which are variable.

In general, the weight distributions 51 are output at a higher rate than the rate at which successive polymer units translocate with respect to the nanopore, i.e. there are more weight distributions 51 than polymer units. The plural number of weight distributions 51 which correspond to each polymer unit in the series is a priori unknown.

Each weight distribution 51 comprises plural weights. The weights represent posterior probabilities. The weights may be the actual posterior probabilities, or more generally may be weights which are not actual probabilities but nonetheless represent the posterior probabilities. Generally, where the weights are not actual probabilities, the posterior probabilities could in principle be determined therefrom, taking account of the normalisation of the weights.

The RNN 50 outputs weights in respect of transitions between labels over a set of labels including labels representing the possible types of polymer unit. Thus, the weights in respect of transitions represent posterior probabilities for those transitions. As there are more weight distributions 51 than polymer units, it is to be understand that in some representations a transition from a label to the same label is allowed and so the weight distributions 51 include a weight in respect of such a transition, i.e. the word“transition” does not imply that the label must change, nor does it imply that an additional polymer unit must be emitted.

Below various examples of a weight distribution 51 output by the RNN 50 are given. Each of those example refers to the case where the polymer units are polynucleotides and the types of polymer units are the four bases A, C, G and T. As discussed above, the present methods are equally applicable to larger numbers of types of polynucleotide and/or to polymer units that are not nucleotides, so these examples may be generalized accordingly. In each of the examples, the weight distributions 51 include weights representing transitions between labels. Thus, the weights are notated as Wjj, where i is an index for the label from which the transition occurs and j is an index for the label to which the transition occurs. Thus weight Wi j is weight for the transition from label i to label j. In each of the drawings, the rows correspond to the labels i from which the transitions occur and the columns correspond to the labels j to which the transition.

One example of such a configuration is an RNN configured with a number of feed forward elements in its output (final) layer that is equal to the number of weights in the weight distribution to be produced. Figs. 7-9 also provide examples showing a number of outputs from units of an RNN; it will be appreciated that any one or more of these configurations may be present within the RNN such that the number of outputs is equal to the number of weights in the weight distribution to be produced.

Figs. 10 and 11 show two examples of a weight distribution 51 that may be output by the RNN 50.

In the example of Fig. 10, there is a single label in respect of each of the four bases shown as A, C, G and T. All transitions are allowed, so there are a total of sixteen weights Wi j in respect of the 16 transitions from each of the labels to each of the labels.

The example of Fig. 10 does not provide a good representation of homopolymers, which are succession of plural polymer units of the same type within the series of polymer units. This is because a transition from a label to the same label does not distinguish between the same instance of the given type of polymer unit and a further instance of the given type of polymer unit. As a result, a series of transitions from a label to the same label represents a series of any number (one or more) of instances of a polymer unit (i.e. both a single polymer unit and a homopolymer of the same type of polymer unit of any length ).

However, Fig. 11 is an example that improves the representation of homopolymers by expanding the representation of Fig. 10 so that the set of labels includes (i) a single label each representing a different one of the four bases, and (ii) a label representing a blank in the series of polymer units. All transitions are allowed are shown in in the example of Fig. 11, so there are a total of 25 weights W j in respect of the 25 transitions from each of the labels to each of the labels. In this representation, a blank label represents a separation between two instances of a base (polymer units) in the series, even if they are of the same type.

Put another way, in the sequence of polymer units it may be the case that a window of data measurements is analyzed but in that data window no transition between polymer units is present. In this case, the transition may be represented as a transition from the prior label to a‘blank’ label, which represents that no new instance of a polymer unit was transitioned to in the window.

In some embodiments, blanks may be treated as compulsory, in that a blank must be present in the determined sequence of polymer units in order to treat polymer units on either side of the blank as being separate polymer units. For example, in the case of the following generated sequence of labels in which blanks are represented by a A A A - - A, this would be resolved to an actual sequence of polymer units = A A. Each of the first three instances of the“A” label are treated as being instances of the same actual polymer unit“A,” whereas the last“A” label is treated as distinct because it is separated from the first three “A”s by two blank labels.

In some embodiments, blanks may be treated as optional, in that a blank represents a spacer between polymer units and repetition of a label. For example, in the case of the following generated sequence of labels in which blanks are represented by a A A A - - A, this would be resolved to an actual sequence of polymer units = A A A A. Each of the first three instances of the“A” label are treated as distinct polymer units, and the blank labels act as a spacer between these units and the final“A” label.

This representation in the output of the RNN 50 using weights in respect of transitions between labels contrasts with Reference 1 wherein an RNN outputs posterior probabilities (a specific example of a weight) in respect of labels over a set of labels consisting of four labels representing each of four types of polynucleotide (i.e. bases C, G, A and T) and a label representing a blank. The representation using weights in respect of transitions between labels provides advantages over a representation using weights in respect of labels because additional information is provided that improves the accuracy of estimation of the series of polymer units. This is because the weights provide information on possible paths through the series of polymer units, whereas weights in respect of the labels themselves loses information on the relationship with other labels for the purposes of further analysis. Thus, additional information is provided to the step of estimating the polymer units, which improves the accuracy of the decoding.

In addition, the representation allows allowed and non-allowed transitions to be represented. That is, the labels may represent the possible types of polymer unit in a manner in which one or more of the transitions between labels is not allowed and other transitions are allowed. In that case, the weight distributions 51 comprising weights in respect of transitions that are allowed. The weight distributions 51 may comprise null weights in respect of transitions that are not allowed.

A null weight may be the absence of a weight in the weight distribution 51 output by the RNN 50. In the examples shown in the drawings, the null weights are illustrated by the absence of a weight, but the alternatives below may be applied instead.

Alternatively, a null weight may be a weight that is present in the weight distribution 51 output by the RNN 50, for ease of implementation of the RNN 50, but having a nominal value. Such a nominal value may be a value having a zero value or an insignificant magnitude so that it does affect the estimation performed by the decoder 80 as described below. Alternatively, such a nominal value may be a value that is present in the weight distribution 51 output by the RNN but ignored by the decoder 80, for example by using a transition matrix as described below.

Some examples of this are as follows.

A first example where allowed and non-allowed transitions occur is where the set of possible types of polymer unit includes a type of polymer unit that always appears in a known sequence of polymer units. In this case transitions in accordance with the known sequence are allowed and transitions contrary to the known sequence are not-allowed. An example of this for polynucleotides is that 5-methyl cytosine in vertebrates only occurs on cytosines that precede a guanine (“CpG”), and this can be used to further restrict the possible transitions and so fewer weights from the RNN 50 are needed. That is, CpG methylation results in methylated C (which will be represented herein as C M ) always being followed by G, so C M always occurs in the known sequence C M G. Fig. 12 is an example of a weight distribution 51 used to represent this. The weight distribution 51 is adapted from that of Fig.

11 to add a label representing methylated C to the four labels representing the four types of polynucleotide (i.e. bases C, G, A and T) and a label representing a blank. In this case, transitions from C M to A, C or T are not allowed, so there are null weights for those transitions, i.e. weights W6i , W62 and W64 are null in the weight distribution. This allows the RNN to provide better information about the methylated C base, which improves the accuracy of estimation of the methylated C base. Optionally, the weight of a transition from C M to C M can be null. This may be in the case of a stay. This is because although it can be identified during measurements said transition does not form part of a sequence because CpG methylation results in methylated C always being followed by G i.e. the sequence C M G.A further example of this is the flip-flop representation described below, wherein transitions from the modified-flip or modified-flop to guanine or modified-flop labels are allowed reducing the number of weights needed from the RNN 50 from 60 to 52 (c.f. 100 weights needed for all possible transitions). Aside from the reduction in the amount of network outputs needed, restricting the transitions to those that are possible prevents the method from producing estimates of types of polymer unit with modifications in impossible contexts which would be both errors in the estimate and false positive modification calls.

A second example is a representation where the set of labels are modified so that each type of polymer is represented by plural labels instead of a single label. For example, the set of labels may include a first and a second label in respect of each type of polymer unit, where the first label represents the start of an instance of the type of polymer unit, and the second label represents a stay in the instance of the type of polymer unit. As mentioned above, a “stay” represents a situation in which the method determines that the label associated with successive weight distributions does not change, which may be considered as two weight distributions corresponding to the same instance of a polymer unit. Herein, this example will be referred to as“multi-stay”. This improves the representation because a stay is represented by a different label. This improves the accuracy of estimation of the polymer unit.

This multi-stay representation has the consequence that some transitions are allowed and some are not. For example, a first label e.g.“A” is only allowed to transition into a second label e.g. A s in respect of the same type of polymer unit or into a first label of a different type of polymer unit. More specifically, the following transitions are allowed and not allowed:

a) transitions from each first label to the first label for any other type of polymer unit are allowed, and transitions from each first label to the first label for the same type of polymer unit are allowed;

b) transitions from each first label to the second label for the same type of polymer unit are allowed;

c) transitions from each first label to the second label for any other type of polymer unit are not allowed;

d) transitions from each second label to the first label for the same type of polymer unit or the first label for any other type of polymer unit are allowed;

e) transitions from each second label to the second label for the same type of polymer unit are allowed; and

f) transitions from each second label to the second label for any other type of polymer unit are not allowed.

The above illustrative multi-stay representation scheme may be considered ot be a “compulsory” scheme in a similar manner to the scheme of FIG. 11 in which blanks may be considered compulsory or optional as described above. As such, it will be appreciated that a similar scheme to the above may be envisioned for the multi-stay representation in which a first label is allowed to transition into the same first label. Such a scheme may be considered an“optional” multi-stay representation scheme.

Fig. 13 illustrates an example of a weight distribution 51 which is adapted from that of Fig. 10 to implement this type of representation. Thus, in Fig. 13, the set of labels includes four first labels in respect of the four types of base shown as A, C, G and T, and four second labels in respect of the four types of base shown as A s , C s , G s and T s . Herein, the superscript S (for“stay”) is used to distinguish the second labels from the first labels in respect of the same type of base, and represents a stay. As shown in Fig. 13, in view of the transitions that are allowed and not allowed, the following weights are present or null:

a) transitions from each first label (e.g. A) to the first label for any other type of polymer unit (e.g. C, G and T) are allowed, and transitions from each first label (e.g. A) to the first label for the same type of polymer unit (e.g. A) are allowed, so all the weights in the top left quadrant are present;

b) transitions from each first label (e.g. A) to the second label for the same type of

polymer unit label (e.g. A s ) are allowed, so weights in the top right quadrant wis, W26, W37 and W48 are present;

c) transitions from each first label (e.g. A) to the second label for any other type of

polymer unit (e.g. C s , G s and T s ) are not allowed, so weights in the top right quadrant other than wis, W26, W37 and W48 are null;

d) transitions from each second label (e.g. A s ) to the first label for the same type of polymer unit (e.g. A) or the first label for any other type of polymer unit (e.g. C, G and T) are allowed, so all weights in the bottom left quadrant are present;

e) transitions from each second label (e.g. A s ) to the second label for the same type of polymer unit (e.g. A s ) are allowed, so weights in the bottom right quadrant W55, W66, W77 and W88 are present; and f) transitions from each second label (e.g. A s ) to the second label for any other type of polymer unit (e.g. C s , G s and T s ) are not allowed, so weights in the bottom right quadrant other than W 55 , W66 , W77 and wss are null.

The multi-stay representation can be combined with the representation for methylated C set out above, or indeed with any similar representations for a type of polymer unit that always appears in a known sequence of polymer units.

Representations of homopolymers will now be considered. A homopolymer is a sequence of consecutive instances of polymer units of the same type in the series of polymer units.

Homopolymers are properly represented by the multi-stay representation discussed above because a transition from the second label (e.g. A s ) to the first label for the same type of polymer unit (e.g. A) represents a second instance of the same type of polymer unit. For example, a series of labels AA S A S AA S AA S A S AA S A S A S A S represents a homopolymer of length four polymer units, the number of consecutive labels A or A s being arbitrary and varying in practice. However, accuracy of estimation may be improved by adapting the representation so that the labels represent homopolymers in an encoded form, for example as follows.

A first representation of homopolymers in encoded form will be referred to as a“flip- flop” representation and is as follows.

One of the benefits of having the output of an analysis method being overlapping fixed length fragments is that amount of overlap can be used to determine if, and how many, translocations of polymer units have taken place. Methods of analysis relying on overlaps fail in low complexity regions of a polymer, like homopolymers, where the overlap may be ambiguous (e.g. AAA -> AAA may be zero, one, two or more translocations of the A homopoymer) and a different representation is desirable. In a flip-flop representation, the labels represent homopolymers by including plural labels for each type of polymer unit, wherein the plural labels for each type of polymer unit represent consecutive instances of the type of polymer unit in the series of polymer units. Typically, there are two labels for each type of polymer unit, which may be called“flip” and“flop” for ease of reference.

Thus, rather than decoding to fixed length fragments, the flip-flop method of decoding represents a sequence of polymer units as a sequence of“flip” and“flop” labels with the following restriction: homopolymers must start in the“flip” label and then alternate between“flip” and“flop” labels until they terminate. The flip-flop representation ensures that no label is ever the same as its neighbouring labels and so a translocation of one unit with a homopolymer (a change from flip to flop, or vice versa) is always distinguishable from no translocation (a flip to flip, or flop to flop). By way of example, the series of polymer units CAATACCTTTAAAAAAAAGAAACTTTTAGCTC is represented as CAA F TACC F TT F TAA F AA F AA F AA F GAA F ACTT F TT f AGCTC where the flip label for polymer unit X is represented by X and the corresponding flop label is represented by X F . Under the flip-flop encoding, a translocation of one is always distinguishable from no translocation; translocations of a greater number of polymer units may still be ambiguous. Thus, in terms of the labels represented by the successive weight distributions 51, if the two labels for the base A are A (being flip) and A F (being flop), then a series of labels

AAAAAAA F A F A F A f AAA represents a homopolymer of length three polymer units, the number of consecutive labels A or A F being arbitrary and varying in practice. There may in principle be more than two labels for each type of polymer unit, but two labels are sufficient.

The plural labels for each type of polymer unit may have a predetermined cyclical order. In an example of two labels for each type of polymer unit, flip and flop, the

predetermined cyclical order may be that the first polymer unit is always flip and thereafter flip and flop alternate. Thus, some transitions between labels are allowed by the

predetermined cyclical order and other transitions between are not allowed by the

predetermined cyclical order. There are null weights for transitions that are not allowed by the predetermined cyclical order in the weight distributions, whereas of course there are weights for transitions that are allowed by the predetermined cyclical order.

In the above example that the predetermined cyclical order is that the first polymer unit is always flip and thereafter flip and flop alternate, transitions from a flip of any given type of polymer unit to the flop of any other type of polymer are not permitted, and similarly transitions from a flop of any given type of polymer unit to the flop of any other type of polymer are not permitted.

Fig. 14 illustrates an example of a weight distribution 51 for this type of flip-flop representation. Thus, in Fig. 14, the set of labels includes four first labels (flip) in respect of the four types of base shown as A, C, G and T, and four second labels (flop) in respect of the four types of base shown as A F , C F , G F and T F . As shown in Fig. 14, in view of the transitions that are allowed and not allowed, the following weights are present or null:

a) transitions from each first label (flip, e.g. A) to the first label (flip) for all types of polymer unit (e.g. A, C, G and T) are allowed, so all weights in the top left quadrant are present;

b) transitions from each first label (flip, e.g. A) to the second label for the same type of polymer unit (flop, e.g. A F ) are allowed, so weights in the top right quadrant wis, W26, W37 and W48 are present;

c) transitions from each first label (flip, e.g. A) to the second label for any other type of polymer unit (e.g. C F , G F and T F ) are not allowed, so weights in the top right quadrant other than wis, W26, W37 and W48 are null;

d) transitions from each second label (flop, e.g. A F ) to the first label for all types of

polymer unit (flip, e.g. A, C, G and T) are allowed, so all weights in the bottom left quadrant are present;

e) transitions from each second label (flop, e.g. A F ) to the second label for the same type of polymer unit (flop, e.g. A F ) are allowed, so weights in the bottom right quadrant W55, W66, W77 and W88 are present; and

f) transitions from each second label (flop e.g. A F ) to the second label for any other type of polymer unit (flop, e.g. C F , G F and T F ) are not allowed, so weights in the bottom right quadrant other than W55, W66, W77 and wss are null.

Depending on the rate at which measurements are taken relative to the speed of translocation of the polymer unit, apparent translocation of more than one unit may be observed when the polymer translocates multiple times between measurements. Where this is a probable occurrence, additional redundant labels of each polymer unit (“flap”,“flup”, “flep”, etc) can be added so that the presence of additional units can be represented, For example, a sequence going from flip to flap implies the presence of an intermediate flop label.

A second representation of homopolymers in encoded form will be referred to as a run-length encoded representation and is as follows.

The flip-flop representation can call through long homopolymers but must do so as a path of alternating labels and make multiple connected calls. For longer homopolymers, the flattening of the observed signal may mean there is no longer a clear time when the signal changes due to the polymer translocating with respect to the nanopore and the position of each change in label becomes more arbitrary. Fig. 15 shows an example of this loss of specificity for an example region where the weights are split between T-flip or T-flop despite the cumulative evidence for both being high.

Thus, rather than represent a homopolymer as a sequence of alternating labels, instead the entire homopolymer can be represented by a label in respect of the type of polymer unit. Thus, rather than training the RNN 50 to call the canonical sequence or its flip-flop encoding, the RNN 50 is trained to call the run-length encoding of the series of polymer units. For example, the run-length encoding of the canonical sequence

TAATTCAAACTTTTTTTCTGATAAGCTGGT is TA 2 T 2 CA 3 CT 7 CTGATA 2 GCTG 2 T where the run-length follows the base and lengths of one are implicit. The longest possible run is always taken so no run is adjacent to a run with the same base.

In a first formulation of run-length encoded representation, the labels include labels for different run-lengths of each type of polymer unit. Fig. 16 illustrates an example of such a weight distribution. In this example, there is a single label in respect of the four bases shown as A, C, G and T and in respect of homopolymers of each base shown as A 2 , A 3 , etc. This is unwieldy as there are a large number of labels to accommodate all possible lengths of homopolymer and all transitions are allowed, except for a transition from label in respect of a homopolymer of one type of base to a homopolymer of the same type of base but of a different length, so there are a large number of weights vvv, in respect of most transitions between labels almost equal in number to the square of the number of labels (other possible transition schemes could alternatively be implemented).

Long homopolymers in large genomes occur more frequently than would be expected by chance, and so the number of labels needed to represent all homopolymer lengths that might be encountered during routine sequencing is extremely high. Since the weights output by the network are explicitly parameterising the transitions between homopolymer labels, training data becomes an issue both because of the large number of parameters that need to be trained and because they are weakly coupled. Shuffling the labels of the labels (e.g.

A6 A3, T2 T7, G8 G1) results in an equivalent model that can be trained to identical performance, so training examples of homopolymers of length 4 and 6 don’t inform the model about those of length 5.

An alternative and preferred formulation of a run-length encoding is to factor the weight distributions 51 into several dependent distributions. Thus, the labels include a label in respect of each type of polymer unit, and the weight distributions 51 comprise further weights over possible lengths of the run-length compressed homopolymer for each type of polymer unit, in addition to the weights in respect of transitions. Transition weights are emitted by the RNN 50 to describe a distribution over run-length compressed sequences, that is the run-length encoded sequence with all the lengths dropped, and a separate set of conditional distributions for the length of a run given the polymer unit.

In this preferred formulation of a run-length encoding, the weight distribution 51 output by the RNN may include weights in the form shown in Fig. 10 to represent transitions between different types of polymer unit. As discussed above, in this case a series of transitions from a label to the same label represents a series of any number of instances of a polymer unit (i.e. a single polymer unit or a hompolymer of the same type of polymer unit of any length).

As an alternative to that, this preferred formulation of a run-length encoding, the weight distribution 51 output by the RNN may be defined over a set of labels where each type of polymer is represented by first and second labels instead of a single label, for example labels A and A H in respect of a first type of polymer unit. Thus, the superscript H is used to distinguish the second labels from the first labels in respect of the same type of polymer unit, and effectively represents a“hold”.

This is similar to the multi-stay representation shown in Fig. 13, except as follows. As described above, in the multi- stay representation, transitions from a label of the second type to a label of the first type (e.g. from A s to A) is permitted and represents occurrence of a further instance of a polymer unit of the same type. As a result, a homopolymer is represented by a series of labels in which the label of the first type is repeated, as in the above example that AA S A S AA S AA S A S AA S A S A S A S represents a homopolymer of length three polymer units. In contrast, in the present representation, the allowed transitions differ so that transitions from a label of the second type to a label of the first type (e.g. from A H to A) is not permitted. As a result, a single instance of a type of polymer unit and a

homopolymer of any length of the same type of polymer unit are all is represented by a series of labels comprising a label of the first type and an arbitrary number of labels of the second type. For example A A H A H A H A H A H A H A H A H A H A H may represent a single base A or a homopolymer of the base A. Specifically, this is achieved as follows:

a) transitions from each first label to the first label for any other type of polymer unit are allowed, but transitions from each first label to the first label for the same type of polymer unit are not allowed;

b) transitions from each first label to the second label for the same type of polymer unit are allowed,

c) transitions from each first label to the second label for any other type of polymer unit are not allowed;

d) transitions from each second label to the first label for the same type of polymer unit are not allowed;

e) transitions from each second label to the first label for any other type of polymer unit are allowed;

f) transitions from each second label to the second label for the same type of polymer unit are allowed; and

g) transitions from each second label to the second label for any other type of polymer unit are not allowed.

Fig. 17 illustrates an example of such a weight distribution 51 which is adapted from that of Fig. 10 to implement this type of representation. Thus, in Fig. 17, the set of labels includes four first labels in respect of the four types of base shown as A, C, G and T, and four second labels in respect of the four types of base shown as A H , C H , G H and T H . As shown in Fig. 17, in view of the transitions that are allowed and not allowed, the following weights are present or null:

a) transitions from each first label (e.g. A) to the first label for any other type of polymer unit (e.g. C, G and T) are allowed, but transitions from each first label (e.g. A) to the first label for the same type of polymer unit (e.g. A) are not allowed, so weights in the two left quadrant are present other than wii, W22, W33 and W44 which are null;

b) transitions from each first label (e.g. A) to the second label (e.g. A H ) for the same type of polymer unit are allowed, so weights in the top right quadrant wis, W26, W37 and W48 are present;

c) transitions from each first label (e.g. A) to the second label for any other type of polymer unit (e.g. C H , G H , T H ) are not allowed, so weights in the top right quadrant other than wis, W26, W37 and W48 are null;

d) transitions from each second label (e.g. A H ) to the first label (e.g. A) for the same type of polymer unit are not allowed, so weights in the bottom left quadrant wsi, W62 , W73 and W84 are null;

e) transitions from each second label (e.g. A H ) to the first label for any other type of polymer unit (e.g. C, G and T) are allowed, so weights in the bottom left quadrant other than wsi, W62, W73 and ws4 are present;

f) transitions from each second label (e.g. A H ) to the second label for the same type of polymer unit (e.g. A H ) are allowed, so weights in the bottom right quadrant W55, W66, W77 and W88 are present; and

g) transitions from each second label (e.g. A H ) to the second label for any other type of polymer unit (e.g. C H , G H , T H ) are not allowed, so weights in the bottom right quadrant other than W55, W66, W77 and wss are null.

Thus, a series of labels for a polymer unit of a given type always starts with a single instance of the first label and then one or more instances of the second label. For example, any of the series of labels A, AA H , AA H A H , etc. (with any arbitrary number of labels A H ) represents a series of any number of instances of a polymer unit (i.e. a single polymer unit or a hompolymer of the same type of polymer unit of any length).

As mentioned above, the example of Fig. 10 does not provide a good representation of homopolymers, and the same is true of the example of Fig. 17. However, homoploymers are represented by the further weights over possible lengths of the run-length compressed homopolymer. There will now be described several possibilities for such further weights, each of which may be applied in combination with the weights in the form of Fig. 10 or in the form of Fig. 17.

A first possibility for the further weights is that they comprise a categorical distribution of weights over a set of possible lengths of the homopolymer for each possible type of polymer unit. The possible lengths are a category and the RNN 50 outputs assigns a weight to each category. In general, each category could represent a single homopolymer length, or some or all of the categories could represent a range of homopolymer lengths. Categories could include one representing all homopolymers greater than a given length. Categories need not be uniformly spaced.

Fig. 18 shows an example of such further weights in accordance with this first possibility. In this example, there is a weight h j for each possible length of each of the four bases A, C, G, T, the bases being indexed by the index i, and the lengths being indexed by the index j. In this example each category corresponds to a single length, but alternatively each category could correspond to a range of lengths to reduce the number of categories. The further weights shown in Fig. 18 form part of the weight distribution 51 together with the weights for transitions between labels, which may take the form as described above, for example as shown in any of Figs. 10 to 13.

A categorical distribution requires fewer parameters than fully specifying the transitions between all homopolymer labels and allows the underlying run-length compressed genome to be estimated, but still has the problem of weak coupling that make poor use of training data and makes long homopolymers difficult to train.

A second possibility for the further weights is that they comprise parameters of a parameterised distribution over possible lengths of the homopolymer for each possible type of polymer unit. Such parameters can be used to calculate the probability that a

homopolymer of a given polymer unit was any given length.

Fig. 19 shows an example of such further weights in accordance with this second possibility. In this example, there are weights pq for each of four types of bases shown as A, C, G, T and indexed by the index i. The weights indicate j parameters Pi, P 2 , ... , P j of the distribution which parameters are indexed by the index j. The parameters may be any parameters that represent a distribution. In general, j may have any plural value, depending on the distribution. The further weights shown in Fig. 19 form part of the weight distribution 51 together with the weights for transitions between labels, which may take the form as described above, for example as shown in any of Figs. 10 to 13.

By way of example, Fig. 20 gives an example of two different distributions for the homopolymer length represented, respectively, by different values of two parameters, mean and variance.

An advantage of using a parameterised distribution over homopolymer length is that the distribution can interpreted as a posterior distribution for the homopolymer length, allowing a confidence to be placed in the estimated length. For example in Fig. 20, both the distributions give the same posterior mean estimate of the homopolymer length but give a different confidence in it, the distribution with the higher variance (left) being less confident than that with the lower variance (right).

Since the predictions for different homopolymer lengths are all via the same set of network outputs, they are much more tightly coupled than before and allow the network to generalise from examples of one homopolymer to those of similar lengths.

Many different probability distributions could be used in conjunction with the output of the network. It is advantageous to select a distribution that is able to represent any homopolymer length that is likely to occur and so the distribution should have support over a large or even semi-infinite set of potential lengths. It is also desirable that there exist values of the parameters that represent both high confidence (low variance) and low confidence (high variance) in a given homopolymer length. Negative binomial or geometric distributions may be used, and cannot distinguish between the high and low confidence cases.

The variance of a geometric distribution is a function of the mean, the negative binomial has an additional degree of freedom, and its variance must always be greater than the mean. Distributions satisfying both these criteria can found by discretising a continuous distribution that has support over [0,¥] . One way of discretising would be set the probability of a homopolymer being of length L to the integral of the density function from L to L+l, alternatively L-0.5 to L+0.5 with appropriate treatment of L=0.

Preferably, the distribution that is discretised has an explicit cumulative density function. Examples of such densities are, but not limited to, Weibull distribution, Log- Logistic distribution, Log-Normal distribution, Gamma distribution. It is advantageous, but not necessary, if there are explicit expressions for the mean, mode and variance of the parametric distribution used or its discretised counterpart.

Fig. 21 illustrates some suitable discrete distributions for representing homopolymer lengths, all having support on N. G (a) is the Gamma function, g(a, b) is the incomplete gamma function, and <i>(x)is the cumulative distribution of the standard normal distribution.

In each of the first and second possibilities, the further weights are defined for each possible type of polymer unit, i.e. the possible type of polymer unit of the homopolymer. While this is effective, further improvement may be provided by a modification in which the further weights (a) for possible pairs of the type of the given polymer unit and the type of the preceding polymer unit, (b) for possible pairs of the type of the given polymer unit and the type of the following polymer unit, or (c) for possible triplets of the type of the given polymer unit, the type of the preceding polymer unit, and the type of the following polymer unit.

With this modification, the weights take the same form, for example a categorical distribution of weights over a set of possible lengths of the homopolymer in accordance with the first possibility or parameters of a parameterised distribution over possible lengths of the homopolymer in accordance with the second possibility, but the number of weights is increased. For cases (a) and (b), the number of weights is increased by three times, so as to define distributions for each possible pair instead of each possible type of polymer unit, for example for 12 pairs of bases {(A,C), (A,G), (A,T), (C,A), (C,T), (C,G), (G,A), (G,C),

(G,T), (T,A), (T,C), (T,G)} instead of for 4 types of base {A, C, G, T}. By way of example, Fig. 22 shows an example of such further weights that comprise parameters of a

parameterised distribution over possible lengths of the homopolymer defined for each pair of types of polymer unit. This corresponds to cases (a) and (b), the pairs being in case (a) the given polymer unit and the type of the preceding polymer unit, and in case (b) being the type of the given polymer unit and the type of the following polymer unit. The form of the parameters themselves is the same as for Fig. 19 and can be used in the same way to calculate the probability that a homopolymer of a given polymer unit was any given length.

Similarly, for case (c), the number of weights is increased by nine times, so as to define distributions for each possible triplet, for example for 36 triplets of bases instead of for 4 types of base. By way of example, Fig. 23 shows an example of such further weights that comprise parameters of a parameterised distribution over possible lengths of the

homopolymer defined for each triplet of types of polymer unit. This corresponds to case (c), the triplet being the given polymer unit, the type of the preceding polymer unit, and the type of the following polymer unit. The form of the parameters themselves is the same as for Fig. 19 and can be used in the same way to calculate the probability that a homopolymer of a given polymer unit was any given length.

This modification improves the accuracy based on an appreciation that the ability to discriminate of the edges of long homopolymers may vary in dependence on the preceding and/or following polymer units. For example, a transition from a base T to a homopolymer of base A is much easier to discriminate than a transition from a base C to a homopolymer of base A. Thus, the provision of different further weights representing the distributions for the various pairs or triplets provides a representation that may estimate the polymer units more accurately.

Similar factoring of the weight distributions 51 into several dependent distributions may be used to represent other properties of the polymer. One example is the representation of a type of polymer unit that has unmodified and modified forms, for example a

polynucleotide that may include a type of base and a modified type of the same base.

Natural strands of DNA contain modified bases, for example 5-methyl cytosine or 6- methyl adenine, and their presence and location are detectable using a series of nanopore measurements. The flip-flop and other representations readily generalize to being able to call modifications by extending the set of labels from the bases A, C, G and T to include an additional label to represent the modified bases, for example C M to represent a modified C.

Fig. 24 shows an example of the weight distribution where the set of labels is expanded to additionally include a label C M in respect of a modified base. Similarly, an additional label C M may be added to the set of labels in any of the weight distributions 51 shown in Figs. 10, 12 to 14, or 16.

This expansion of the alphabet of labels can also be used with previous methods described in the art, which assume that the signal at particular time can be represented by a fixed length fragment of bases, but these scale poorly as the number of modifications considered increases as the network must have an output for each possible transition between bases of the fixed length. For example, there are 1024 possible combinations (4 5 ) for fragments of length 5 consisting of the four canonical bases, 3125 (=5 5 ) if an additional modified base is allowed, and 7776 (=6 5 ) if two modifications are allowed. There are over a hundred modifications know in RNA and so fragment based models require amounts of processing that quickly increase.

The unmodified form of a polymer unit may be described as a canonical polymer unit and the modified form of a polymer unit may be described as a non-canonical polymer unit.

A modified (or non-canonical) polymer unit typically affects a signal differently from a corresponding unmodified (canonical) polymer unit.

International Patent Appl. No. PCT/GB2019/052456, filed 4 September 2019, to which reference is made and which is incorporated herein by reference, contains teachings relating to canonical and non-canonical bases which may be applied to any of the present methods disclosed herein.

International Patent Appl. No. PCT/GB2019/052456 discloses examples of non- canonical bases that may be applied in any of the present methods.

International Patent Appl. No. PCT/GB2019/052456 also discloses methods of preparing and analysing a polymer comprising one or more non-canonical polymer unit that may be used in combination with any of the present methods.

By way of non-limitative example, one method disclosed in International Patent Appl. No. PCT/GB2019/052456 which may be combined with any of the present the present methods is to convert a proportion of canonical polymer units (e.g. amino acids) to a corresponding non-canonical polymer unit (e.g. amino acid) in a non-deterministic manner, e.g. by chemical conversion or by enzymatic conversion. In that case, when deriving an estimate of the series of polymer units (“calling”), the non-canonical bases may be estimated (“called”) as being the corresponding canonical base. This includes the methods described with reference to Figs. 18b-18k of International Patent Appl. No. PCT/GB2019/052456.

Because of the non-deterministic incorporation of canonical and non-canonical polymer units into the target polymer, the underlying sequence of polymer units is not known and will vary on a strand-to- strand basis. Even though each strand contains alternative polymer units, there is still an associated canonical sequence, and it is of interest to call this directly rather than attempting to infer the type and location of any alternatives. In other words, despite there being additional polymer units in the target polymer, the analysis only attributes canonical values to the signal such that the determined sequence consists of bases from the group of A, C, G and T. In this manner, by recognising a non-canonical polymer unit as a canonical polymer unit in the analysis, the initial conversion can provide a way to provide a signal with more information, for example having a consequence that any errors present in the analysis of the signal will be non-systematic, thereby leading to an

improvement in the accuracy of the estimation.

Flip-flop, and similar representations, are much more tractable since the number of weights output from the RNN 50 required at each time point to parameterize the transition weight scales quadratically with the number of modifications rather than as a power equal to the fragment length (40 outputs for 4 canonical bases, 60 for one additional modified base, 84 for two, etc).

When the neural network 10 uses a flip-flop representation, the training is performed to maximise the probability of the correct sequence, for each reads it produces a conditional random field that must be further decoded to produce an estimated sequence. The method of decoding used can introduce unwanted biases in the final call that reveal themselves in bulk metrics, like the total number of bases called read or summary statistics of its composition. Further biases may be apparent when estimated sequences from reads of strands with the same sequence, or containing a common subsequence, are considered in aggregate.

To reduce this issue, penalty terms may be incorporated into the trained neural network 10, adjusting its output to improve performance on metrics of interest: for example, subtracting a constant from all weights corresponding to not emitting a new polymer unit (flip-flip in the same base, or a flop-flop transition) will increase the number of polymer units called, whereas the proportion of a particular polymer unit can be increased by adding a constant to all transitions that end in emitting a new polymer unit of that identity.

The value of the penalty terms used can be tuned by calculating the metrics of interest for a representative set of reads over a grid of values, alternatively more formal optimisation methods like the simplex method, or the many others known to the art, could be used. Rather than a fixed constant, the penalty term could be a function of prior information about the read.

Penalty terms can be incorporating into the neural network 10 at any layer, but it is preferable to incorporate them into the final layer where possible, directly affecting the transition weights emitted, as this has advantage that the effect on the final estimated sequence can be intuited and so guide the form the penalty.

To retain the interpretation of the output of the neural network 10 as a probabilistic model, it is desirable, but not essential, that penalties are incorporated before“global normalisation” is performed.

Often, accurately determining the sequence of canonical bases and the presence of any modification are both of interest and it is undesirable for an attempt to estimate a modification to adversely affect the estimate of the underlying canonical sequence. One example of how this may occur is the splitting of weight between canonical cytosine and 5- methyl cytosine, so another base becomes the most likely estimation.

To prevent weight splitting behaviour, the weight distributions 51 output by the RNN can be factored into two dependent distributions. In this case, the first distribution is a weight distribution 51 taking any of the forms described above a single label representing the type of polymer unit that has unmodified and modified forms, and the second distribution is a conditional distribution comprising further weights for the unmodified and modified forms. This representation may be expanded for any number of modified forms and for modified forms of any of the possible types of polymer unit.

Fig. 25 shows an example of the further weights for representing an unmodified form of the base C and a modified form of the same base C M . In this case, the further weights are a weight mi in respect of the unmodified form of the base C and a weight m2 for the modified form of the base C M . This may be applied instead of the weight distribution 51 of the type shown in Fig. 24. The further weights form part of the weight distribution 51 together with the weights for transitions between labels, which may take the form as described above, for example as shown in any of Figs. 10 to 14, or 16.

This factored representation means that the canonical sequence can be determined as if modifications were not present and then the location of any modification can be determined afterwards. The conditional distributions for modification may themselves be factored perhaps reflecting prior biological expectation. For example, one distribution might represent whether or not a cytosine is modified and other might represent that, given modification is present, whether that modification was 5-methyl cytosine or

5 -hydroxymethyl cytosine.

As an example, Fig. 26 shows bases predicted by the output of the RNN 50 when employing a flip-flop representation of four bases that has been extended in this manner to detect a modified base 5mC. In this example, the modified base 5mC is estimated at three positions, at locations in agreement with external predictions.

As mentioned above, the weight distributions of the RNN 50 are normalised globally. Such a global normalisation may be over all paths of labels through the series of weight distributions so that the sum over all possible paths is one. The global normalisation may be over the output space such that the weights can be considered as posterior probabilities.

Global normalisation is strictly more expressive than local normalisation and avoids an issue known in the art as the‘label bias problem’.

The advantages of using global normalisation over local normalisation are analogous to those that Conditional Random Fields (Lafferty et al., Conditional Random Fields:

Probabilistic Models for Segmenting and Labelling Sequence Data, Proceedings of the International Conference on Machine Learning, June 2001) have over Maximum Entropy Markov Models (McCallum et al., Maximum Entropy Markov Models for Information Extraction and Segmentation, Proceedings of ICML 2000, 591-598. Stanford, California, 2000). The label bias problem affects models in which the matrix of allowed transitions between labels is sparse, such as extensions to polymer sequences.

Global normalisation alleviates this problem by normalising over the entire sequence, allowing transitions at different times to be traded against each other. Global normalisation is particularly advantageous for avoiding biased estimates of homopolymers and other low complexity sequences, as these sequences may have different numbers of allowed transitions compared to other sequences (it may be more or fewer, depending on the model).

The decoder 80 will now be considered.

The decoder 80 derives an estimate of the series of polymer units from the weight distributions 51. This may be done using connectionist temporal classification, for example as disclosed in Graves et al.,“Connectionist temporal classification labelling unsegmented sequence data with recurrent neural networks”, In Proceedings of the 23rd international conference on Machine learning, 369-376 (ACM, 2006).

The decoder 80 performs three steps as shown in Fig. 27, as follows.

In step S 1 , an estimate of a label is derived in respect of respective weight distributions 51. This estimation is discussed further below.

In step S2, the labels derived in step S 1 are run-length compressed to derive an estimate (which can also be termed as decoding) of the series of polymer units. This is needed because there are more weight distributions 51 than polymer units. Run-length compression produces the estimates of the polymer units because consecutive sequences of the same label represent the same polymer unit in the representation of the polymer inherent in the RNN 50, as described above.

Step S2 also takes account of representations where plural labels are used to represent a given type of polymer unit. For example in the multi-stay representation describe above, the second labels are compressed into the first label in respect of the same type of polymer unit. Similarly, in the flip-flop representation described above, consecutive instances of the first label (flip) are compressed into a single polymer unit, and consecutive instances of the first label (flop) are compressed into another single polymer unit, and so on, thereby providing an estimate of a homopolymer.

For example, in the scheme of FIG. 11, decoding blanks to distinguish between instances of the same polymer units may be performed in step S2. As discussed above, ‘optional’ and‘compulsory’ schemes may be considered for blanks, so step S2 may decode a sequence of labels: A A A - - A to either A A A A, or A A depending on which of the two schemes are followed. In the case of a flip-flop scheme, step S2 may comprise collapsing multiple runs of the same label to a single corresponding polymer unit. For example, a sequence of labels CAA F TACC F TT F may be decoded in step S2 to the series of polymer units CAATACCTT.

With respect to a multi-stay scheme, step S2 may comprise decoding by identifying consecutive sequences of the same label as different polymer units of the same type. For example, a sequence of labels AA S A S TT S CAA S A S may be decoded in step S2 to the series of polymer units ATCA.

With respect to a run length encoding scheme, step S2 may comprise decoding by collapsing runs of the same label (and dropping blanks if necessary in the scheme). For example, a sequence of labels TA 2 T 2 CA 3 may in step S2 can represent the series of polymer units TAATTCAAA.

Step S3 is performed in the case that the weight distributions 51 are factored into dependent distributions, but otherwise omitted. In this case, steps S I and S2 are performed using the weights in respect of transitions, and in step S3 the further weights are used to estimate the quality of the polymer unit represented thereby. For example, in the run-length encoded representation described above, the further weights are used to estimate the length of the homopolymer. Similarly, in the factored representation of modified forms described above, the further weights are used to estimate whether the polymer unit is of the unmodified or modified form.

The estimation of labels in step S I will now be discussed. As the weights represent posterior probabilities of the respective transitions, the weights may be used to derive posterior probabilities for any given path of labels through the weight distributions 51, that is by combining the posterior probabilities represented by the weight for the series of transitions corresponding to the path in question. This means that the weights allow the likelihood of different paths to be considered which improves the accuracy of estimation. Therefore, step S 1 applies a technique that is based on consideration of combined weights for transitions in respect of paths of labels through the weight distributions 51.

Where one or more transitions is not allowed (as discussed above), the estimation performed by the decoder in step S 1 may take into account a transition matrix representing whether transitions between labels are allowed or not allowed.

Two different approaches are possible, which will be referred to as“best path” and “best label”.

In the best path approach, the most likely path of labels through the series of weight distributions 51 on the basis of the weight distributions 51. In this case, the labels derived in step S 1 in respect of the respective weight distributions 51 are the labels of that most likely path.

As the weight distributions 51 are weights over transitions, one way of decoding to estimate a sequence is to find the path that has the maximal sum of weights. Such a path can be found in an efficient manner from the transition weights, for example using a dynamic program algorithm. The Viterbi algorithm may be used.

For example, Fig. 28 illustrates a best path algorithm where the RNN 50 outputs a weight of w' jk to the transition from label j to label k at block i. The vectors t 1 store the traceback information, which is the best label to have come from the given current label, and is used to determine the score S and best path P.

For run-length encoding, the best path found is for the run-length compressed sequence and the length of each run needs to be determined from the appropriate conditional distribution output from by the RNN 50. Where the best path shows that a new polymer unit has occurred, the length of the run is estimated from the conditional distribution

corresponding to that polymer unit. Appropriate ways of making this estimate include finding the mean (with rounding), mode or median of the conditional distribution; given a suitable prior, the length with the maximal Bayes factor could also be used. Where a network outputs conditional distributions representing the possible base modifications that might be present, the process for marking up the best path with their presence proceeds similarly albeit that posterior mean and median are not sensible estimators since modifications are categorical rather than ordinal.

For run-length encoding, a run-length bias correction may be applied. Since the model is trained from real reads, there is some prior distribution of run lengths learned and incorporated into the weights of the model. For reads derived from random strands or real (e.g. genomic) strands, there is a remarkable skew in the proportion of runs of different lengths that the training data will contain, for example long runs are extremely rare. This has implications for the ability of the method to call long runs. There is ambiguity in the length of a run, calling short will be correct more often than calling long and so the maximizing single-read accuracy tends to lead to calling runs short. As such, there is benefit in applying a bias correction towards relatively short run-lengths.

Having found the most probable path, a sequence of canonical bases must be derived. For the flip-flop representation, adjacent repeats of a label are merged since they perform the same spacing role as blank labels in other CTC-like models and then the flip or flop identity of each label is scrubbed to leave the canonical base. For run-length encoding, the blank labels are dropped, and each run is expanded out into the appropriate number of bases.

The best label approach will now be discussed, noting that the best path approach may erroneously estimate some particular labels inaccurately where the correct label is not on the most likely path. The weight distributions 51 from the RNN 50 effectively define a probability distribution over all possible paths of labels, consistent ways of assigning labels to positions, and each path corresponds to a series of labels and hence polymer units although this correspondence is not unique (there may be many paths giving the same sequence). The best label approach improves over the best path approach by estimating the series of labels (and hence polymer units) that are most likely. That is, rather than finding the best path, the posterior probability that the path was in label j after time step i can be found by summing over all paths that satisfy this condition. This may take into account forwards and backwards paths of labels through the series of weight distributions 51. In this case, the labels derived in step S 1 in respect of the respective weight distributions 51 are the labels thus derived as most likely.

Dynamic programming both forwards and backwards in time allow this calculation to be performed in an efficient manner using a recursion similar to that for the best path; where the best path algorithm can be seen as a form of Viterbi decoding, the calculation of posterior probabilities can be seen as a form of the Forward and Backward algorithms. Similarly, the posterior probability that there was a change of label at time step i can be calculated by summing over all paths satisfying this transition; this calculation can also be performed in an efficient manner.

While the posterior probabilities are informative about the likely label at each position, decoding by picking the mostly like label can result in an inconsistent path and so sequence. By defining a transition matrix T from one label to another whose entries are either one or zero depending on whether the transition is allowed, the best-path decoding algorithm can be applied to these posterior probabilities to find the path that maximises the sum of the posterior probabilities of its labels from all consistent paths.

As an example of this, Fig. 29 illustrates such an algorithm applied to the posterior probability pT of being in label k at position i. The vectors ti store the traceback information, which is the best label to have come from given current label, and is used to determine the score S and best path P.

Alternatively the best-path algorithm can be applied to the logarithm of the posterior probabilities to find the path that maximises the sum of the logarithm posterior probabilities of its labels over all consistent paths. This is equivalent to finding the path that maximises the product of the posterior probabilities of its labels over all consistent paths.

As an example of this, Fig. 30 illustrates such a best path algorithm applied to the logarithm posterior probability pT of being in label k at position i. The vectors h store the traceback information, which is the best label to have come from given current label, and is used to determine the score S and best path P.

Alternatively, since the weight distributions 51 are defined over transitions, the forwards and backwards algorithms can be used to calculate posterior probabilities for the transition taken between positions rather than the label at each position.

As an example of this, Fig. 31 illustrates calculating the posterior probabilities summing over all paths. Since these weights are over transitions, they have the same shape as the transition matrix and their logarithm can fed into the equations defined in Fig. 28 instead of the transition weights to find a consistent path.

One of the more successful approaches to generating a consensus sequence from a number of signals covering the same region of a genome is referred to as‘polishing’ and has been described in several publications. Polishing a consensus sequence is an iterative process where candidate changes to a draft consensus sequence are scored by how well all of the reads match them and high scoring changes are kept, allowing mistakes caused by one read to be corrected by the others; this procedure is repeated until no more high scoring changes can be found.

What is not obvious is that polishing can also be beneficially applied to a single-read. All the approaches to estimating the polymer units described in the previous subsections aim to find a good path, through the network outputs, from which a sequence of bases can be extracted, but the registration-free training objective sums over all paths for a given sequence rather than identifying a single path as good. To be consistent with the training criterion, the output from the RNN 50 should ideally be decoded by finding the most probable sequence, summing over all paths that result in the same sequence, rather than most probabe path. Summing over all paths for a given sequence is the criterion that polishing uses to assess whether a candidate change is good and so polishing can be thought of as an iterative heuristic, a variant of greedy hill climbing, to find the most probable sequence.

In cases of analysing plural series of measurements that are measurements of series of polymer units that are related, then the method is fundamentally the same, but the

measurements from the plural series of measurements are treated as being arranged in plural, respective dimensions. This increases the dimensionality, but the form of the neural network 10 is otherwise the same as described above. Some further considerations that are applicable in this case are as follows.

When using a penalty term, as an alternative to the penalty for not emitting being constant for all transitions, the penalty could take a different value depending on transition or be absent entirely. For example, some transitions result in no change to the state and may be free, or have a small penalty, since they don’t imply a missed state in the other read.

The penalty, or penalties, used need not be the same for each read and there may be good biophysical reasons why the two reads may have different characteristics. For example, one read may be from a molecule that was double-stranded above the motor whereas the other was single stranded; alternatively, the two reads may be strands with different motors; one read might be DNA whereas the other might be RNA; alternatively, the two reads may be the first and second parts of the same forward-reverse-complement strand and

hybridisation between the two during sequencing changes the kinetics.

The penalty, or penalties, used could be time-dependent. The penalty, or penalties, used could be dependent on local statistics of the read. Examples of this include: speed, presence of a stall, or noise. The penalty, or penalties, used could be dependent on the output of an analysis of the read using other models or techniques, predicting the likelihood of slipping (missing bases) for example.

The state transition models of both a flip-flop representation and a RLE representation have a time ordering and reversing the order of states may not be a valid sequence of states. That is, in RLE representation a base must be emitted before staying, and a flip-flop representation requires that the first base of any repeat must be a‘flip’ . A consequence of this is that, where one of the reads is from a strand (or part of strand) that is the reverse complement, or reverse, of the other, it is not sufficient to reverse one of the reads before analysis and apply the same procedure as for two forwards reads.

While a more complex procedure could be used to combine reads in two different direction, keeping track of the state of both reads as a pair, it is advantageous to use the standard model on one read and, on the other, one that that has been trained 'backwards’— during training the signal from the read and the target sequence are reversed (and possibly complemented). The use of such a pair of models ensures that both the forward and reverse reads go through the states of the model in the same order and so can be combined as if they were both forwards reads.

The neural network 10 may be trained using conventional techniques, for example as follows. The neural network 10 outputs a distribution representing weights representing probabilities over paths of labels (consistent labelling of measures with a label) which is then decoded into an estimate of the sequence of polymer units. The neural network 10 is trained with a criterion that aims to ensure that this estimate has a low proportion of errors.

An important aspect of defining a probability distribution over paths using transition weights is that the weights must be normalised such that the sum over all paths is 1. Given a set of transition weights, the normalisation factor can be calculated using dynamic programming by applying the forwards algorithm (or backwards algorithm) as used in the calculation of posterior probabilities as discussed above. Since it is the sum of all possible paths that is normalized to 1 rather than the output of the network at each point in time, this technique is referred to as global normalisation and ensures that the score for each path has interpretation as a (logarithm of a) probability. Every path, which has consistent labels, corresponds to a probability and these probabilities form a distribution over all paths.

In contrast to global normalisation, normalizing the neural network 10, so that the output at every point in time sums to 1, is referred to as local normalization. The score for each path can be calculated and has the form of a probability but they do not form a distribution since the total probability mass is less than 1. Local normalization assigns probability to all sequences of labels, regardless of whether they form a consistent path.

The training for sequence labelling requires training examples, that is pairs of input signals and their corresponding sequence of labels, as well as an objective function to optimize over the training examples. Since the true registration between the nanopore measurements and the sequence of polymer units is unknown, registration-free training methods like those described in Graves et al. (2006) are preferred. Where registered training methods require each element of the sequence of measurements to be labelled, registration- free methods only require the true sequence of polymer units to be known. The true sequence of polymer units for a read can be determined by measuring polymers of known sequence in the nanopore device or comparing the reads to a reference sequence or set of measurements with known sequence.

Examples of measurements of known sequence may include small genomes, where it is possible to sequence the complete genome in a single read such as lambda phage (50 kilobases). Restriction digests may also be used, and fragments identified by their length. Another example involves adding known fragments sequentially to a run, which are therefore identifiable by the time at which they appear in the data. It will be apparent that any method that can assign sequence to signal reads may be used. When training the neural network 10, it is beneficial to have measurements spanning each polymer unit in a variety of contexts, and over a variety of experiments, so the network has been exposed to much of the full range of variation it will encounter under normal running conditions. Ideally, The neural network 10 is trained using complete reads i.e. pairs of signal and sequence that cover full length polymers, as read by the nanopore. However, for practical considerations (compute time, memory), it is typical to operate over smaller chunks of signal and sequence.

Recurrent, convolutional and attention neural network units have a concept of time order and the size of the window of measurements presented in training limits the context that can be learnt from. Because of the large range of influence each polymer unit can have, it is beneficial to present the neural network 10 with a large window of measurements to train from. The size of the window used is a balance between presenting a sufficiently large sequence of measurements that the neural network 10 can create an adequate internal representation of the interaction between the pore, the polymer strand and the other system components, and the amount of computational power available. Ideally the entirety of each read would be used, but in practice fixed sized chunks of measures present a good

compromise. The size of chunks that are adequate depend on the nanopore, and the rate of translocation of the strand, but a chunk size corresponding to around 200 to around 300 bases has proven adequate. For example, this has proven adequate for a CsgG nanopore.

An example training set size may comprise ~ 1 million sets of -300 base chunks of signal and sequence. Smaller training sets of only a few thousand chunks may be sufficient, and larger training sets > 1 million chunks may provide more diversity for the training.

Many techniques of training a neural network, or other machine learning method, are known to the art and may be applied here. Since the ability of the method to generalize to different experimental runs and polymer sequences benefits from a large set of training data, it is often impractical to seek to maximize the objective function direction as it is preferred to perform the calculations on Graphical Processing Units (GPUs), or other specialized hardware, are memory limited. Rather than directly maximize the objective function over the full set of data, it is preferred to approximately maximize it using Stochastic Gradient Descent (SGD), or related techniques, in an iterative fashion using subsets (“minibatches”) of the full training set. The minibatch size preferred depends on the available memory on the computational device used and the number of measures in each element of the minibatch.

Many variants of Stochastic Gradient Descent (SGD) are known to the art, for example: SGD, SGD with momentum, SGD with Nesterov momentum, RMSprop, AdaMax, Adam. A modification of Adam,“Adamski”, in which the momentum for iteration N increases by a momentum ramping factor r from 0 to a maximum value m. where m N = m (1— e ~rN ), is preferred. Adamski has a learning rate, two smoothing parameters (often referred to as decay 1 and decay2 in the art) and a momentum ramping rate. Many choices of these parameters are beneficial. The preferred parameterization has an initial learning rate of 10 3 , smoothing parameters of 0.9 and 0.999 and momentum ramping factor of 0.005.

Smoothing parameters of 0.95 and 0.99 have also proven effective for refining an already trained model, as has dropping the initial learning rate to 10 4 .

SGD and related techniques proceed iteratively, each iteration consisting of the following steps:

1. Pick a subset of the full training data.

2. Calculating the objective function for this subset

3. Calculate gradient for all network parameters using backpropagation

4. Update network parameters using SGD or variant

5. Go to 1 (start of next iteration)

The size of the update in step 4 is scaled by a factor known as the learning rate. A high learning rate means the parameters can change rapidly, and so maximization can proceed more quickly, but the effect of each minibatch can be large, meaning that updates when the model is close to convergence can be dominated by minibatch to minibatch variability. It is preferred to slowly reduce the learning rate from iteration to iteration; this reduction can be dynamic, adjusting to the learning rate according the change and variability of the objective function from batch to batch, or according to some predetermined schedule. For preference, a hyperbolic decay is used where the learning rate for the N th minibatch is R / (1 + (N / K)) for some initial learning rate R and number of minibatches K.

While summation has been used to combine the score for each member of the minibatch together into the score for the minibatch, other methods of combination are possible. Summation results in a minibatch score that is proportional to the mean of the scores of its constituent elements, combinations corresponding to other measures of central trend also have favourable properties. Combinators such as the median, trimmed or weighted mean, or fitting an M-estimator can be used to change the sensitivity of the objective to minibatch elements with outlier values.

The contribution from each element of the minibatch to the total score is the

(logarithm of the) posterior probability of the true sequence summed over all consistent paths. For the flip-flop representation, transitions of flip-to-flip or flop-to-flop represent staying in the same position of the sequence whereas all other transitions involve a move of a position. Given weights representing transitions between labels output from the RNN 50 at each time point, these can be converted into transition weights between positions of a known sequence.

Fig. 32 shows how to construct the elements of the objective transition matrix mi for each time point i for a flip-flop encoded sequence of labels Si , S2 , ... , SN. The objective function, described in Fig. 33 uses this objective transition matrix to calculate the score for each element of the minibatch.

Since the transition matrix for the objective function is extremely sparse, only having non-zero elements on the diagonal (stay) and super-diagonal (move on position), the preferred embodiment of this calculational only ignores the zero elements and reduces the apparent complexity of each step, in terms of the length of the true sequence, from quadratic to linear.

The objective function for the multi-stay representation is structurally similar to the flip-flop objective but the states representing staying in the same position are different. A transition from a stay or non-stay state to any non-stay state implies a change of position; any transition to stay state does not. For the multi-stay representation, the transitions

representing staying in a new position (base to stay transition) and staying in an old position (stay to stay transition) are distinguished and efficient calculation of the objective function requires the use of a duplicate set of“remain” positions for the true sequence: Si , Ri , S2 , R2 . . . , SN , RN.

Fig. 34 shows how to construct the elements of the objective transition matrix for this example. For the purposes of forming the objective transition matrix, the original positions are enumerated 1... N, whereas the corresponding duplicated positions are enumerated N+l

... 2N.

The objective function described in Fig. 33 uses this objective transition matrix to calculate the score for each element of the minibatch. The objective transition matrices are sparse and the preferred embodiment of the objective calculation takes advantage of this sparsity.

Each score could be multiplied by a weight before being used in the objective function, and this weight may represent the value of the corresponding element of the minibatch to the training process. The weight may, for example, be larger for elements with an unusual sequence composition or one that is known to be involved in base calling errors, which may be found during testing of previously trained network. One method of determining a weight for an element of the minibatch is set it equal to the inverse of the frequency of its rarest homopolymer, the frequencies determined from the whole of the set of training data or from other external reference.

The objective for run-length encoding is defined similarly to that for multi-stay model but an additional factor incorporated whenever a new sequence position is transitioned to representing how well the length of the run is predicted by the corresponding conditional distribution output by the network. The form of the objective transition matrix over the run length compressed sequence has the same form as that for the many stay objective, the restriction that no base can follow the same base being implicit in the allowed transitions between positions, but with an additional component from the log-probability that the network assigns to the length of the homopolymer at each position given its composition.

When the homopolymer content of the training data is known to be skewed, it can be undesirable in many applications for the network to learn this skew since it may not be representative of other sets of data. Instead of using the log-probability that the network assigns to the length of the homopolymer at each position given its composition directly in the training objective, it can first be combined with another distribution; this other distribution could be obtained by tabulating frequencies of homopolymers from the training data (“training prior distribution”). By training in this manner, the network must learn to assign log-probabilities that overcome the expectations of the training prior distribution.

For the purposes of basecalling, the prior distribution from the training data, or any other expectation of homopolymer lengths, could be combined with the log-probability assigned by the network using standard methods, such as Bayes theorem, to produce a new log-probability informed by external information about the homopolymer length;

alternatively, the log-probability from the network could be used directly for an unbiased call.

Fig. 35 shows how to construct the elements of the objective transition matrix for this example. Letting the logarithm of the probability that the network assigns to a run of length L j with compositon S j for position j of the sequence at time step i of the measurements be FSpL j . The objective function described in Fig. 33 uses this objective transition matrix to calculate the score for each element of the minibatch.

While the advantages of training basecalling models in a registration-free manner are numerous, there is a disconnect between most of the decoding algorithms presented and the training objective used. The objective function for model training is to maximise the probability of the true sequence of bases, summing over the probabilities of all the individual paths that could represent it, whereas all of the decode routines, other than polishing as described above are looking to find a path with a high score. Fig. 36 shows one of the issues caused by this disconnect. In particular, Fig. 36 shows the signal (top) and posterior probabilities (bottom) of being in a particular label over time for an example of a flip-flop representation, in case where there is a long homopolmer region between times 2410 and 2600, approximately, where the models stays in the T-flop state (red dashed line) rather than alternating with the T-flip state (red solid line). Having entered a long homopolymer, estimates are made around the start and end of the region but the flip and flop states quickly become less distinct and the posterior probabilities even out. There are multiple paths through the region where the registration of the flip and flop bases are slightly different and the posterior probabilities reflect an average of this ensemble.

One possible alternative is using the score of the best path as a training objective, rather than summing over all paths, and this would still be registration-free method since no registration is explicitly defined and, unlike labelling, the best registration may change as the model does. While training to the best path seems intuitive, this approach fails quite drastically when training a model from scratch since the initial poor model has a bad best path and the training process reinforces to it.

Sharpening is a way of focusing the training towards a single path, without having to specify that registration in advance, while still considering all other possibilities. Firstly, consider the algorithms for calculating the score for the sum over all-paths (Fig. 33) and that of the best-path (Fig. 37). Both of these apply a functor, log exp and max j respectively, to combine the transition weights and previous forward vector together. The goal of sharpening is to replace this functor with one that still sums over all possible paths but up-weights those that score highly.

Fig. 38 shows some functors that may be functions used to combine the forwards vector and transitions or mapping weights together. The functor referred to as‘sharpened all paths’ in Fig. 38 is preferred but many others can be used and, indeed, combined together to create new functors.

Rather than training with sharpening enabled from the beginning, it has been found to be advantageous to start training using an all-paths objective function and then increasing the sharpening factor (a) from 1 to a higher value once a good model has been found, potentially repeating with even higher values of sharpening. This multiple-stage process also enables models to train using the best-path objective. Training first to the all paths objective finds a good model such that the best path is good and then this path gets reinforced by further training.

Fig. 39 shows the effect of sharpening a flip-flop representation on the same example region as shown in Fig. 36. Fig. 39 shows the signal (top) and posterior probabilities (bottom) of being in a particular state over time for this example but with training using sharpening. There is a long region between times 2400 and 2620, approximately, where a homopolymer occurs and the model alternates between the T-flop state and T-flip state to call the sequence of bases. The individual calls are more distinct and can be seen to alternate between T-flip and T-flop throughout the homopolymer region.

Decoding this model results in a superior estimation of the polymer units to that of the unsharpened model. This is illustrated in the example shown in Fig. 40, wherein estimates of the polymer unit (basecalls) from unsharpened and sharpened models are compared to the reference sequence. Whereas the unsharpened call only calls 8 T bases, the sharpened call agrees the 27 T bases found in the reference.

Whereas using the best-path or sharpening replaces the training objection, they could also be used to augment it and train the network away from undesirable behavior that has been found during testing. One such undesirable behavior might be a tendency to under-call the lengths of homopolymers, which can occur when the training data is heavily skewed towards short homopolymers, and can be corrected by adding a penalty to the training objection. One such penalty can be found by using the best-path to find positions where homopolymers are called and comparing their true length with an estimate based on the log- probabilities assigned by the network at that position; the comparison could be performed using the sum of absolute differences; the comparison could be performed using the sum of squared difference; many other methods of comparison are known in the art. The penalty could be added to the training objective; the penalty could additionally be weighted by a predetermined factor to change it importance relative to the training objective.

Rather than being predetermined, the factor weighting the penalty term could be treated as a Lagrange multiplier. Training proceeds by the optimizing the training objective while finding a stationary point for the Lagrange multiplier. At, or near these points, the penalty is approximately zero and the network has been trained subject to the penalty condition holding; for the example of where the penalty is the sum of absolute differences between the true and estimated length, the network calls will be the correct length on average.

Multiple penalty terms can be used to augment the training objective, one for each homopolymer length for example; each penalty may either be weighted by a predetermined factor or be treated as a Lagrange multiplier.

The above description considers the case that the weight distributions 51 represent transitions between a set of labels. As an alternative, the methods described herein can be adapted to a case in which the weight distributions 51 represent labels within the set of labels.

In this case in which the weight distributions 51 represent labels within the set of labels, the decoder 80 may use a transition matrix to represent whether transitions between labels are allowed or not allowed. The transition matrix may have a similar form to the matrix of weights in the weight distributions 51 but with binary elements indicating the transitions as allowed or not allowed. The transition matrix may represent at least one transition as not allowed and other transitions being represented as allowed. The decoder 80 may use this transition matrix to derive an estimate of the series of polymer units from the weight distributions 51 that represent labels taking into account the likelihood of different paths through the labels that are allowed in accordance with the transition matrix.

Also in this case in which the weight distributions 51 represent labels within the set of labels, consecutive instances of polymer units of the same type in the series of polymer units may be represented in an encoded form as described above, for example using a flip- flop representation or a run-length encoded representation.

While the above description relates a neural network 10 including an RNN 50, weight distributions having the form and decoding described above may equally be applied to any other form of machine learning technique, for example an HMM.

According to the second aspect of the present invention, there is provided a method as defined in the following clauses.

Clause 1. A method of analysis of a signal derived from a polymer during translocation of the polymer with respect to a nanopore, the polymer comprising a series of polymer units belonging to a set of possible types of polymer unit, the method comprising: analysing the signal using a machine learning technique that outputs a series of weight distributions, each weight distribution comprising weights in respect of labels over a set of labels including labels representing the possible types of polymer unit; and deriving an estimate of the series of polymer units from the weight distributions, wherein the step of deriving an estimate of the series of polymer units takes into account a transition matrix representing whether transitions between labels are allowed or not allowed, at least one transition between labels being represented as not allowed and other transitions being represented as allowed.

Clause 2. A method according to clause 1, wherein at least one transition between labels is not allowed and other transitions are allowed, the weight distributions each comprising weights in respect labels that are allowed.

Clause 3. A method according to clause 2, wherein the weight distributions each comprise null weights in respect labels that are not allowed.

Clause 4. A method according to clause 2 or 3, wherein the step of deriving an estimate of the series of polymer units takes into account a transition matrix representing whether transitions between labels are allowed or not allowed.

Clause 5. A method according to any one of clauses 2 to 4, wherein the set of labels include a first and a second label in respect of each type of polymer unit, the first label representing the start of an instance of the type of polymer unit, and the second label representing a stay in the instance of the type of polymer unit, wherein transitions from each first label to the first label for any other type of polymer unit are allowed, transitions from each first label to the first label for the same type of polymer unit are allowed, transitions from each first label to the second label for the same type of polymer unit are allowed, transitions from each first label to the second label for any other type of polymer unit are not allowed, transitions from each second label to the first label for the same type of polymer unit or the first label for any other type of polymer unit are allowed, and transitions from each second label to the second label for the same type of polymer unit are allowed, and transitions from each second label to the second label for any other type of polymer unit are not allowed.

Clause 6. A method according to any one of clauses 2 to 5, wherein the set of possible types of polymer unit includes a type of polymer unit that always appears in a known sequence of polymer units, transitions in accordance with the known sequence being allowed and transitions contrary to the known sequence being not allowed.

Clause 7. A method according to any one of clauses 2 to 6, wherein consecutive instances of polymer units of the same type in the series of polymer units are represented in an encoded form.

Clause 8. A method according to clause 7, wherein the labels include plural labels in respect of each type of polymer unit, wherein the plural labels in respect of each type of polymer unit represent consecutive instances of the type of polymer unit in the series of polymer units.

Clause 9. A method according to clause 8, wherein the plural labels for each type of polymer unit have a predetermined cyclical order, whereby some transitions between labels are allowed by the predetermined cyclical order and other transitions between are not allowed by the predetermined cyclical order, the weight distributions each including weights in respect labels that are allowed by the predetermined cyclical order.

Clause 10. A method according to clause 8 or 9, wherein the plural labels for each type of polymer unit are two labels for each type of polymer unit.

Clause 11. A method according to clause 7, wherein consecutive instances of the same type of polymer unit in the series of polymer units are represented in a run-length encoded form.

Clause 12. A method according to clause 11, wherein the labels include plural labels in respect of different run-lengths of each type of polymer unit.

Clause 13. A method according to clause 11, wherein the labels include a label in respect of each type of polymer unit, and the weight distributions comprise further weights over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

Clause 14. A method according to clause 3, wherein the further weights comprise a categorical distribution of weights over a set of possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

Clause 15. A method according to clause 13, wherein the further weights comprise parameters of a parameterised distribution over possible lengths of consecutive instances of the same type of polymer unit for each type of polymer unit.

Clause 16. A method according to any one of clauses 2 to 15, wherein the possible types of polymer unit include a type of polymer unit that has unmodified and modified forms. Clause 17. A method according to clause 16, wherein the set of labels include a label in respect of the type of polymer unit that has unmodified and modified forms.

Clause 18. A method according to clause 17, wherein each weight distribution comprises further weights for the unmodified and modified forms of each of the type of polymer unit that has the unmodified and modified forms.

Clause 19. A method according to any one of clauses 2 to 18, wherein the set of labels includes at least one label representing each type of polymer unit.

Clause 20. A method according to any one of the preceding clauses, wherein the set of labels further include at least one label representing a blank and/or a stay in the series of polymer units.

Clause 21. A method according to any one the preceding clauses, wherein the machine learning technique is a neural network comprising at least one recurrent layer.

Clause 22. A method according to clause 21, wherein the at least one recurrent layer is a bidirectional recurrent layer.

Clause 23. A method according to clause 21 or 22, wherein the neural network applies a global normalisation of the weight distributions over all paths of labels through the series of weight distributions.

Clause 24. A method according to any one of clauses 21 to 23, wherein the neural network includes at least one convolutional layer arranged before the at least one recurrent layer and which performs a convolution of windowed sections of the signal.

Clause 25. A method according to any one of of the preceding clauses, wherein the weights represent posterior probabilities.

Clause 26. A method according to any one of the preceding clauses, wherein the step of deriving an estimate of the series of polymer units from the weight distributions is performed using connectionist temporal classification.

Clause 27. A method according to any one of the preceding clauses, wherein the step of deriving an estimate of a polymer unit from the weight distributions comprises deriving a label in respect of respective weight distribution and run-length compressing the derived labels.

Clause 28. A method according to any one of the preceding clauses, wherein the step of deriving an estimate of the series of polymer units from the weight distributions comprises estimating the most likely path of labels through the series of weight distributions on the basis of the weight distributions, and deriving the estimate of the series of polymer units from the path of labels estimated as most likely.

Clause 29. A method according to any one of the preceding clauses, wherein the step of deriving an estimate of the series of polymer units from the weight distributions comprises estimating the labels that are most likely in respect of each weight distribution, taking into account forwards and backwards paths of labels through the series of weight distributions, and deriving the estimate of the series of polymer units from the labels estimated as most likely.

Clause 30. A method according to any one of the preceding clauses, wherein the nanopore is a protein pore.

Clause 31. A method according to any one of the preceding clauses, wherein the polymer is a polynucleotide, and the polymer units are nucleotides.

Clause 32. A method according to any one of the preceding clauses, wherein the signal is derived from measurements of one or more of the following properties: ionic current, impedance, a tunnelling property, a field effect transistor voltage and an optical property. Clause 33. A method according to any one of the preceding clauses, the method being performed in a computer apparatus.

Clause 34. A method according to any one of the preceding clauses, further comprising deriving the signal from the polymer during translocation of the polymer with respect to a nanopore.




 
Previous Patent: GEARS

Next Patent: VERIFICATION OF PERCEPTION SYSTEMS