org.biojava3.core.sequence
Class GeneSequence

java.lang.Object
  extended by org.biojava3.core.sequence.template.AbstractSequence<NucleotideCompound>
      extended by org.biojava3.core.sequence.DNASequence
          extended by org.biojava3.core.sequence.GeneSequence
All Implemented Interfaces:
Iterable<NucleotideCompound>, Accessioned, Sequence<NucleotideCompound>

public class GeneSequence
extends DNASequence

Author:
Scooter Willis

Nested Class Summary
 
Nested classes/interfaces inherited from class org.biojava3.core.sequence.DNASequence
DNASequence.DNAType
 
Nested classes/interfaces inherited from class org.biojava3.core.sequence.template.AbstractSequence
AbstractSequence.AnnotationType
 
Constructor Summary
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.
 
Method Summary
 ExonSequence addExon(AccessionID accession, int begin, int end)
          Add an ExonSequence mainly used to mark as a feature
 IntronSequence addIntron(AccessionID accession, int begin, int end)
          Add an Intron Currently used to mark an IntronSequence as a feature
 void addIntronsUsingExons()
          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.
 TranscriptSequence addTranscript(AccessionID accession, int begin, int end)
          Add a transcription sequence to a gene which describes a ProteinSequence
 ArrayList<ExonSequence> getExonSequences()
          Get the exons as an ArrayList
 ArrayList<IntronSequence> getIntronSequences()
          Get the introns as an ArrayList
 int getLength()
          Returns the length of the Sequence
 ChromosomeSequence getParentChromosomeSequence()
          The parent ChromosomeSequence which contains the actual DNA sequence data
 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
 Strand getStrand()
          A gene should have Strand
 TranscriptSequence getTranscript(String accession)
          Get the transcript sequence by accession
 LinkedHashMap<String,TranscriptSequence> getTranscripts()
          Get the collection of transcription sequences assigned to this gene
 ExonSequence removeExon(String accession)
          Remove the exon sequence
 IntronSequence removeIntron(String accession)
          Remove the intron by accession
 TranscriptSequence removeTranscript(String accession)
          Remove the transcript sequence from the gene
 void setStrand(Strand strand)
           
 
Methods inherited from class org.biojava3.core.sequence.DNASequence
getComplement, getDNAType, getGCCount, getReverse, getReverseComplement, getRNASequence, getRNASequence, getRNASequence, getRNASequence, main, setDNAType
 
Methods inherited from class org.biojava3.core.sequence.template.AbstractSequence
addFeature, addFeature, addNote, countCompounds, getAccession, getAnnotationType, getAsList, getBioBegin, getBioEnd, getCompoundAt, getCompoundSet, getDatabaseReferences, getDescription, getFeatures, getFeatures, getFeatures, getFeaturesByType, getFeaturesKeyWord, getIndexOf, getInverse, getLastIndexOf, getNotesList, getOriginalHeader, getParentSequence, getProxySequenceReader, getSequenceAsString, getSequenceAsString, getSequenceScore, getSource, getSubSequence, getTaxonomy, getUserCollection, iterator, removeFeature, removeNote, setAccession, setAnnotationType, setBioBegin, setBioEnd, setCompoundSet, setDatabaseReferences, setDescription, setFeaturesKeyWord, setNotesList, setOriginalHeader, setParentSequence, setProxySequenceReader, setSequenceScore, setSource, setTaxonomy, setUserCollection, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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