pub trait QCModule: Send {
Show 19 methods
// Required methods
fn process_sequence(&mut self, sequence: &Sequence);
fn name(&self) -> &str;
fn description(&self) -> &str;
fn reset(&mut self);
fn raises_error(&self) -> bool;
fn raises_warning(&self) -> bool;
fn ignore_filtered_sequences(&self) -> bool;
fn ignore_in_report(&self) -> bool;
fn write_text_report(&self, writer: &mut dyn Write) -> Result<()>;
// Provided methods
fn cost_hint(&self) -> u32 { ... }
fn set_filename(&mut self, _name: &str) { ... }
fn attach_live_stats(&mut self, _live: Arc<LiveStats>) { ... }
fn set_phred_encoding(&mut self, _encoding: PhredEncoding) { ... }
fn finalize(&mut self) { ... }
fn status(&self) -> ModuleStatus { ... }
fn chart_image_name(&self) -> Option<&str> { ... }
fn chart_alt_text(&self) -> Option<&str> { ... }
fn generate_chart_svg(&self) -> Option<String> { ... }
fn write_html_report(&self, writer: &mut dyn Write, png: bool) -> Result<()> { ... }
}Expand description
Trait that all QC analysis modules must implement.
Mirrors the QCModule Java interface method-for-method
(minus Swing GUI methods like getResultsPanel()).
Required Methods§
Sourcefn process_sequence(&mut self, sequence: &Sequence)
fn process_sequence(&mut self, sequence: &Sequence)
Process a single sequence record, accumulating statistics.
Sourcefn description(&self) -> &str
fn description(&self) -> &str
A longer description of what this module checks.
Sourcefn raises_error(&self) -> bool
fn raises_error(&self) -> bool
Whether the module results should trigger a failure status.
Sourcefn raises_warning(&self) -> bool
fn raises_warning(&self) -> bool
Whether the module results should trigger a warning status.
Sourcefn ignore_filtered_sequences(&self) -> bool
fn ignore_filtered_sequences(&self) -> bool
Whether this module should skip sequences flagged as filtered.
Sourcefn ignore_in_report(&self) -> bool
fn ignore_in_report(&self) -> bool
Whether this module should be excluded from the report.
Matches ignoreInReport() - used e.g. by PerTileQuality when
there are no tile IDs in the data.
Sourcefn write_text_report(&self, writer: &mut dyn Write) -> Result<()>
fn write_text_report(&self, writer: &mut dyn Write) -> Result<()>
Write this module’s section to the text report.
Provided Methods§
Sourcefn cost_hint(&self) -> u32
fn cost_hint(&self) -> u32
A rough, static hint of this module’s per-sequence processing cost relative to the other modules. It is used only to balance the modules across worker threads in the parallel analysis pipeline, so that the few expensive modules don’t pile onto one thread. The values are approximate and never affect results — a wrong hint only costs a little parallel efficiency, never correctness. Keep them in proportion to a profile of the default modules on short reads; the default suits a near-free module.
Sourcefn set_filename(&mut self, _name: &str)
fn set_filename(&mut self, _name: &str)
Set the source filename for this module. BasicStats uses this to display the filename in the report. Other modules ignore it.
Sourcefn attach_live_stats(&mut self, _live: Arc<LiveStats>)
fn attach_live_stats(&mut self, _live: Arc<LiveStats>)
Attach a shared snapshot sink that the module publishes partial results to while it runs, so the terminal progress display can show live statistics. Only BasicStats implements this; every other module ignores it, and nothing about the analysis changes when no sink is attached.
Sourcefn set_phred_encoding(&mut self, _encoding: PhredEncoding)
fn set_phred_encoding(&mut self, _encoding: PhredEncoding)
Tell the module the quality encoding specified by the input format, when there is one (BAM/SAM, where quality is Phred+33 by construction). Modules that would otherwise infer the encoding from the lowest quality character use this instead; other modules ignore it. Never called for formats like FASTQ where the encoding must be inferred.
Sourcefn finalize(&mut self)
fn finalize(&mut self)
Finalize calculations after all sequences have been processed.
In Java, modules lazily compute results in synchronized methods called from getResultsPanel()/makeReport()/raisesError()/raisesWarning(). In Rust, we separate the mutable computation phase (finalize) from the immutable reporting phase so that raises_error/raises_warning/write_text_report can take &self.
Sourcefn status(&self) -> ModuleStatus
fn status(&self) -> ModuleStatus
The current status of this module.
Sourcefn chart_image_name(&self) -> Option<&str>
fn chart_image_name(&self) -> Option<&str>
Return the base filename for this module’s chart image (without extension). Matches the filenames used in Images/ directory of the zip archive, e.g. “per_base_quality” for per_base_quality.png and per_base_quality.svg.
Sourcefn chart_alt_text(&self) -> Option<&str>
fn chart_alt_text(&self) -> Option<&str>
Return the alt text for this module’s chart image, if it has one.
Modules that produce charts should override this to return Some(“…”).
The default write_html_report uses this to call write_chart_and_table
automatically, so modules with charts only need to implement this method
instead of overriding write_html_report.
Sourcefn generate_chart_svg(&self) -> Option<String>
fn generate_chart_svg(&self) -> Option<String>
Generate the SVG chart content for this module, if applicable. In Java, writeDefaultImage() renders the Swing JPanel to both SVG and PNG. Here we generate SVG first, then convert to PNG via resvg.
Sourcefn write_html_report(&self, writer: &mut dyn Write, png: bool) -> Result<()>
fn write_html_report(&self, writer: &mut dyn Write, png: bool) -> Result<()>
Write this module’s HTML content (table and/or chart image) to the report.
In Java, each module’s makeReport() calls writeTable() which
calls writeXhtmlTable() then writeTextTable(). Some modules also call
writeDefaultImage() to embed a chart. The default implementation here
checks for chart_alt_text() – if present, it renders the chart and table
via write_chart_and_table; otherwise it renders just an HTML table from
the text report output, matching writeXhtmlTable().
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".