dataesr/scientific-paragraphs-categorization huggingface dataset:
We notice that among the tested EFs, those that do not remove relatively high frequencies ( f i passband > 28 -1 ) are unable to pass the surrogate data test even for the segments with high SNR (fig. S22 ). Also, an EF of the order larger than the average recurrence time (N b ≳ 365 to 425, i. e. , 12 to 14 months) is unable to pass the surrogate data test. The P ̇ amplitudes during the slipping phase are decreased (figs. S40 to S44). This incapability to pass the surrogate data test may be due to the fact that the EF response is not flat in the low-frequency domain, but it has some ripples (figs. S34 and S35). Consequently, we have some low frequencies reduced and others amplified, and the SNR actually decreases. As noticed in the "Filters" section, the HWF offers an easier way to independently tune the filter order and f cutoff , and we observe a clear stabilization of D at values between 3 and 4 for all segments when decreasing f cutoff (figs.
Surveillance of drug-resistant bacteria is essential for healthcare providers to deliver effective empirical antibiotic therapy. However, traditional molecular epidemiology does not typically occur on a timescale that could affect patient treatment and outcomes. Here, we present a method called 'genomic neighbour typing' for inferring the phenotype of a bacterial sample by identifying its closest relatives in a database of genomes with metadata. We show that this technique can infer antibiotic susceptibility and resistance for both Streptococcus pneumoniae and Neisseria gonorrhoeae. We implemented this with rapid k-mer matching, which, when used on Oxford Nanopore MinION data, can run in real time. This resulted in the determination of resistance within 10 min (91% sensitivity and 100% specificity for S.
Our method takes sequences generated from a sample in real time and matches them to a database of genomes to identify the closest relatives. Because closely related isolates usually have similar properties, this yields an informed heuristic regarding the phenotype of the pathogen. We demonstrate this by identifying drug-resistant and drug-susceptible clones for both S. pneumoniae (the pneumococcus) and N. gonorrhoeae (the gonococcus) within minutes after the start of sequencing using Oxford Nanopore Technology (ONT). The method has many potential applications depending on.
Results Resistance is associated with clones in S. pneumoniae and N. gonorrhoeae. To quantify the association of clones with antibiotic resistance of the pathogens S. pneumoniae and N. gonorrhoeae, we constructed optimal predictors of resistance from bacterial lineages and measured the associated area under the receiver operating characteristic curve (AUC) (Supplementary Fig. 1 ). First, we applied the method to 616 pneumococcal genomes from a carriage study of children in Massachusetts, USA  23, 24. Second, we used 1,102 clinical gonococcal isolates collected from 2000 to 2013 by the CDC's Gonococcal Isolate Surveillance Project  25. In both cases, the datasets comprised draft genome assemblies from Illumina HiSeq reads, resistance data and lineages inferred from sequence clusters computed using Bayesian analysis of population structure  26.
Lineages of S. pneumoniae were predictive for benzylpenicillin, ceftriaxone, trimethoprim-sulfamethoxazole, erythromycin and tetracycline resistance, with AUC values ranging from 0. 90 to 0. 97 (Supplementary Fig. 2 ), which is consistent with previous works 5. For N. gonorrhoeae, ciprofloxacin, ceftriaxone and cefixime attained comparably large AUC values (from 0. 93 to 0. 98), whereas azithromycin demonstrated a lower association (AUC value of 0. 80) (Supplementary Fig. 3 ), which is as previously observed  25. Rapid identification of nearest known relatives from sequencing reads. Based on the observed associations, we developed an approach that we term genomic neighbour typing to predict the phenotype from sequencing data. Genomic neighbour typing is a two-step algorithm that first compares a provided sample to a database of reference genomes with a known phylogeny and phenotype, and then predicts the probable phenotype of the sample based on the best hits (nearest neighbours) and their matching quality.
We apply this here to the detection of drug resistance. To implement genomic neighbour typing, we developed software called resistance-associated sequence elements (RASE) (Fig. 1 ). RASE takes a stream of nanopore reads and compares their k-mer content to references using a modified version of ProPhyle  27, 28  , which is a metagenomic classifier that implements a fast and memory-efficient exact coloured de Bruijn graph data structure  29  using a Burrows-Wheeler transform (BWT) index 30 (Methods). Using ProPhyle RASE identifies which references are the most similar to the read and increases their similarity weights (this approach was inspired by but differs from other similar approaches such as Kraken  31  and Kallisto  32  ). These weights are cumulative scores that capture sample-to-reference similarity; they are set to zero at the beginning and are increased on the fly as sequencing proceeds according to the 'information content' of each read (Methods).
A comparison of their weights provides a 'susceptibility score' , which quantifies the risk of resistance (Methods). When the weights are too similar, the confidence of the call is considered low; this happens when resistant and susceptible strains are insufficiently genetically distinct, which is often the case for resistance that has recently emerged in evolutionary history (Methods). The ability to pinpoint the closest relatives in the database offers further resolution, even in the case where the resistance phenotype varies within a lineage. Results of RASE are reported in real time as the best match in the database, together with susceptibility scores to the antibiotics being tested and a proportion of matching k-mers for quality control. As the run progresses, the scores fluctuate and eventually stabilize (an example is shown in Fig.
2 ). RASE databases for hundreds of S. pneumoniae and N. gonorrhoeae strains. We constructed RASE databases for S. pneumoniae and N. gonorrhoeae from the same data as described above (Methods). We assigned each pneumococcal and gonococcal strains to antibiotic-specific resistance categories using the European Committee on Antimicrobial Susceptibility Testing (EUCAST) breakpoints  33  and the CDC Gonococcal Isolate Surveillance Project (GISP) breakpoints  34  , respectively (Methods). Where MIC data were unavailable or insufficiently specific, we estimated the probable resistance phenotype using ancestral state reconstruction (Methods; Supplementary Note 1; Extended Data Figs. 3  and 4 ). To verify the results, we tested eight pneumococcal isolates for which resistance phenotypes were not originally available (Methods), and the measured MICs by microdilution matched the expected phenotypes (shown in bold in Table  1 ).
We constructed the ProPhyle k-mer indexes using a k-mer length that was optimized to minimize prediction delays (k = 18; Methods). The obtained pneumococcal and gonococcal RASE databases occupy 321 MB and 242 MB of RAM (×4. 3 and ×12, respectively, compression rate) and can be further compressed for transmission to 47 MB and 32 MB (×29 and ×90, respectively, compression rate), respectively (Extended Data Fig. 1 ). This would allow RASE to be used on portable devices and its databases to be easily transmitted to the point of care over links with a limited bandwidth. RASE identifies strains in the database within minutes. We first examined two pneumococcal isolates that were used to build the RASE database (100% sensitivity and 100% specificity, n = 10; Table  1a ) to test whether RASE can function in ideal circumstances.
In the case of a fully susceptible isolate (SP01), the correct lineage and sequenced strain were identified within 1 min and 7 min, respectively. A multidrug-resistant isolate (SP02) was predicted even faster, with both lineage and the sequenced strain correctly detected and stabilized within 1 min. To compare our method to gene-based approaches for detecting resistance  22  , we evaluated how long it took for resistance genes to be sequenced on the device. We observed that at least 25 min would be needed for single copies to be detected (Supplementary Note 2; Extended Data Fig. 2 ). We then performed a similar evaluation with five gonococcal isolates from the database (57% sensitivity and 100% specificity, n = 20; Table  2a ); however, here, we selected more complicated cases. First, we tested a susceptible isolate (GC01), for which RASE identified the correct strain and antibiogram within 3 min of sequencing.
Nature Microbiology In this experiment, RASE also resolved sample mislabelling (Supplementary Note 3). For a multidrug-resistant isolate (GC04), RASE predictions stabilized within 2 min, but incorrectly predicted susceptibility to ceftriaxone. A subsequent analysis revealed that the ceftriaxone MIC of the sample was equal to the CDC GISP breakpoint (0. 125 μg ml -1 ), whereas the best match in the database had an MIC of 0. 062 μg ml -1 , within a single doubling dilution. We further found that RASE performed well even with extremely poor data and low-quality reads (for example, GC05; Supplementary Note 4). We also evaluated how genomic neighbour typing would perform if RASE used Kraken 31 instead of ProPhyle  27, 28  , and results are presented in Supplementary Note 5.
RASE identifies the closest relative of previously untested isolates. We next examined four pneumococcal isolates (89% sensitivity and 100% specificity, n = 20; Table  1b ) for which the serotype and limited antibiogram and lineage data were known. We compared the following three characteristics of the sample to assess our performance: the serotype, the sequence type as determined by multilocus sequence typing (MLST) and the antibiograms (benzylpenicillin, ceftriaxone, trimethoprim-sulfamethoxazole, erythromycin and tetracycline resistance according to the EUCAST breakpoints  33  ). In all cases, the closest relative was identified within 5 min, even if the correct MLST sequence type was absent from the RASE database (an example is shown in Fig. 2 ). The two samples from the 23F clone (SP03 and SP06) were correctly called as being closely related to the Tennessee 23F-4 clone identified by the Pneumococcal Molecular Epidemiology Network, a clone strongly associated with macrolide resistance  36.
Consistent with this, the two samples were indeed resistant to erythromycin. However, the Tennessee 23F-4 clone was absent from the Massachusetts sample, with the best match being a comparatively distantly related strain that was resistant to penicillin, but susceptible to erythromycin. This illustrates the importance of a relevant database. We evaluated RASE with 14 clinical gonococcal isolates from the RaDAR-Go project  37  (Switzerland, 2015-2016) (93% sensitivity and 100% specificity, n = 56; Table  2b ). These isolates were previously sequenced using nanopore and have full antibiograms available  38. The 55 out of 56 correct calls indicate the strength of the genomic neighbour typing in a clinical setting. The only incorrect call (susceptibility to azithromycin for GC15) was marked as being low confidence on the basis of a poor susceptibility score.
It should be noted that the ranges for what is considered low confidence could vary among settings and pathogens, but can be empirically determined and modified by users. In this case, our results suggest that informative results can be obtained even when using a database from one region (the United States) to predict phenotypes in another region (Europe). However, this may not be the case for all pathogens. Inference is still informative but lower quality on highly divergent lineages. As noted above, an important precondition of genomic neighbour typing is a comprehensive and relevant reference database. To evaluate the performance of RASE in a setting with an incomplete database, we used the gonococcal WHO In the first loading step, the precomputed RASE database is loaded into memory. As reads are generated, they are matched against the database using ProPhyle to calculate similarity to individual strains.
The weights for the most similar strains (D and E in the figure) are increased proportionately to the number of matching k-mers. Finally, resistance is predicted from the obtained weights and from the resistance profiles of the database strains in the following manner. First, the best lineage is identified as the lineage of the best match (having the highest weight, E in the figure) and its score is calculated (lineage score (LS)). Second, for every antibiotic, a score quantifying the chance of susceptibility (susceptibility score (SS)) is calculated based on the most similar susceptible and resistant strains inside the identified lineage (B and E in the figure, respectively). The susceptibility or resistance to each of the antibiotics is predicted from their susceptibility scores by a comparison with a threshold (0.
5 in the default setting) and reported together with the lineage, the best matching strain and the known properties of that strain (for example, the original antibiograms and the MLST-identified sequence type or serotype). (World Health Organization) 2016 reference strain collection  39. This includes a global collection of 14 diverse isolates from Europe, Asia, North America and Australia, collected over two decades and exhibiting phenotypes ranging from pan-susceptibility to multidrug resistance, and as such, the GISP database is expected to be non-representative in this study. The WHO strains are available from the National Collection of Type Cultures, and were previously sequenced using nanopore  38  and genetically and phenotypically characterized  39. Surprisingly, RASE correctly identified all MLSTidentified sequence types represented in the database, and in seven cases it provided fully correct resistance phenotypes (67% sensitivity and 91% specificity, n = 56; Supplementary Table  1 ).
In six out of seven cases where the complete resistance profile was not recovered, the closest relatives were correctly identified, but were genetically divergent from the query isolates (Supplementary Note 6). In one case, the errors were due to a misidentification of the closest relatives by ProPhyle. Therefore, most prediction errors could be addressed with a more comprehensive database. RASE can identify resistance in pneumococcus from sputum metagenomic samples. Because bacterial culture and phenotyping via agar-dilution, Etest or disk diffusion introduces significant delays in resistance profiling, direct metagenomic sequencing of clinical samples would be preferable for point-of-care use. We therefore analysed metagenomic nanopore data from sputum samples obtained from patients suffering from lower respiratory tract infections  40  (UK, 2017), selecting six samples from the study that were already known to contain S.
pneumoniae (75% sensitivity and 100% specificity, n = 16; Table  1c ). One sample (SP10) contained DNA from multiple bacterial species. However, within 5 min, the sequence was identified to belong to the Swedish 15A-25 clone (ST63), which is also known to be associated with resistance phenotypes including macrolides and tetracyclines  41. This sample was confirmed to be resistant to erythromycin and to clindamycin, tetracycline and oxacillin according to the EUCAST breakpoints  33. The original report of the Swedish 15A-25 clone did not report resistance to penicillin antibiotics  41  , which has subsequently emerged in this lineage. However, our database correctly identified the risk of penicillin resistance in this sample. The metagenomes SP11 and SP12 contained an estimated >20% reads that matched S.
pneumoniae, and their serotypes were identified to be 15A and 153, respectively. The susceptibility scores of the best matches were fully consistent with the resistance profiles found in the samples, with the exception of tetracycline resistance in SP12 due to an incomplete database (Supplementary Note 7). The last remaining samples, SP07-SP09, contained <5% unambiguously pneumococcal reads. Despite the low proportions, all predicted phenotypes were concordant with phenotypic tests, with the exception of SP07, which matched the same strain as SP12 (discussed above).
Discussion This paper presents a method, which we termed genomic neighbour typing, to pinpoint the closest relatives of a query genome within a suitable database and then to infer the phenotypic properties    The table displays actual and predicted resistance phenotypes (where 'S' represents susceptible and 'R' represents non-susceptible) for individual experiments and information on the match of the predicted MLST-identified sequence type and the clonal complex (CC). Resistance categories in bold were inferred using ancestral reconstruction and were confirmed using phenotypic testing (see Methods and Supplementary Table  2 ). Metagenomic samples were sorted by the estimated fraction of S. pneumoniae reads (SP). a Correct prediction. b Incorrect prediction. c Cannot be evaluated. R R a R R a R R a R R a R (2) R ( SP03 Yes 3.
1 23F 23F a R R a R S (3)b R R a R R a S S a OoD c Yes a SP04 Yes 12 19A 19A a R R a R R a R R a R R a R R (4)a OoD c Yes a SP05 No 1. 8 19F 19F a R R a R R a,d R R a R R a,d R R a,d OoD c Yes a SP06 Yes 8. 3 23F 23F a R R a R S (3)b R R a R. 2 R R a R R a R R (8)a SP11 Yes 70 14 R R a R R a R R (8) d Low confidence call. OoD, out of database;  (n)  , identity of a retested sample; NA, not available. For definitions of antibiotics see Fig. 2. of the query strain on the basis of the reported properties of its relatives. At present, the precise lineage of a bacterial pathogen is often determined after most important clinical decisions have been made. However, incorporating genomic neighbour typing at an earlier stage offers a way of leveraging bacterial population structure to gain information on resistance and susceptibility, and to guide antimicrobial therapy.
As a consequence of the much lower diversity in gonococcus, when multiple closely related genomes are present in the database, RASE fluctuated between them, even though it correctly identified the region of the phylogeny. If these genomes vary in their resistance profile, this is properly reflected in an uncertain susceptibility score that indicates caution and further investigation are merited (for example, GC03). As in all inference, the principle limitation of genomic neighbour typing is the representativeness of the database. While we have made use of relatively small samples from limited geographical areas to demonstrate proof of principle, in practice, there are multiple examples of large genomic databases generated by public health agencies, which could be combined with metadata on resistance for genomic neighbour typing.
Such databases could, if necessary, be supplemented with local sampling. The relevant question for our approach therefore becomes whether the database contains a sufficiently high proportion of strains that will be encountered in the clinic and whether the resistance data are correct. Further work is required to determine the optimal structure and contents of databases for each application, but we emphasize the range of pathogens that appear to show promise for this approach. These include Escherichia coli, in which data on MLST-identified sequence types supplemented with epidemiological information consistently.
Nature Microbiology produced AUC values in excess of 0. 90 for multiple antibiotics  42  , which suggests that there is great potential for neighbour typing to offer excellent resolution that is superior to MLST. However, we anticipate that genomic neighbour typing may be less suitable in cases when there is little within-species genomic variation (meaning it is hard to identify the nearest neighbour) or when resistance rapidly emerges on independent and diverse genomic backgrounds (meaning resistance is poorly correlated with those backgrounds) (Supplementary Note 8). In cases where the infectious agent is unknown, this problem is significantly more challenging. k-mers from one pathogen can match others and produce false predictions, and so the choice of the correct database for prediction is key.
Doing this will probably require a two-step solution in which the reads are first passed through a metagenomic classifier such as Centrifuge  43  or MetaMaps  44  , which would be used to select the correct RASE database on which to make a resistance call. Another limitation is the time required for sample preparation, which currently includes human DNA depletion, DNA isolation and library preparation, thereby taking a total of 4 h. However, this is a rapidly evolving area of technology and automated rapid library preparation kits are already in development  45. Further advances in this space, in particular for the preparation of metagenomic samples, will be required to bring the method closer to the bedside. We have demonstrated that effectively predicting resistance and susceptibility from sequencing data does not require knowledge of causal resistance determinants.
In fact, neighbour typing only requires that the phenotype be sufficiently strongly associated with the population structure to make reliable predictions. A key advantage of this approach is that it requires very little genomic data, thus it is not limited by high error rates or low coverage. In particular, it is not attempting to define the exact genome sequence of the sample being tested, but merely which lineage it comes from. As a result, even when a small fraction of k-mers in the read are informative in matching to the RASE database, this is sufficient to call the lineage. This has the benefit of being faster than gene detection by virtue of the informative k-mers being distributed throughout the genome, and so more likely to appear in the first few reads sequenced by the nanopore. Therefore, the approach we present here can be seen as an application of compressed sensing; that is, by measuring a sparse signal distributed broadly across our data, we can identify it with comparatively few error-tolerant measurements.
Genomic neighbour typing can also be used to detect other phenotypes that are sufficiently tightly linked to a phylogeny, such as virulence. Further applications may include rapid outbreak investigations, as the closely related isolates involved in the outbreak would all be predicted to match to the same strain in the RASE database. The approach also lends itself to enhanced surveillance, including in the field; the 2014-2016 Ebola outbreak in West Africa, for example, saw MinION devices used in remote locations without advanced healthcare facilities  2. Finally, at present, empirical treatment decisions are made within successive 'windows'  46  , in which increasing information becomes available, from initial Gram stain to full phenotypic characterization. The information from genomic neighbour typing is a natural complement to this process and has the potential to improve therapy long before it would become clinically apparent that the patient is not responding or before phenotypic susceptibility data were available.
Methods Overview. RASE uses rapid approximate k-mer-based matching of long sequencing reads against a database of strains to predict resistance via neighbour typing. The database contains a highly compressed exact k-mer index, a representation of the tree population structure and metadata such as lineage, resistance profiles, MLSTbased sequence type and serotype. The RASE prediction pipeline iterates over reads from the nanopore sequencer and provides real-time predictions of lineage and resistance or susceptibility (Fig. 1 ). Resistance profiles. For all antibiotics, RASE associates individual strains with a resistance category: 'susceptible' (S) or 'non-susceptible' (R). First, intervals of possible MIC values are extracted using regular expressions from the available textual antibiograms.