Package op

Class VariantAnnotator

java.lang.Object
op.VariantAnnotator

public class VariantAnnotator extends Object
The VariantAnnotator class provides functionality to annotate variants.

Currently, it supports annotation using SnpEff, a popular tool for annotating and predicting the effects of genetic variants.

This class is responsible for managing the workflow of variant annotation, including preparing input data, executing SnpEff commands, and processing the output to update the storage with annotated variants. It handles temporary file management and error logging to ensure a smooth annotation process.

  • Constructor Details

    • VariantAnnotator

      public VariantAnnotator(Storage storage)
      Constructs a new instance of the VariantAnnotator class.

      This constructor initializes the VariantAnnotator with the provided Storage object.

      Parameters:
      storage - The Storage object used to manage genomic data.
  • Method Details

    • runSnpEff

      public void runSnpEff(Path outputDirectory) throws MusialException, IOException
      Runs variant annotation using SnpEff on the Storage.

      This method performs the following steps:

      • Checks if the storage contains active variants to annotate. If not, throws an IllegalArgumentException.
      • Creates a temporary directory for SnpEff files and configurations.
      • Writes the active variants from the storage to a temporary VCF file.
      • Copies the SnpEff configuration and JAR files to the temporary directory.
      • Writes the reference genome and features files to the appropriate locations in the temporary directory.
      • Updates the SnpEff configuration file with reference genome information.
      • Builds the SnpEff database using the reference genome information.
      • Runs the SnpEff annotation on the temporary VCF file.
      • Processes the annotation results and updates the storage with the annotated data.
      • Handles errors during the SnpEff build and annotation processes, logging them and saving error logs to the output directory.
      • Cleans up the temporary directory after the analysis is complete.
      Parameters:
      outputDirectory - The output directory to write log files to, if needed.
      Throws:
      MusialException - If the SnpEff annotation process fails.
      IOException - If an error occurs while reading or writing files.