Package org.biojava.nbio.core.sequence
Class GeneSequence
- java.lang.Object
-
- org.biojava.nbio.core.sequence.template.AbstractSequence<NucleotideCompound>
-
- org.biojava.nbio.core.sequence.DNASequence
-
- org.biojava.nbio.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.biojava.nbio.core.sequence.DNASequence
DNASequence.DNAType
-
Nested classes/interfaces inherited from class org.biojava.nbio.core.sequence.template.AbstractSequence
AbstractSequence.AnnotationType
-
-
Constructor Summary
Constructors Constructor Description GeneSequence(ChromosomeSequence parentSequence, int begin, int end, Strand strand)
Deprecated.GeneSequence(ChromosomeSequence parentSequence, AccessionID accessionId, 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExonSequence
addExon(AccessionID accession, int begin, int end)
Add an ExonSequence mainly used to mark as a featureIntronSequence
addIntron(AccessionID accession, int begin, int end)
Add an Intron Currently used to mark an IntronSequence as a featurevoid
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 ProteinSequenceArrayList<ExonSequence>
getExonSequences()
Get the exons as an ArrayList.ArrayList<IntronSequence>
getIntronSequences()
Get the introns as an ArrayList.int
getLength()
Returns the length of the SequenceChromosomeSequence
getParentChromosomeSequence()
The parent ChromosomeSequence which contains the actual DNA sequence dataDNASequence
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 strandStrand
getStrand()
A gene should have StrandTranscriptSequence
getTranscript(String accession)
Get the transcript sequence by accessionLinkedHashMap<String,TranscriptSequence>
getTranscripts()
Get the collection of transcription sequences assigned to this geneExonSequence
removeExon(String accession)
Remove the exon sequenceIntronSequence
removeIntron(String accession)
Remove the intron by accessionTranscriptSequence
removeTranscript(String accession)
Remove the transcript sequence from the genevoid
setStrand(Strand strand)
-
Methods inherited from class org.biojava.nbio.core.sequence.DNASequence
getComplement, getDNAType, getGCCount, getReverse, getReverseComplement, getRNASequence, getRNASequence, getRNASequence, getRNASequence, setDNAType
-
Methods inherited from class org.biojava.nbio.core.sequence.template.AbstractSequence
addFeature, addFeature, addNote, countCompounds, equals, getAccession, getAnnotationType, getAsList, getBioBegin, getBioEnd, getComments, getCompoundAt, getCompoundSet, getDatabaseReferences, getDescription, getFeatureRetriever, getFeatures, getFeatures, getFeatures, getFeaturesByType, getFeaturesKeyWord, getIndexOf, getInverse, getLastIndexOf, getNotesList, getOriginalHeader, getParentSequence, getProxySequenceReader, getReferences, getSequenceAsString, getSequenceAsString, getSequenceScore, getSource, getSubSequence, getTaxonomy, getUserCollection, hashCode, initSequenceStorage, iterator, removeFeature, removeNote, setAccession, setAnnotationType, setBioBegin, setBioEnd, setComments, setCompoundSet, setDatabaseReferences, setDescription, setFeatureRetriever, setFeaturesKeyWord, setNotesList, setOriginalHeader, setParentSequence, setProxySequenceReader, setReferences, setSequenceScore, setSource, setTaxonomy, setUserCollection, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
GeneSequence
public GeneSequence(ChromosomeSequence parentSequence, int begin, int end, Strand strand)
Deprecated.Use GeneSequence(ChromosomeSequence parentSequence, AccessionID accessionId, int begin, int end, Strand strand) which mandates an accessionID.- Parameters:
parentSequence
-begin
-end
- inclusive of endstrand
- force a gene to have strand and transcription sequence will inherit
-
GeneSequence
public GeneSequence(ChromosomeSequence parentSequence, AccessionID accessionId, 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:
parentSequence
-accessionId
- An identifier for the gene.begin
-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 interfaceSequence<NucleotideCompound>
- Overrides:
getLength
in classAbstractSequence<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
-
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:
- the removed intron sequence, or null if no intron with that accession exists.
-
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)
Add an ExonSequence mainly used to mark as a feature- Parameters:
accession
-begin
-end
-- Returns:
- exon sequence
- Throws:
IllegalArgumentException
- if accessionID is already added.
-
getExonSequences
public ArrayList<ExonSequence> getExonSequences()
Get the exons as an ArrayList. Modifying this list will not modify the underlying collection- Returns:
- exons
-
getIntronSequences
public ArrayList<IntronSequence> getIntronSequences()
Get the introns as an ArrayList. Modifying this list will not modify the underlying collection- 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 or null if sequence could not be generated.
-
-