Class MergeDuplicateBibRefsCli

All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.EnvironmentAware, CLI

public class MergeDuplicateBibRefsCli extends AbstractAuthenticatedCLI
Merge duplicate BibliographicReference rows that share a PubMed accession.

Prod has accessions with 2-3 duplicate bibref rows (a data issue that 500'd PUT /datasets/{id}/publications until the read-side lookups were made duplicate-tolerant). For each targeted PubMed id this CLI keeps the lowest-id (oldest, canonical) row, repoints every experiment that references a duplicate (its primaryPublication and its otherRelevantPublications) onto the canonical row, and then deletes the now-unreferenced duplicate.

Safety: it is a dry run by default — it reports exactly what it would do and changes nothing unless -commit is given. Even with -commit, a duplicate is deleted only after its experiment references are repointed and a re-check finds no experiment still pointing at it; if the delete fails because something outside the experiment surface still holds the row (e.g. a GeneSet.literatureSources), it is left in place and logged rather than forced. Nothing is merged that would lose a reference.

Author:
gemma
  • Constructor Details

    • MergeDuplicateBibRefsCli

      public MergeDuplicateBibRefsCli()
  • Method Details

    • getCommandName

      public String getCommandName()
      Description copied from interface: CLI
      A short memorable name for the command that can be used to locate this class.
      Specified by:
      getCommandName in interface CLI
      Overrides:
      getCommandName in class AbstractCLI
      Returns:
      name; if null or blank, this will not be available as a shortcut command.
    • getShortDesc

      public String getShortDesc()
      Description copied from interface: CLI
      Obtain a short description for this command explaining what it does.
      Specified by:
      getShortDesc in interface CLI
      Overrides:
      getShortDesc in class AbstractCLI
    • getCommandGroup

      public CLI.CommandGroup getCommandGroup()
      Description copied from interface: CLI
      Obtain the command group for this CLI.
      Specified by:
      getCommandGroup in interface CLI
      Overrides:
      getCommandGroup in class AbstractCLI
    • buildOptions

      protected void buildOptions(org.apache.commons.cli.Options options)
      Description copied from class: AbstractCLI
      Build option implementation.

      Implement this method to add options to your command line, using the OptionBuilder.

      This is called right after AbstractCLI.buildStandardOptions(Options) so the options will be added after standard options.

      Overrides:
      buildOptions in class AbstractCLI
    • processOptions

      protected void processOptions(org.apache.commons.cli.CommandLine commandLine)
      Description copied from class: AbstractCLI
      Process command line options.

      Implement this to provide processing of options. It is called after AbstractCLI.buildOptions(Options) and right before AbstractCLI.doWork().

      Overrides:
      processOptions in class AbstractCLI
    • doAuthenticatedWork

      protected void doAuthenticatedWork() throws Exception
      Specified by:
      doAuthenticatedWork in class AbstractAuthenticatedCLI
      Throws:
      Exception