We created a cohort from Swedish computerized pathology registers, comprising of patients who underwent endoscopic examination with stomach biopsy between 1979 and 2014. This cohort was linked to Cancer Register and other health and demographic registers to identify stomach cancer cases and to obtain necessary information for censoring. We then conducted two nested case-control studies, among subjects with non-atrophic gastritis and atrophic gastritis (or more severe lesions), respectively. For paired stomach cancer cases and controls, formalin-fixed paraffin-embedded tissue blocks from baseline endoscopy were retrieved. We developed various methods for constructing Helicobacter pylori genome, metagenomics analysis, identification of mutation and methylation profile, and assaying biomarkers of DNA damage, stem cells and inflammation, which are tailored for long-term archived tissue blocks. We applied these technologies to the archived tissue samples, and created a unique database enabling us to understand gastric carcinogenesis and identify risk stratification markers. Besides, we developed a loop-mediated isothermal amplification assay for Helicobacter pylori detection using non-invasive and self-sampling methods, which are suitable in low-resources populations. We have also used a population-based case-control study to create a stomach cancer risk prediction model, which awaits to be further developed. Results from our paper have been adopted in updated guideline for management of patients with gastric lesions by Swedish Gastroenterological Association, and presented in several seminars.