# How to Train a Custom Modified Base Model for Oxford Nanopore: From Signal Alignments to Improved Methylation Calls

Oxford Nanopore sequencing produces raw electrical current signals that require computational translation into nucleotide sequence, a process called basecalling. For researchers studying DNA or RNA modifications such as 5-methylcytosine (5mC) or N6-methyladenosine (m6A), the default basecalling models may not accurately detect non-standard modifications or species-specific methylation patterns. Training a custom modified base model using tools like Tombo or Megalodon allows you to build a bespoke caller that recognizes the specific signal signatures present in your samples. This article provides a complete workflow for preparing training data, training modified base models, validating their performance, and integrating them into your analysis pipeline.

The intended audience includes biology students, researchers, laboratory professionals, and life-science practitioners who have basic familiarity with nanopore sequencing and command-line tools. You should have access to a Linux environment with sufficient computational resources, raw FAST5 files from Oxford Nanopore sequencing, and a reference genome for your organism of interest. The workflow described here applies to both DNA modification detection and direct RNA sequencing modification analysis, though the specific tool commands differ between these applications.

## Understanding Modified Base Calling in Oxford Nanopore Sequencing

Oxford Nanopore sequencing measures changes in ionic current as a DNA or RNA molecule passes through a protein nanopore. These current measurements, stored as raw signal data in FAST5 files, contain information about the nucleotide sequence and any chemical modifications present on the bases. The basecaller must interpret these signals to produce both the primary sequence and information about modified bases.

The performance of basecalling tools directly affects downstream analysis accuracy. A 2019 study in Genome Biology examined multiple basecalling tools and found that training basecallers on taxon-specific data produced significant improvements in consensus accuracy, primarily by reducing errors in methylation motifs [7]. The same study noted that larger neural network models improved both read and consensus accuracy, though at the cost of processing speed [7]. These findings establish the foundation for why custom model training matters: default models trained on one species or modification type may not perform optimally on your specific samples.

Modified base detection relies on the principle that chemical modifications alter the ionic current signature in characteristic ways. For 5mC, the methyl group changes the physical properties of the base as it passes through the pore, producing a detectable shift in current levels. The basecaller learns these patterns during training and can then classify each base as either unmodified or carrying a specific modification.

### The Role of Signal-Level Analysis Tools

Tombo and Megalodon represent two distinct approaches to modified base detection. Tombo performs signal-level analysis directly on raw current data, comparing observed signals to expected signals derived from a reference genome. This approach does not require a basecaller to first produce sequence, allowing for detection of modifications that might be missed or misclassified during basecalling.

Megalodon extends the basecalling process itself by integrating modified base detection into the neural network architecture. This tool produces both the primary sequence and modification probabilities in a single pass, using models that have been trained to recognize specific modification signatures.

For custom model training, Tombo provides utilities for estimating alternative models from raw signal data aligned to a reference genome. Megalodon offers similar capabilities through its training workflows, though it requires more computational resources due to its integrated basecalling approach.

### Why Default Models May Fail for Your Samples

Default modified base models are typically trained on data from well-studied organisms such as human cell lines or E. coli. These models recognize common modification patterns but may miss or misclassify modifications that produce different signal signatures in your species of interest. Several factors contribute to this limitation:

Species-specific sequence context affects how modifications alter ionic current. The surrounding nucleotides influence the magnitude and shape of the current shift caused by a methylated base. A model trained primarily on human CpG contexts may not accurately detect methylation in non-CpG contexts or in species with different GC content.

Non-standard modifications present another challenge. While 5mC and m6A are the most studied modifications, organisms may carry other modifications such as 5-hydroxymethylcytosine (5hmC), N4-methylcytosine (4mC), or various RNA modifications. Default models may not include these modification types in their training data.

The 2025 review of RNA methylation in cucurbit crops highlighted that nanopore direct RNA sequencing has enabled construction of RNA methylation landscapes, but noted that resources remain scarce compared to model species [8]. This observation applies broadly: researchers working on non-model organisms often need custom models because suitable pre-trained models do not exist for their species.

## At a Glance: Custom Modified Base Model Training Overview

The table below summarizes the key decisions and considerations for training a custom modified base model with either Tombo or Megalodon.

| Workflow Component | Tombo Approach | Megalodon Approach | Practical Consideration |
| --- | --- | --- | --- |
| Input data requirement | Basecalled FASTQ plus raw FAST5 files | Raw FAST5 files only | Tombo requires prior basecalling, Megalodon performs basecalling internally |
| Computational demand | Moderate, CPU acceptable for most steps | High, GPU strongly recommended for training | Megalodon training on CPU may take days to weeks for large datasets |
| Modification detection strategy | Signal-level comparison to reference expectations | Integrated neural network basecalling with modification probabilities | Tombo suits targeted modification analysis, Megalodon suits combined variant and methylation workflows |
| Training data preparation | Resquiggle aligns signals to reference after basecalling and alignment | Direct training on raw signal with reference genome | Tombo resquiggle success rates indicate data quality before training |
| Output format | Alternative model file for Tombo modification detection | Model file convertible for inference | Save models with descriptive names including organism, modification type, and date |
| Best use case | Non-model organisms, targeted modification studies, limited hardware | Integrated genetic and epigenetic analysis, clinical applications | The 2025 Hao-Fountain syndrome study demonstrated simultaneous variant and methylation detection with nanopore sequencing [10] |

## Preparing Your Training Data

The quality of your training data determines the quality of your custom model. This section covers the essential steps for collecting, organizing, and validating the data you will use for model training.

### Selecting Biological Samples

Choose samples that represent the modification patterns you want your model to detect. For DNA methylation studies, you need genomic DNA from your organism of interest. For RNA modification studies, you need RNA that contains the modifications you want to detect.

Consider including both modified and unmodified samples in your training set. If you are studying 5mC, you might include a sample treated with a methylation inhibitor or a mutant lacking methyltransferase activity as a negative control. This approach helps the model learn the difference between modified and unmodified signals instead of simply learning the overall signal pattern for your species.

The 2025 study on Arabidopsis DNA methylation-deficient mutants demonstrated the value of comparing wild-type and mutant samples [11]. The researchers used ONT direct RNA and DNA sequencing on ddm1 and met1 mutants alongside wild-type plants, identifying 340 upregulated lincRNAs whose expression correlated with DNA methylation status [11]. This experimental design provided clear contrasts for training and validation.

### Sequencing Depth and Coverage Requirements

Training a modified base model requires sufficient sequencing depth to capture the signal variation at modification sites. For DNA modifications, aim for at least 30x to 50x genome coverage in your training dataset. This depth ensures that each modification site appears in multiple reads, providing the model with multiple examples of the signal pattern.

For RNA modifications, the required depth depends on the abundance of the modified transcripts. Highly expressed transcripts may require only modest sequencing depth, while rare transcripts may need targeted enrichment or very deep sequencing to provide enough training examples.

The 2025 study profiling 2'-O-methylation of a ribosomal RNA fragment used a targeted capture strategy to enrich for a specific ~22-nucleotide fragment [9]. This approach allowed the researchers to train machine-learning classifiers on raw ionic-current signals from synthetic oligonucleotides and cell culture derived ribosomal RNA fragments [9]. For low-abundance targets, consider similar enrichment strategies to ensure adequate training data.

### Data Organization and File Formats

Organize your FAST5 files in a consistent directory structure before beginning training. Oxford Nanopore sequencing produces FAST5 files containing raw signal data, and these files may be in either the older single-read format or the newer multi-read format. Your training workflow must match the file format expected by your chosen tool.

Create a manifest or sample sheet that records the following information for each file:

- Sample identifier
- Biological condition (modified, unmodified, or unknown)
- Sequencing run identifier
- Flow cell type
- Basecalling status (raw or previously basecalled)
- File path

This manifest serves as your training data record and supports reproducibility. The Galaxy Training Network emphasizes the importance of documenting analysis workflows for reproducibility [4], and this principle applies equally to model training data.

### Reference Genome Requirements

You need a high-quality reference genome for your organism to align training reads and identify modification sites. The reference should be complete enough to avoid misalignments that would corrupt training data. For well-studied organisms, use the latest reference assembly from NCBI [1]. For non-model organisms, you may need to generate a reference assembly before beginning modified base model training.

The reference genome must match the organism and strain used for sequencing. Using a reference from a different strain can introduce alignment errors that reduce training data quality. Verify the reference genome identity and version before proceeding.

## Installing and Configuring Training Tools

Tombo and Megalodon require specific software environments and dependencies. This section covers installation considerations and configuration options that affect training outcomes.

### Tombo Installation and Setup

Tombo is available through conda and pip package managers. Install Tombo in a dedicated conda environment to avoid dependency conflicts with other bioinformatics tools. The Bioconductor project provides guidance on reproducible software environments for genomic analysis [3], and similar principles apply to Tombo installation.

After installation, verify that Tombo can read your FAST5 files. Run a quick test on a small subset of files to confirm that the software recognizes the file format and can extract signal data. This test saves time compared to discovering file format issues after starting a lengthy training run.

### Megalodon Installation and Resource Requirements

Megalodon requires more computational resources than Tombo due to its integrated basecalling and modification detection. Install Megalodon in a separate environment with GPU support if available. The software can run on CPU, but training and inference will be substantially slower.

Check the Megalodon documentation for specific version requirements for your GPU drivers and CUDA installation. Mismatched versions are a common source of installation failures and runtime errors.

### Configuration Parameters for Training

Both Tombo and Megalodon expose configuration parameters that control the training process. Key parameters include:

- Model architecture size (smaller models train faster but may be less accurate)
- Number of training epochs
- Learning rate
- Batch size
- Validation split proportion

The 2019 basecalling study found that larger neural network models improved accuracy but reduced speed [7]. Balance these tradeoffs based on your computational resources and accuracy requirements. Start with default parameters, then adjust based on validation performance.

## Training a Custom Model with Tombo

Tombo provides a straightforward workflow for training alternative models from raw signal data. This section details the step-by-step process.

### Step 1: Basecall Your Training Reads

Before Tombo can align signals to the reference, you need basecalled sequences for your training reads. Use a standard basecaller such as Guppy or Dorado to produce FASTQ files from your raw FAST5 data. The basecalling quality affects alignment accuracy, so use the highest accuracy basecalling mode available for your platform.

The 2019 study noted that current versions of ONT's Guppy basecaller performed well with good accuracy and fast performance [7]. Use the latest version of your chosen basecaller to maximize training data quality.

### Step 2: Align Reads to the Reference Genome

Align your basecalled reads to the reference genome using a long-read aligner such as minimap2. The alignment must be in BAM format with the signal data linked to the aligned reads. Tombo requires this linkage to extract per-read signal information at each genomic position.

Verify alignment quality before proceeding. Check the proportion of reads that align, the coverage distribution across the genome, and the alignment identity. Poor alignment quality indicates problems with the reference genome, basecalling, or sequencing that must be addressed before training.

### Step 3: Run Tombo Resquiggle

Tombo resquiggle assigns raw signal data to genomic positions based on the read alignments. This step produces the signal-to-sequence mapping that serves as the foundation for modification detection and model training.

Run Tombo resquiggle with the appropriate options for your data type. For DNA, use the dna_r9.4.1_450bps option or the option matching your flow cell and chemistry version. For direct RNA sequencing, use the rna option.

Monitor the resquiggle output for errors. Tombo reports the proportion of reads that successfully resquiggle, and low success rates indicate problems with signal quality, basecalling, or alignment.

### Step 4: Estimate the Alternative Model

Tombo's estimate_alt_model command compares observed signal distributions to expected distributions and identifies positions where the signal deviates from the canonical model. These deviations represent potential modification sites.

The output includes a list of candidate modified positions with associated statistics. Review this output to confirm that the detected positions match your biological expectations. For example, if you are studying CpG methylation, most detected positions should be in CpG contexts.

### Step 5: Train the Custom Model

Tombo trains the custom model using the signal data from the candidate modified positions. The training process adjusts the model parameters to recognize the specific signal patterns present in your data.

The training output includes the model file that you will use for subsequent modification detection. Save this file with a descriptive name that includes the organism, modification type, and training date.

## Training a Custom Model with Megalodon

Megalodon offers an alternative approach that integrates basecalling and modification detection. This section covers the Megalodon training workflow.

### Preparing Megalodon Training Data

Megalodon requires raw signal data and a reference genome for training. Unlike Tombo, Megalodon does not require prior basecalling because it performs basecalling as part of its integrated analysis.

Organize your FAST5 files and reference genome in a directory structure that Megalodon expects. The software documentation provides specific guidance on directory layout and file naming conventions.

### Configuring the Megalodon Model Architecture

Megalodon uses neural network architectures that can be configured for different accuracy and speed tradeoffs. The model architecture determines how the network processes signal data and produces modification predictions.

Select an architecture appropriate for your computational resources. Larger architectures generally produce more accurate results but require more memory and processing time [7]. If you are training on a GPU, ensure that the architecture fits within available GPU memory.

### Running Megalodon Training

Megalodon training requires specifying the training data, reference genome, and model output path. The training process iteratively adjusts model parameters to minimize prediction error on the training data.

Monitor training progress by reviewing the loss values reported at each epoch. Decreasing loss indicates that the model is learning, while plateauing or increasing loss suggests problems with the training data or configuration.

### Converting Megalodon Models for Inference

After training, convert the model to the format used for inference. Megalodon provides utilities for this conversion, and the resulting model file can be used for modification detection on new samples.

Test the trained model on a small validation dataset before applying it to your full dataset. This test confirms that the model produces sensible modification calls and that the inference pipeline works correctly.

## Validating Your Custom Model

Validation is essential to confirm that your custom model performs as expected. This section describes validation approaches and quality metrics.

### Comparing Custom Model Output to Known Modifications

If you have samples with known modification status, compare your custom model's calls to this ground truth. Calculate sensitivity (the proportion of true modifications detected) and specificity (the proportion of non-modified positions correctly classified).

The 2025 lung cancer biomarker study achieved 92% accuracy in detecting methylation states of synthetic oligonucleotides and cell culture derived ribosomal RNA fragments [9]. While your accuracy may differ based on modification type and sample complexity, this study demonstrates that high accuracy is achievable with well-designed training data.

### Cross-Validation Approaches

Split your training data into training and validation sets to assess model performance on held-out data. This approach provides a more realistic estimate of how the model will perform on new samples.

Use stratified splitting to ensure that the validation set contains representative examples of all modification types and sequence contexts present in your data. Random splitting may produce validation sets that do not adequately represent rare modification types.

### Assessing Model Stability Across Sequencing Runs

Test your custom model on data from independent sequencing runs to assess stability. Models that perform well on training data but poorly on new runs may be overfitting to run-specific artifacts.

The 2025 Arabidopsis study used machine learning models to classify lincRNA activation based on multi-omics features, with Random Forest achieving an average precision of 0.96 [11]. This high performance on held-out data demonstrates the value of rigorous validation approaches.

## Integrating the Custom Model into Your Analysis Pipeline

Once validated, your custom model becomes part of your standard analysis workflow. This section covers integration considerations.

### Updating Basecalling Workflows

If you use Megalodon, the custom model replaces the default model in your basecalling workflow. Update your pipeline configuration to reference the custom model file and verify that all downstream steps accept the model output format.

For Tombo-based workflows, the custom model is used during the modification detection step instead of during initial basecalling. Integrate the model into your Tombo analysis commands.

### Combining Custom Models with Other Analysis Tools

Custom modified base models produce modification calls that can be integrated with other analysis tools. For example, you might combine modification calls with differential expression analysis or variant calling.

The 2025 Hao-Fountain syndrome study demonstrated that nanopore sequencing enables simultaneous detection of genetic variants and methylation episignatures [10]. This integrated approach required combining variant calling with methylation analysis, and custom models can support similar integrated workflows for your organism of interest.

### Documenting Model Parameters and Versions

Record the exact parameters used for model training, including software versions, training data identifiers, and configuration settings. This documentation supports reproducibility and troubleshooting.

The nf-core documentation emphasizes the importance of reproducible workflow standards [5], and this principle applies to model training as well. Store your training configuration in version control alongside your analysis code.

## Records and Measurements for Model Training

Maintaining detailed records of your training process supports quality control and troubleshooting. This section describes the records you should keep.

### Training Data Manifest

Create a manifest that records every file used for training, including sample identifiers, biological conditions, and file paths. This manifest serves as the definitive record of your training data.

Include checksums for all training files to verify data integrity. File corruption during storage or transfer can introduce errors that degrade model quality.

### Training Run Logs

Record the training configuration, including model architecture, learning rate, batch size, and number of epochs. Note the training start and end times, computational resources used, and any errors or warnings encountered.

Save the training loss curves and validation metrics at each epoch. These records help identify training problems and support comparisons between different training runs.

### Model Evaluation Records

Document the validation results for your custom model, including sensitivity, specificity, and accuracy on held-out data. Record the validation dataset composition and any filtering criteria applied.

If you compare your custom model to default models, record the performance of both models on the same validation data. This comparison provides evidence for the value of custom model training.

## Common Failure Patterns and Troubleshooting

Several recurring problems affect custom model training. This section describes these failure patterns and their solutions.

### Insufficient Training Data

Models trained on too little data may fail to generalize to new samples. Symptoms include high training accuracy but poor validation accuracy, or inconsistent modification calls across sequencing runs.

Solutions include increasing sequencing depth, adding biological replicates, or using targeted enrichment to increase coverage at modification sites. The 2025 cucurbit RNA methylation review noted that resources are scarce for non-model species [8], so you may need to invest additional sequencing to achieve adequate training data.

### Reference Genome Mismatches

Using a reference genome that does not match your sequenced samples introduces alignment errors that corrupt training data. Symptoms include low resquiggle success rates, unexpected modification patterns, or poor model performance.

Verify that your reference genome matches the exact strain or cultivar used for sequencing. Check the reference version and update if a newer assembly is available from NCBI [1].

### Signal Quality Issues

Poor signal quality from degraded samples, suboptimal library preparation, or flow cell problems reduces training data quality. Symptoms include low read yields, short read lengths, or high error rates in basecalling.

Assess signal quality before training using the quality metrics provided by your sequencing platform. Re-sequence samples with poor quality instead of training on suboptimal data.

### Overfitting to Training Data

Models that memorize training data instead of learning general patterns perform poorly on new samples. Symptoms include near-perfect training accuracy but substantially lower validation accuracy.

Solutions include increasing the amount of training data, adding regularization, or using a smaller model architecture. The 2019 basecalling study noted that larger models improve accuracy but require more computational resources [7], so balance model size against your resources.

## Limitations of Custom Modified Base Models

Understanding the limitations of custom models helps you interpret results appropriately and avoid overconfidence in modification calls.

### Context-Dependent Performance

Custom models trained on one species or sequence context may not perform well on other species or contexts. The model learns the specific signal patterns present in your training data, and these patterns may differ in other organisms.

Test your custom model on data from related species before applying it broadly. If performance degrades, consider training separate models for different species or sequence contexts.

### Modification Type Specificity

Models trained to detect one modification type may not detect other modifications. For example, a model trained to detect 5mC may not recognize 5hmC, even though both modifications occur at cytosine bases.

The 2025 RNA methylation review described the roles of different RNA modifications including m6A and m5C [8], and these modifications produce distinct signal signatures. Train separate models for each modification type you need to detect.

### Computational Resource Requirements

Custom model training requires substantial computational resources, particularly for Megalodon with large neural network architectures. Training may take days or weeks depending on data size and available hardware.

Plan your training timeline accordingly and consider using cloud computing resources if local hardware is insufficient. The Carpentries lessons provide foundational training in computing skills that support efficient use of computational resources [6].

## Safety and Regulatory Context

While custom model training does not involve hazardous materials, several considerations apply to the broader research context.

### Data Management and Privacy

Sequencing data may contain sensitive information, particularly for human samples. Follow institutional data management policies and applicable regulations for storing and sharing sequencing data.

The NCBI provides data submission and access systems that support responsible data sharing [1]. Use these systems to deposit training data and models when appropriate.

### Reproducibility Requirements

Many journals and funding agencies require reproducible analysis workflows. Document your training process thoroughly and make your training data and models available when possible.

The EMBL-EBI Training program provides resources for developing reproducible bioinformatics workflows [2], and the Galaxy Training Network offers practical tutorials for reproducible analysis [4]. Use these resources to support your reproducibility efforts.

## Professional Escalation Criteria

Some situations require consultation with bioinformatics specialists or other experts. This section describes circumstances that warrant escalation.

### Persistent Training Failures

If training repeatedly fails or produces models with poor validation performance despite following recommended procedures, consult with a bioinformatics specialist. Persistent failures may indicate subtle issues with data quality, reference genomes, or software configuration that require expert diagnosis.

### Unexpected Modification Patterns

If your custom model detects modification patterns that contradict biological expectations, investigate before proceeding. Unexpected patterns may indicate training data contamination, reference genome errors, or genuine biological phenomena that require further study.

### Software Bugs or Installation Issues

If you encounter software bugs or installation issues that you cannot resolve through documentation and troubleshooting, contact the software developers or community support channels. Include detailed error messages and your configuration information to facilitate diagnosis.

## Building a Practical Decision Framework for Custom Model Training

Before committing computational resources and sequencing capacity to custom model training, you need a structured way to determine whether training is necessary, which tool fits your situation, and how to allocate your data budget. This section provides a decision framework based on observable indicators from your existing sequencing runs, a record system for tracking training decisions, and troubleshooting methods for common validation failures.

### Initial Assessment: Do You Actually Need a Custom Model?

The first decision point is whether default models are genuinely inadequate for your application. Running a diagnostic comparison on a small subset of your existing data provides objective evidence for this determination. Select 10,000 to 50,000 reads from a representative sequencing run and process them through both the default modified base model and a standard basecaller without modification detection. Compare the outputs on three specific metrics.

First, examine modification call consistency at known modification sites. If you have prior bisulfite sequencing, mass spectrometry, or antibody-based enrichment data for your organism, compare the overlap between your expected modification sites and the default model calls. The 2025 Hao-Fountain syndrome study demonstrated that nanopore methylation analysis can match EPIC array platform results when models perform correctly [10]. If your default model calls show less than 70 percent overlap with orthogonal validation data, custom training is likely justified.

Second, assess the proportion of reads that receive modification calls at all. Default models trained on human or bacterial data may fail to call modifications in species with different sequence contexts. The 2019 Genome Biology study found that taxon-specific training reduced errors specifically in methylation motifs [7]. If your default model produces modification calls in fewer than 50 percent of reads that map to regions with known modification potential, this indicates a model mismatch.

Third, evaluate the false positive rate using a biological negative control. Sequence a sample from a mutant lacking the relevant methyltransferase or a sample treated with a methylation inhibitor. The 2025 Arabidopsis study used ddm1 and met1 mutants as methylation-deficient comparisons to wild-type plants [11]. If your default model calls modifications in the negative control at rates exceeding 15 percent of the positive control rate, the model is not distinguishing signal properly for your species.

### Tool Selection Matrix Based on Your Constraints

Once you have confirmed the need for custom training, choose between Tombo and Megalodon based on four practical constraints: available hardware, data format compatibility, downstream analysis requirements, and timeline.

For hardware-constrained environments, Tombo is the appropriate choice. Tombo performs signal-level analysis on previously basecalled reads and can run on CPU with moderate memory requirements. Megalodon integrates basecalling with modification detection, which requires GPU acceleration for practical training timelines. If your institution lacks GPU access, Tombo provides a viable path to custom models without specialized hardware.

For data format compatibility, check whether your FAST5 files are in single-read or multi-read format. Tombo supports both formats but requires specific configuration for each. Megalodon has stricter format requirements and may need file conversion before training begins. Verify format compatibility before committing to a tool to avoid time lost to conversion issues.

For downstream analysis needs, consider whether you require integrated variant calling alongside modification detection. The 2025 Hao-Fountain syndrome study demonstrated that nanopore sequencing can simultaneously detect genetic variants and methylation episignatures [10]. If your research requires this integrated approach, Megalodon provides a unified workflow. If you only need modification calls and already have a variant calling pipeline, Tombo integrates more easily with existing workflows.

For timeline constraints, estimate your training duration based on data volume and available hardware. Tombo training on a CPU with 30x genome coverage typically completes within days. Megalodon training on a GPU with comparable data may take several days to weeks depending on model architecture size. The 2019 basecalling study noted that larger neural networks improve accuracy but reduce speed [7]. If your timeline is fixed, choose the tool and model size that fits your schedule.

### Data Budget Allocation Framework

Your sequencing data serves multiple purposes: training, validation, and final testing. Allocate your data budget deliberately to avoid depleting your best samples on training alone.

Reserve 60 percent of your highest quality data for training. This portion should include the broadest representation of modification contexts present in your organism. Include biological replicates to capture run-to-run variation. The 2025 cucurbit RNA methylation review noted that resources are scarce for non-model species [8], so efficient use of limited sequencing capacity is critical.

Allocate 20 percent for validation during training. This held-out set allows you to monitor overfitting and adjust hyperparameters. Use stratified sampling to ensure the validation set includes all modification types and sequence contexts present in your training data.

Reserve 20 percent for final testing on completely unseen data. This test set should come from independent sequencing runs, beyond independent reads from the same run. The 2025 lung cancer biomarker study achieved 92 percent accuracy in methylation state detection using classifiers trained on synthetic oligonucleotides and validated on cell culture derived fragments [9]. Independent test sets provide the most realistic estimate of real-world performance.

### Record System for Training Decisions

Maintain a structured record of every training attempt to support troubleshooting and reproducibility. Create a training log with the following fields for each run:

- Training data manifest identifier and file checksums
- Tool version and model architecture identifier
- Hyperparameter settings including learning rate, batch size, and epoch count
- Training and validation loss curves at each epoch
- Computational resources used and wall clock time
- Validation metrics on held-out data
- Test metrics on independent data
- Any errors, warnings, or anomalies observed during training

Store this log in version control alongside your analysis code. The nf-core documentation emphasizes reproducible workflow standards [5], and this principle applies to model training records. The Galaxy Training Network also provides guidance on documenting analysis workflows for reproducibility [4].

### Troubleshooting Validation Failures

When your custom model fails validation, work through these diagnostic steps in order.

First, check for data leakage between training and validation sets. If reads from the same sequencing run appear in both sets, the model may memorize run-specific artifacts instead of learning general modification patterns. Verify that validation reads come from independent runs or from reads excluded from training by read identifier.

Second, examine the distribution of modification calls across sequence contexts. If your model calls modifications almost exclusively in CpG contexts when your organism has known non-CpG methylation, the training data may be biased toward CpG sites. The 2025 Arabidopsis study identified 209 lincRNAs with expression negatively correlated with DNA methylation [11], demonstrating that modification patterns vary across sequence contexts. Rebalance your training data to include underrepresented contexts.

Third, assess whether your training data contains sufficient modification-positive examples. If your organism has low global methylation levels, most training reads will be modification-negative, and the model may learn to call everything as unmodified. Consider targeted enrichment of modified regions or include a methylation-positive control sample in your training set.

Fourth, verify that your reference genome matches your sequenced samples exactly. Strain or cultivar differences introduce alignment errors that corrupt training data. Check the reference version against the NCBI database [1] and confirm it matches your sample origin.

Fifth, evaluate whether your training epochs are sufficient or excessive. Plot training and validation loss curves together. If validation loss increases while training loss decreases, you are overfitting. Reduce epochs, increase regularization, or expand training data. If both losses plateau at high values, your model architecture may be too small to capture the signal patterns in your data.

### Comparison of Custom Model Performance Against Default Models

After training and validation, conduct a formal comparison between your custom model and the default model on the same test dataset. Use three metrics: sensitivity, specificity, and area under the receiver operating characteristic curve. The 2025 lung cancer biomarker study used receiver operating characteristic analysis to evaluate a diagnostic classifier with an area under the curve of 0.84 [9]. Apply similar statistical rigor to your model comparison.

Calculate sensitivity as the proportion of known modified positions correctly identified. Calculate specificity as the proportion of known unmodified positions correctly classified. Report both metrics with confidence intervals based on the number of test positions.

Document the computational cost difference between custom and default models. The 2019 basecalling study found that larger models improve accuracy but reduce speed [7]. Your custom model may require more processing time per read, and this cost should factor into your decision to deploy it in routine analysis.

### When to Abandon Custom Training

Custom model training is not always the correct solution. Abandon the effort if you observe any of the following conditions after two or more training attempts with corrected data.

If your custom model fails to outperform the default model on independent test data by a meaningful margin, the default model may already be adequate for your application. The cost of custom training may not justify marginal accuracy improvements.

If your training data quality is consistently poor due to sample degradation, flow cell problems, or library preparation issues, additional training attempts will not solve the underlying data quality problem. Re-sequence with improved protocols before attempting further training.

If your computational resources cannot support the model architecture needed for your modification type, consider alternative approaches. The 2025 RNA methylation review noted that mechanistic understanding and functional validation remain limited for many non-model species [8]. You may need to collaborate with a bioinformatics core facility or use cloud computing resources to access adequate hardware.

### Professional Escalation Criteria

Escalate to a bioinformatics specialist or computational biology consultant when you encounter conditions beyond routine troubleshooting. These include persistent training failures across multiple data preparations, unexpected modification patterns that contradict orthogonal validation data, or software errors that you cannot resolve through documentation review.

The EMBL-EBI Training program provides resources for developing bioinformatics skills [2], and The Carpentries offers foundational computing lessons [6]. These resources can help you build the skills needed to troubleshoot independently. However, if you have exhausted these learning resources and still cannot resolve your training issues, professional consultation is appropriate.

Document all troubleshooting steps and their outcomes before escalation. This documentation helps the specialist diagnose the problem efficiently and prevents repeating failed approaches.

## Frequently Asked Questions

### What is the difference between Tombo and Megalodon for custom model training?

Tombo performs signal-level analysis on raw current data without integrated basecalling, making it lighter on computational resources and suitable for modification detection on previously basecalled reads. Megalodon integrates basecalling with modification detection in a single neural network, which can improve accuracy but requires substantially more computational resources. Choose Tombo for simpler workflows or limited hardware, and Megalodon when you need integrated basecalling and modification detection.

### How much sequencing data do I need for custom model training?

The required data volume depends on your organism, modification type, and the abundance of modified sites. For DNA modifications, aim for at least 30x to 50x genome coverage. For RNA modifications, the required depth depends on transcript abundance, and low-abundance targets may require targeted enrichment. Start with a pilot training run on a subset of data to assess whether your coverage is sufficient.

### Can I train a custom model for RNA modifications using the same workflow as DNA?

The general workflow is similar, but the specific tools and parameters differ. Tombo provides separate options for DNA and direct RNA sequencing, and Megalodon has distinct model architectures for each data type. Direct RNA sequencing requires different library preparation and produces different signal characteristics, so use the appropriate options for your data type.

### How do I know if my custom model is performing well?

Compare your custom model's modification calls to known modification status in validation samples. Calculate sensitivity, specificity, and accuracy on held-out data. Also compare your custom model's performance to default models on the same data to quantify the improvement. The 2025 lung cancer biomarker study achieved 92% accuracy in methylation state detection [9], providing a reference point for achievable performance.

### What should I do if my custom model performs worse than the default model?

First, verify that your training data quality is adequate and that your reference genome matches your samples. Check for overfitting by comparing training and validation accuracy. Consider increasing training data volume, adjusting model architecture, or consulting with a bioinformatics specialist. Poor performance may also indicate that the default model is already well-suited to your data, in which case custom training may not provide benefits.

### Can I use a custom model trained on one species for another species?

Custom models may transfer to closely related species but often perform poorly on distantly related species due to differences in sequence context and modification patterns. Test the model on data from the new species before relying on its calls. If performance is inadequate, train a new model using data from the target species.

### How long does custom model training take?

Training time depends on data volume, model architecture, and computational resources. Tombo training is generally faster than Megalodon training. GPU acceleration substantially reduces training time for Megalodon. Plan for training runs lasting from hours to days, and allocate additional time for validation and troubleshooting.

### What records should I keep for reproducibility?

Keep a training data manifest with file paths and checksums, training configuration parameters, training run logs with loss curves, and validation results. Store these records in version control alongside your analysis code. This documentation supports reproduction of your training process and troubleshooting if problems arise later.

## Related Bioinformatics Guides

- [Oxford Nanopore Sequencing: From Sample to Base Calls](/knowledge/bioinformatics/oxford-nanopore-sequencing-from-sample-to-base-calls)
- [How to Choose a Long-Read Sequencing Platform: PacBio vs Oxford Nanopore](/knowledge/bioinformatics/how-to-choose-a-long-read-sequencing-platform-pacbio-vs-oxford-nanopore)
- [Foundation Models in Genetics: Opportunities and Challenges](/knowledge/bioinformatics/foundation-models-in-genetics-opportunities-and-challenges)
- [Benchmarking Machine Learning Models in Bioinformatics: Best Practices and Pitfalls](/knowledge/bioinformatics/benchmarking-machine-learning-models-in-bioinformatics-best-practices-and-pitfalls)
- [Foundation Models for Genomics: From Single Cells to Health Trajectories](/knowledge/bioinformatics/foundation-models-for-genomics-from-single-cells-to-health-trajectories)

## References and Further Reading

- [NCBI Data Resources](https://www.ncbi.nlm.nih.gov/). National Center for Biotechnology Information.
- [EMBL-EBI Training](https://www.ebi.ac.uk/training). European Bioinformatics Institute.
- [Bioconductor](https://bioconductor.org/). Bioconductor Project.
- [Galaxy Training Network](https://training.galaxyproject.org/). Galaxy Project.
- [nf-core Documentation](https://nf-co.re/docs). nf-core.
- [The Carpentries Lessons](https://carpentries.org/lessons). The Carpentries.
- [Performance of neural network basecalling tools for Oxford Nanopore sequencing.](https://pubmed.ncbi.nlm.nih.gov/31234903). Genome biology, 2019.
- [Epigenomic Transcriptome Regulation of Growth and Development and Stress Response in Cucurbitaceae Plants: The Role of RNA Methylation.](https://pubmed.ncbi.nlm.nih.gov/41296442). Current issues in molecular biology, 2025.
- [Nanopore based RNA methylation profiling of a circulating lung cancer biomarker.](https://doi.org/10.1038/s43856-025-01235-5). 2025.
- [Nanopore sequencing enables combined detection of &lt,i&gt,USP7&lt,/i&gt, variants and a known Hao-Fountain syndrome episignature.](https://doi.org/10.3389/fgene.2025.1730165). 2025.
- [Nanopore sequencing and multiomics reveal predictable non-coding RNA activation in DNA methylation deficient Arabidopsis thaliana.](https://doi.org/10.1038/s42003-025-09454-1). 2025.

> This article is educational and does not replace validated analysis plans, institutional policy, clinical interpretation, or specialist review.