Class ChromosomeMappingTools


  • public class ChromosomeMappingTools
    extends java.lang.Object
    A class that can map chromosomal positions to mRNA (coding sequence) positions.
    Author:
    Andreas Prlic
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CDS  
      static java.lang.String CHROMOSOME  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String formatExonStructure​(GeneChromosomePosition chromosomePosition)
      Pretty print the details of a GeneChromosomePosition to a String
      static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getCDSExonRanges​(GeneChromosomePosition chromPos)
      Extracts the exon boundaries in CDS coordinates.
      static int getCDSLength​(GeneChromosomePosition chromPos)
      Get the length of the CDS in nucleotides.
      static int getCDSLengthForward​(java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Get the length of the coding sequence
      static int getCDSLengthReverse​(java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Get the length of the coding sequence
      static int getCDSPosForChromosomeCoordinate​(int coordinate, GeneChromosomePosition chromosomePosition)
      I have a genomic coordinate, where is it on the mRNA
      static int getCDSPosForward​(int chromPos, java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the forward DNA strand.
      static int getCDSPosReverse​(int chromPos, java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the reverse DNA strand.
      static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getCDSRegions​(java.util.List<java.lang.Integer> origExonStarts, java.util.List<java.lang.Integer> origExonEnds, int cdsStart, int cdsEnd)
      Extracts the exons boundaries in CDS coordinates corresponding to the forward DNA strand.
      static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getChromosomalRangesForCDS​(GeneChromosomePosition chromPos)
      Extracts the boundaries of the coding regions in chromosomal coordinates
      static ChromPos getChromosomePosForCDScoordinate​(int cdsNucleotidePosition, GeneChromosomePosition chromPos)
      Maps the position of a CDS nucleotide back to the genome
      static ChromPos getChromPosForward​(int cdsPos, java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Get the CDS position mapped onto the chromosome position
      static ChromPos getChromPosReverse​(int cdsPos, java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd)
      Get the CDS position mapped on the chromosome position
      static DNASequence getTranscriptDNASequence​(TwoBitFacade twoBitFacade, java.lang.String chromosome, java.util.List<java.lang.Integer> exonStarts, java.util.List<java.lang.Integer> exonEnds, int cdsStart, int cdsEnd, java.lang.Character orientation)
      Extracts the DNA sequence transcribed from the input genetic coordinates.
      static DNASequence getTranscriptDNASequence​(TwoBitFacade twoBitFacade, GeneChromosomePosition gcp)
      Extracts the DNA sequence transcribed from the input genetic coordinates.
      static void setCoordinateSystem​(int baseInt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ChromosomeMappingTools

        public ChromosomeMappingTools()
    • Method Detail

      • setCoordinateSystem

        public static void setCoordinateSystem​(int baseInt)
      • formatExonStructure

        public static java.lang.String formatExonStructure​(GeneChromosomePosition chromosomePosition)
        Pretty print the details of a GeneChromosomePosition to a String
        Parameters:
        chromosomePosition -
        Returns:
      • getCDSLength

        public static int getCDSLength​(GeneChromosomePosition chromPos)
        Get the length of the CDS in nucleotides.
        Parameters:
        chromPos -
        Returns:
        length of the CDS in nucleotides.
      • getChromosomePosForCDScoordinate

        public static ChromPos getChromosomePosForCDScoordinate​(int cdsNucleotidePosition,
                                                                GeneChromosomePosition chromPos)
        Maps the position of a CDS nucleotide back to the genome
        Parameters:
        cdsNucleotidePosition -
        Returns:
        a ChromPos object
      • getChromPosReverse

        public static ChromPos getChromPosReverse​(int cdsPos,
                                                  java.util.List<java.lang.Integer> exonStarts,
                                                  java.util.List<java.lang.Integer> exonEnds,
                                                  int cdsStart,
                                                  int cdsEnd)
        Get the CDS position mapped on the chromosome position
        Parameters:
        exonStarts -
        exonEnds -
        cdsStart -
        cdsEnd -
        Returns:
      • getChromPosForward

        public static ChromPos getChromPosForward​(int cdsPos,
                                                  java.util.List<java.lang.Integer> exonStarts,
                                                  java.util.List<java.lang.Integer> exonEnds,
                                                  int cdsStart,
                                                  int cdsEnd)
        Get the CDS position mapped onto the chromosome position
        Parameters:
        exonStarts -
        exonEnds -
        cdsStart -
        cdsEnd -
        Returns:
      • getCDSLengthReverse

        public static int getCDSLengthReverse​(java.util.List<java.lang.Integer> exonStarts,
                                              java.util.List<java.lang.Integer> exonEnds,
                                              int cdsStart,
                                              int cdsEnd)
        Get the length of the coding sequence
        Parameters:
        exonStarts -
        exonEnds -
        cdsStart -
        cdsEnd -
        Returns:
      • getCDSLengthForward

        public static int getCDSLengthForward​(java.util.List<java.lang.Integer> exonStarts,
                                              java.util.List<java.lang.Integer> exonEnds,
                                              int cdsStart,
                                              int cdsEnd)
        Get the length of the coding sequence
        Parameters:
        exonStarts -
        exonEnds -
        cdsStart -
        cdsEnd -
        Returns:
      • getCDSExonRanges

        public static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getCDSExonRanges​(GeneChromosomePosition chromPos)
        Extracts the exon boundaries in CDS coordinates. (needs to be divided by 3 to get AA positions)
        Parameters:
        chromPos -
        Returns:
      • getChromosomalRangesForCDS

        public static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getChromosomalRangesForCDS​(GeneChromosomePosition chromPos)
        Extracts the boundaries of the coding regions in chromosomal coordinates
        Parameters:
        chromPos -
        Returns:
      • getCDSPosForChromosomeCoordinate

        public static int getCDSPosForChromosomeCoordinate​(int coordinate,
                                                           GeneChromosomePosition chromosomePosition)
        I have a genomic coordinate, where is it on the mRNA
        Parameters:
        coordinate -
        chromosomePosition -
        Returns:
      • getCDSPosForward

        public static int getCDSPosForward​(int chromPos,
                                           java.util.List<java.lang.Integer> exonStarts,
                                           java.util.List<java.lang.Integer> exonEnds,
                                           int cdsStart,
                                           int cdsEnd)
        Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the forward DNA strand.
        Parameters:
        chromPos - The genetic coordinate on a chromosome
        exonStarts - The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)
        exonEnds - The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
        cdsStart - The start position of a coding region
        cdsEnd - The end position of a coding region
        Returns:
        the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
      • getCDSPosReverse

        public static int getCDSPosReverse​(int chromPos,
                                           java.util.List<java.lang.Integer> exonStarts,
                                           java.util.List<java.lang.Integer> exonEnds,
                                           int cdsStart,
                                           int cdsEnd)
        Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the reverse DNA strand.
        Parameters:
        chromPos - The genetic coordinate on a chromosome
        exonStarts - The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)
        exonEnds - The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
        cdsStart - The start position of a coding region
        cdsEnd - The end position of a coding region
        Returns:
        the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
      • getCDSRegions

        public static java.util.List<com.google.common.collect.Range<java.lang.Integer>> getCDSRegions​(java.util.List<java.lang.Integer> origExonStarts,
                                                                                                       java.util.List<java.lang.Integer> origExonEnds,
                                                                                                       int cdsStart,
                                                                                                       int cdsEnd)
        Extracts the exons boundaries in CDS coordinates corresponding to the forward DNA strand.
        Parameters:
        origExonStarts - The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)
        origExonEnds - The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
        cdsStart - The start position of a coding region
        cdsEnd - The end position of a coding region
        Returns:
        the list of genetic positions corresponding to the exons boundaries in CDS coordinates
      • getTranscriptDNASequence

        public static DNASequence getTranscriptDNASequence​(TwoBitFacade twoBitFacade,
                                                           GeneChromosomePosition gcp)
                                                    throws java.lang.Exception
        Extracts the DNA sequence transcribed from the input genetic coordinates.
        Parameters:
        twoBitFacade - the facade that provide an access to a 2bit file
        gcp - The container with chromosomal positions
        Returns:
        the DNA sequence transcribed from the input genetic coordinates
        Throws:
        java.lang.Exception
      • getTranscriptDNASequence

        public static DNASequence getTranscriptDNASequence​(TwoBitFacade twoBitFacade,
                                                           java.lang.String chromosome,
                                                           java.util.List<java.lang.Integer> exonStarts,
                                                           java.util.List<java.lang.Integer> exonEnds,
                                                           int cdsStart,
                                                           int cdsEnd,
                                                           java.lang.Character orientation)
                                                    throws java.lang.Exception
        Extracts the DNA sequence transcribed from the input genetic coordinates.
        Parameters:
        chromosome - the name of the chromosome
        exonStarts - The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)
        exonEnds - The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
        cdsStart - The start position of a coding region
        cdsEnd - The end position of a coding region
        orientation - The orientation of the strand where the gene is living
        Returns:
        the DNA sequence transcribed from the input genetic coordinates
        Throws:
        java.lang.Exception