Package picard.util

## Class LiftoverUtils

- java.lang.Object
- - picard.util.LiftoverUtils

-     public class LiftoverUtils
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static Collection<String>` | `DEFAULT_TAGS_TO_DROP` |
    `static Collection<String>` | `DEFAULT_TAGS_TO_REVERSE` | Default list of attributes that need to be reversed or dropped from the INFO field when alleles have been swapped.
    `static htsjdk.samtools.util.Log` | `log` |
    `static String` | `REV_COMPED_ALLELES` |
    `static String` | `SWAPPED_ALLELES` | Attribute used to store the fact that the alt and ref alleles of the variant have been swapped, while all the INFO annotations have not.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LiftoverUtils()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected static List<String>` | `allelesToStringList​(List<htsjdk.variant.variantcontext.Allele> alleles)` | This is a utility method that will convert a list of alleles into a list of base strings.
    `protected static htsjdk.variant.variantcontext.GenotypesContext` | `fixGenotypes​(htsjdk.variant.variantcontext.GenotypesContext originals, List<htsjdk.variant.variantcontext.Allele> originalAlleles, List<htsjdk.variant.variantcontext.Allele> newAlleles)` |
    `protected static void` | `leftAlignVariant​(htsjdk.variant.variantcontext.VariantContextBuilder builder, int start, int end, List<htsjdk.variant.variantcontext.Allele> alleles, htsjdk.samtools.reference.ReferenceSequence referenceSequence)` | Normalizes and left aligns a `VariantContextBuilder`.
    `protected static htsjdk.variant.variantcontext.VariantContextBuilder` | `liftSimpleVariantContext​(htsjdk.variant.variantcontext.VariantContext source, htsjdk.samtools.util.Interval target)` |
    `static htsjdk.variant.variantcontext.VariantContext` | `liftVariant​(htsjdk.variant.variantcontext.VariantContext source, htsjdk.samtools.util.Interval target, htsjdk.samtools.reference.ReferenceSequence refSeq, boolean writeOriginalPosition, boolean writeOriginalAlleles)` | This will take an input VariantContext and lift to the provided interval.
    `protected static boolean` | `referenceAlleleMatchesReferenceForIndel​(List<htsjdk.variant.variantcontext.Allele> alleles, htsjdk.samtools.reference.ReferenceSequence referenceSequence, int start, int end)` | Checks whether the reference allele in the provided variant context actually matches the reference sequence
    `protected static htsjdk.variant.variantcontext.VariantContextBuilder` | `reverseComplementVariantContext​(htsjdk.variant.variantcontext.VariantContext source, htsjdk.samtools.util.Interval target, htsjdk.samtools.reference.ReferenceSequence refSeq)` |
    `static htsjdk.variant.variantcontext.VariantContext` | `swapRefAlt​(htsjdk.variant.variantcontext.VariantContext vc, Collection<String> annotationsToReverse, Collection<String> annotationsToDrop)` | method to swap the reference and alt alleles of a bi-allelic, SNP

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SWAPPED_ALLELES

          public static final String SWAPPED_ALLELES

      Attribute used to store the fact that the alt and ref alleles of the variant have been swapped, while all the INFO annotations have not.
      See Also:
        Constant Field Values

    - #### REV_COMPED_ALLELES

          public static final String REV_COMPED_ALLELES

      See Also:
        Constant Field Values

    - #### DEFAULT_TAGS_TO_REVERSE

          public static final Collection<String> DEFAULT_TAGS_TO_REVERSE

      Default list of attributes that need to be reversed or dropped from the INFO field when alleles have been swapped.

    - #### DEFAULT_TAGS_TO_DROP

          public static final Collection<String> DEFAULT_TAGS_TO_DROP

    - #### log

          public static final htsjdk.samtools.util.Log log

  - ### Constructor Detail

    - #### LiftoverUtils

          public LiftoverUtils()

  - ### Method Detail

    - #### liftVariant

          public static htsjdk.variant.variantcontext.VariantContext liftVariant​(htsjdk.variant.variantcontext.VariantContext source,
                                                                                 htsjdk.samtools.util.Interval target,
                                                                                 htsjdk.samtools.reference.ReferenceSequence refSeq,
                                                                                 boolean writeOriginalPosition,
                                                                                 boolean writeOriginalAlleles)

      This will take an input VariantContext and lift to the provided interval. If this interval is in the opposite orientation, all alleles and genotypes will be reverse complemented and indels will be left-aligned. Currently this is only able to invert biallelic indels, and null will be returned for any unsupported VC.
      Parameters:
        `source` - The VariantContext to lift
        `target` - The target interval
        `refSeq` - The reference sequence, which should match the target interval
        `writeOriginalPosition` - If true, INFO field annotations will be added to store the original position and contig
        `writeOriginalAlleles` - If true, an INFO field annotation will be added to store the original alleles in order. This can be useful in the case of more complex liftovers, like reverse complements, left aligned indels or swapped REF/ALT
      Returns:
        The lifted VariantContext. This will be null if the input VariantContext could not be lifted.

    - #### allelesToStringList

          protected static List<String> allelesToStringList​(List<htsjdk.variant.variantcontext.Allele> alleles)

      This is a utility method that will convert a list of alleles into a list of base strings. Reference status is ignored when creating these strings (i.e. 'A', not 'A*'). These strings should be sufficient to recreate an Allele using Allele.create()
      Parameters:
        `alleles` - The list of alleles
      Returns:
        A list of strings representing the bases of the input alleles.

    - #### liftSimpleVariantContext

          protected static htsjdk.variant.variantcontext.VariantContextBuilder liftSimpleVariantContext​(htsjdk.variant.variantcontext.VariantContext source,
                                                                                                        htsjdk.samtools.util.Interval target)

    - #### reverseComplementVariantContext

          protected static htsjdk.variant.variantcontext.VariantContextBuilder reverseComplementVariantContext​(htsjdk.variant.variantcontext.VariantContext source,
                                                                                                               htsjdk.samtools.util.Interval target,
                                                                                                               htsjdk.samtools.reference.ReferenceSequence refSeq)

    - #### fixGenotypes

          protected static htsjdk.variant.variantcontext.GenotypesContext fixGenotypes​(htsjdk.variant.variantcontext.GenotypesContext originals,
                                                                                       List<htsjdk.variant.variantcontext.Allele> originalAlleles,
                                                                                       List<htsjdk.variant.variantcontext.Allele> newAlleles)

    - #### swapRefAlt

          public static htsjdk.variant.variantcontext.VariantContext swapRefAlt​(htsjdk.variant.variantcontext.VariantContext vc,
                                                                                Collection<String> annotationsToReverse,
                                                                                Collection<String> annotationsToDrop)

      method to swap the reference and alt alleles of a bi-allelic, SNP
      Parameters:
        `vc` - the `VariantContext` (bi-allelic SNP) that needs to have it's REF and ALT alleles swapped.
        `annotationsToReverse` - INFO field annotations (of double value) that will be reversed (x->1-x)
        `annotationsToDrop` - INFO field annotations that will be dropped from the result since they are invalid when REF and ALT are swapped
      Returns:
        a new `VariantContext` with alleles swapped, INFO fields modified and in the genotypes, GT, AD and PL corrected appropriately

    - #### referenceAlleleMatchesReferenceForIndel

          protected static boolean referenceAlleleMatchesReferenceForIndel​(List<htsjdk.variant.variantcontext.Allele> alleles,
                                                                           htsjdk.samtools.reference.ReferenceSequence referenceSequence,
                                                                           int start,
                                                                           int end)

      Checks whether the reference allele in the provided variant context actually matches the reference sequence
      Parameters:
        `alleles` - list of alleles from which to find the reference allele
        `referenceSequence` - the ref sequence
        `start` - the start position of the actual indel
        `end` - the end position of the actual indel
      Returns:
        true if they match, false otherwise

    - #### leftAlignVariant

          protected static void leftAlignVariant​(htsjdk.variant.variantcontext.VariantContextBuilder builder,
                                                 int start,
                                                 int end,
                                                 List<htsjdk.variant.variantcontext.Allele> alleles,
                                                 htsjdk.samtools.reference.ReferenceSequence referenceSequence)

      Normalizes and left aligns a `VariantContextBuilder`. Note: this will modify the start/stop and alleles of this builder. Also note: if the reference allele does not match the reference sequence, this method will throw an exception Based on Adrian Tan, Gonçalo R. Abecasis and Hyun Min Kang. (2015) Unified Representation of Genetic Variants. Bioinformatics.