Class GeneSequence

All Implemented Interfaces:
Iterable<NucleotideCompound>, Accessioned, Sequence<NucleotideCompound>

public class GeneSequence extends DNASequence
Author:
Scooter Willis
  • Constructor Details

    • GeneSequence

      public GeneSequence(ChromosomeSequence parentSequence, int begin, int end, Strand strand)
      A class that keeps track of the details of a GeneSequence which is difficult to properly model. Two important concepts that is difficult to make everything flexible but still work. You can have GFF features that only describe Exons or Exons/Introns or CDS regions and one or more Transcriptions. You can have exon sequences but that does not imply transcription to the actual protein. The GeneSequence will keep track of Exons and Introns but to get a Protein sequence you need to start with a TranscriptSequence and then add CDS sequences. This is also a key class in the biojava-3-genome module for reading and writing GFF3 files
      Parameters:
      parentDNASequence -
      begin -
      end - inclusive of end
      strand - force a gene to have strand and transcription sequence will inherit
  • Method Details

    • getParentChromosomeSequence

      public ChromosomeSequence getParentChromosomeSequence()
      The parent ChromosomeSequence which contains the actual DNA sequence data
      Returns:
      Chromosome sequence
    • getLength

      public int getLength()
      Description copied from interface: Sequence
      Returns the length of the Sequence
      Specified by:
      getLength in interface Sequence<NucleotideCompound>
      Overrides:
      getLength in class AbstractSequence<NucleotideCompound>
    • addIntronsUsingExons

      public void addIntronsUsingExons() throws Exception
      Once everything has been added to the gene sequence where you might have added exon sequences only then you can infer the intron sequences and add them. You may also have the case where you only added one or more TranscriptSequences and from that you can infer the exon sequences and intron sequences. Currently not implement
      Throws:
      Exception
    • getStrand

      public Strand getStrand()
      A gene should have Strand
      Returns:
      the strand
    • setStrand

      public void setStrand(Strand strand)
      Parameters:
      strand - the strand to set
    • getTranscript

      public TranscriptSequence getTranscript(String accession)
      Get the transcript sequence by accession
      Parameters:
      accession -
      Returns:
      the transcript
    • getTranscripts

      public LinkedHashMap<String,TranscriptSequence> getTranscripts()
      Get the collection of transcription sequences assigned to this gene
      Returns:
      transcripts
    • removeTranscript

      public TranscriptSequence removeTranscript(String accession)
      Remove the transcript sequence from the gene
      Parameters:
      accession -
      Returns:
      transcriptsequence
    • addTranscript

      public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception
      Add a transcription sequence to a gene which describes a ProteinSequence
      Parameters:
      accession -
      begin -
      end -
      Returns:
      transcript sequence
      Throws:
      Exception - If the accession id is already used
    • removeIntron

      public IntronSequence removeIntron(String accession)
      Remove the intron by accession
      Parameters:
      accession -
      Returns:
      intron sequence
    • addIntron

      public IntronSequence addIntron(AccessionID accession, int begin, int end) throws Exception
      Add an Intron Currently used to mark an IntronSequence as a feature
      Parameters:
      accession -
      begin -
      end -
      Returns:
      intron sequence
      Throws:
      Exception
    • removeExon

      public ExonSequence removeExon(String accession)
      Remove the exon sequence
      Parameters:
      accession -
      Returns:
      exon sequence
    • addExon

      public ExonSequence addExon(AccessionID accession, int begin, int end) throws Exception
      Add an ExonSequence mainly used to mark as a feature
      Parameters:
      accession -
      begin -
      end -
      Returns:
      exon sequence
      Throws:
      Exception
    • getExonSequences

      public ArrayList<ExonSequence> getExonSequences()
      Get the exons as an ArrayList
      Returns:
      exons
    • getIntronSequences

      public ArrayList<IntronSequence> getIntronSequences()
      Get the introns as an ArrayList
      Returns:
      introns
    • getSequence5PrimeTo3Prime

      public DNASequence getSequence5PrimeTo3Prime()
      Try to give method clarity where you want a DNASequence coding in the 5' to 3' direction Returns the DNASequence representative of the 5' and 3' reading based on strand
      Returns:
      dna sequence