Class ExternalFileGeneLoaderServiceImpl

java.lang.Object
ubic.gemma.core.loader.genome.gene.ExternalFileGeneLoaderServiceImpl
All Implemented Interfaces:
ExternalFileGeneLoaderService

@Component public class ExternalFileGeneLoaderServiceImpl extends Object implements ExternalFileGeneLoaderService
Class to provide functionality to load genes from a tab delimited file. Typical usage is for non model organisms that do not have genes in NCBI. Supports loading genes against a non species taxon such as a family e.g Salmonids. File format is : Optional header which should be appended with a # to indicate not to process this line Then a line containing 3 fields which should be 'Gene Symbol' 'Gene Name' 'UniProt id' (last is optional) separated by tabs. The Class reads the file and looping through each line creates a gene (NCBI id is null) and one associated gene product. The gene is populated with gene symbol, gene name, gene official name (gene symbol) and a description indicating that this gene has been loaded from a text file. Then gene is associated with a gene product bearing the same name as the gene symbol and persisted.
Author:
ldonnison
  • Constructor Details

    • ExternalFileGeneLoaderServiceImpl

      public ExternalFileGeneLoaderServiceImpl()
  • Method Details

    • load

      public int load(InputStream geneInputStream, String taxonName) throws Exception
      Specified by:
      load in interface ExternalFileGeneLoaderService
      Parameters:
      geneInputStream - gene input stream
      taxonName - taxon name
      Returns:
      number of genes loaded
      Throws:
      Exception - Thrown with a file format error or problem in persisting gene to database.
    • load

      public int load(String geneFile, String taxonName) throws Exception
      Description copied from interface: ExternalFileGeneLoaderService
      Work flow is: The file is first checked to see if readable, and the taxon checked to see it is in Gemma. If validation passes the file is read line by line. Each line equates to a gene and its gene product, which is created from the file details. The gene is then persisted. If successfully loaded taxon flag isGenesLoaded is set to true to indicate that there are genes loaded for this taxon.
      Specified by:
      load in interface ExternalFileGeneLoaderService
      Parameters:
      geneFile - Full path to file containing genes details
      taxonName - taxonName to be associated to this gene, does not have to be a species.
      Returns:
      number of genes loaded
      Throws:
      Exception - Thrown with a file format error or problem in persisting gene to database.