uk.ac.sanger.psu.gfmerge.util.biotools
Class BioTools

java.lang.Object
  extended by uk.ac.sanger.psu.gfmerge.util.biotools.BioTools

public class BioTools
extends java.lang.Object

class BioTools contains basic processing tools within GFMerge.

Version:
1.0
Author:
Sebastian R. Spiegler

Constructor Summary
BioTools()
           
 
Method Summary
static MyTreeMap addToTreeMap(MyTreeMap tMap, java.util.ArrayList locatableArrList)
          AddToTreeMap method creates a binary tree of locateable objects sorted by their start location.
static org.biojava.bio.seq.Sequence createNewSeqOfPickedGms(org.biojava.bio.seq.Sequence thisPredSeq, java.util.ArrayList thisRegionsOfPickedGmsArr)
          method which creates sequence object of a sequence and picked genemodels.
private static java.util.ArrayList find(LocateAble obj, java.util.HashMap doneObjects, MyTreeMap tMap)
          Find method contains recursive search for regions.
private static java.util.ArrayList findOverlaps(LocateAble obj, MyTreeMap tMap)
          FindOverlaps method returns all overlapping objects in tree of objects.
static java.lang.String getGenePredicterFromSequence(org.biojava.bio.seq.Sequence _sequence, java.lang.String _fname)
          method returns genefinder name of geneprediction if all features have the same 'method' value in the prediction file otherwise it throughs an exception.
static boolean overlaps(org.biojava.bio.symbol.Location locOrg, org.biojava.bio.symbol.Location locComp)
          Overlaps method contains the BioJava overlap functionality and checks whether one location is contained by the other
static java.util.ArrayList search(MyTreeMap tMap)
          Search method calculates regions of overlapping features.
static org.biojava.bio.seq.Sequence seqs2Seq(org.biojava.bio.seq.SequenceIterator sequences)
          Seq2Seq method returns a sequence object when sequence iterator is given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BioTools

public BioTools()
Method Detail

seqs2Seq

public static org.biojava.bio.seq.Sequence seqs2Seq(org.biojava.bio.seq.SequenceIterator sequences)
                                             throws org.biojava.bio.BioException
Seq2Seq method returns a sequence object when sequence iterator is given.

Called by the main method in GFMerge.

Parameters:
sequences - SequenceIterator object which may contain more than one more than one sequence, but only the first sequence is returned
Returns:
Sequence Sequence object
Throws:
org.biojava.bio.BioException
See Also:
SequenceIterator, Sequence

getGenePredicterFromSequence

public static java.lang.String getGenePredicterFromSequence(org.biojava.bio.seq.Sequence _sequence,
                                                            java.lang.String _fname)
method returns genefinder name of geneprediction if all features have the same 'method' value in the prediction file otherwise it throughs an exception.

Called by the main method in GFMerge.

Parameters:
_sequence - Sequence object
_fname - filename of the prediction file which is needed for the exception method
Returns:
String method value of the prediction file
Throws:
java.util.NoSuchElementException - If no method entry is in file
"Exception" - If different method values are in file
See Also:
Sequence

createNewSeqOfPickedGms

public static org.biojava.bio.seq.Sequence createNewSeqOfPickedGms(org.biojava.bio.seq.Sequence thisPredSeq,
                                                                   java.util.ArrayList thisRegionsOfPickedGmsArr)
method which creates sequence object of a sequence and picked genemodels.

Parameters:
thisPredSeq - BioJava sequence object
thisRegionsOfPickedGmsArr - ArrayList of genemodel regions containing highscoring genemodels
Returns:
new BioJava sequence object containing picked genemodels

search

public static java.util.ArrayList search(MyTreeMap tMap)
Search method calculates regions of overlapping features.

Recursive computing of features sorted by start position in order to retrieve regions of continuously overlapping features (genemodel, cDNA, Blast)

Parameters:
tMap - binary tree instanced from MyTreeMap each key-value-pair contains the start location of features as key and an array of LocateAble as value
Returns:
ArrayList of Regions which contain themselves LocateAble objects
See Also:
MyTreeMap, LocateAble

find

private static java.util.ArrayList find(LocateAble obj,
                                        java.util.HashMap doneObjects,
                                        MyTreeMap tMap)
Find method contains recursive search for regions.

Called by the search method in BioTools.

Parameters:
obj - feature object with Location (genemodel, cDNA, Blast)
doneObjects - HashMap of seen objects
tMap - binary tree instanced from MyTreeMap each key-value-pair contains the start location of features as key and an array of LocateAble as value
gm - objects of LocateAble for which overlaps are searched for
doneObjs - tree of HashMap which contains processed objects
Returns:
ArrayList of regions which are list of overlapping LocateAble objects

findOverlaps

private static java.util.ArrayList findOverlaps(LocateAble obj,
                                                MyTreeMap tMap)
FindOverlaps method returns all overlapping objects in tree of objects.

Called by the find method in BioTools.

Parameters:
obj - objects of LocateAble for which overlaps are searched for
tMap - binary tree instanced from MyTreeMap each key-value-pair contains the start location of features as key and an array of LocateAble as value
Returns:
ArrayList of LocateAble objects which overlap a certain LocateAble object

overlaps

public static boolean overlaps(org.biojava.bio.symbol.Location locOrg,
                               org.biojava.bio.symbol.Location locComp)
Overlaps method contains the BioJava overlap functionality and checks whether one location is contained by the other

It was introduced because BioJava just compares sub locations and does not consider overlaps of introns

Parameters:
locOrg - original location
locComp - location to compare
Returns:
boolean overlaps

addToTreeMap

public static MyTreeMap addToTreeMap(MyTreeMap tMap,
                                     java.util.ArrayList locatableArrList)
AddToTreeMap method creates a binary tree of locateable objects sorted by their start location.

Key is the start location of a LocateAble object, Value is an array of LocateAble objects with the same start location

Parameters:
tMap - binary tree instanced from MyTreeMap each key-value-pair contains the start location of features as key and an array of LocateAble as value. tree is empty when called first, new leaves will be added.
locatableArrList - ArrayList of LocateAble objects
Returns:
MyTreeMap binary tree of LocateAble objects
See Also:
MyTreeMap, LocateAble