public class KRModel extends java.lang.Object implements ProbCREModel, java.lang.Comparable<KRModel>, Binnable
Modifier and Type | Field and Description |
---|---|
private double |
beta |
static double |
BETA |
private double[][] |
bgProbs |
private PWM |
consensus |
private double[][] |
consProbs |
static double |
DEFAULT_STRINGENCY
Default upper bound for sum of -log(base_probability) for the bases in a sequence in order for that sequence to get output by
expandAsStrings() and expandAsMotifList() ; |
static double |
PSEUDO
The pseudo count is added to every count when calculating the probabilities.
|
private double |
score |
private double[][][] |
siteProbs |
private PWM[] |
sites |
private double |
stringency |
DEFAULT_RC
Constructor and Description |
---|
KRModel()
This creates an empty PWM--most methods will cause unchecked exceptions to be thrown.
|
KRModel(double beta)
This creates an empty PWM with a specific beta--most methods will cause unchecked exceptions to be thrown.
|
KRModel(Motif[] m,
MotifFinder mf)
Converts an array of unambiguous motifs of the same length and same reverse complement status into a KRModel.
|
KRModel(MotifList ml)
Converts a whitespace-delimited table into a position-weight matrix with the given reverse complement flag, and with stringency set to
DEFAULT_STRINGENCY . |
KRModel(Motif m,
MotifFinder mf)
Converts a consensus motif into a position-weight matrix.
|
KRModel(java.lang.String[] rows)
Converts a whitespace-delimited table into a position-weight matrix with the reverse complement flagset to
CREModel.DEFAULT_RC ,
and with stringency set to DEFAULT_STRINGENCY . |
KRModel(java.lang.String[] rows,
boolean rc)
Converts a whitespace-delimited table into a position-weight matrix with the given reverse complement flag, and with stringency set to
DEFAULT_STRINGENCY . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(KRModel m)
Allows Arrays.sort() to sort pwm's by score in descending order; not consistent with
equals(Object) . |
boolean |
equals(java.lang.Object o)
Not implemented yet.
|
MotifList |
expandAsMotifList()
This method has not been implemented.
|
MotifList |
expandAsMotifList(MotifFinder mf)
This method has not been implemented.
|
java.lang.String[] |
expandAsStrings()
This method has not been implemented.
|
java.lang.String[] |
expandAsStrings(MotifFinder mf)
This method has not been implemented.
|
boolean |
generatesString(java.lang.String s)
Returns true if this string would be generated by this PWM at the current stringency and for the current scoringTable.
|
double[] |
getBackgroundProbs()
Returns the background probabilities that the scoring table is based on.
|
java.util.Comparator<Motif> |
getComparator()
Comparator sorts arrays from greatest to least by the
scoreString(String) method. |
MotifList |
getHits(java.lang.String seq)
Returns those sequences in sequence that match this pwm according to
generatesString(String) as a MotifList. |
java.lang.String |
getName()
Returns KR if beta is greater than 0; EXEMPLAR otherwise.
|
double |
getScore() |
double |
getStringency() |
double |
getValue()
Same as getScore().
|
int |
length() |
CREModel |
newInstanceOf(MotifList ml)
Creates a new PWM as specified by the CREModel interface.
|
double |
probabilityOf(java.lang.String s)
Returns the probability that this String is generated by this model; returns in log_2 space.
|
Motif.ScoreData |
scoreString(java.lang.String s)
Returns the score of this string as Computed from the scoringTable.
|
void |
setBeta(double d)
Sets the value of beta to d in the range [0..1].
|
void |
setProbs(double pseudo)
Sets the probability arrays such that each probability incorporates a pseudo count.
|
void |
setScore(double s) |
void |
setScoringTable(double[] d)
Sets the scoring table to be based on the specified background probabilities.
|
void |
setStringency(double s)
Sets the stringency of this model.
|
private double |
simpleScore(java.lang.String s)
Returns the score of this String.
|
java.lang.String |
toString()
Returns a tab-delimited table representing the model.
|
boolean |
useRevComp()
Returns true if this pwm uses the reverse complement of the sequence.
|
public static final double BETA
public static final double DEFAULT_STRINGENCY
expandAsStrings()
and expandAsMotifList()
;public static final double PSEUDO
private double beta
private double[][] bgProbs
private PWM consensus
private double[][] consProbs
private double score
private double[][][] siteProbs
private PWM[] sites
private double stringency
KRModel()
KRModel(double beta)
public KRModel(Motif m, MotifFinder mf)
public KRModel(Motif[] m, MotifFinder mf)
public KRModel(MotifList ml)
DEFAULT_STRINGENCY
. The order is a,t,g,c.public KRModel(java.lang.String[] rows)
CREModel.DEFAULT_RC
,
and with stringency set to DEFAULT_STRINGENCY
. The order is a,t,g,c.public KRModel(java.lang.String[] rows, boolean rc)
DEFAULT_STRINGENCY
. The order is a,t,g,c.public int compareTo(KRModel m)
equals(Object)
.compareTo
in interface java.lang.Comparable<KRModel>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public MotifList expandAsMotifList() throws ExpansionTooLargeException
expandAsMotifList
in interface CREModel
ExpansionTooLargeException
public MotifList expandAsMotifList(MotifFinder mf) throws ExpansionTooLargeException
ExpansionTooLargeException
public java.lang.String[] expandAsStrings() throws ExpansionTooLargeException
expandAsStrings
in interface CREModel
ExpansionTooLargeException
public java.lang.String[] expandAsStrings(MotifFinder mf) throws ExpansionTooLargeException
ExpansionTooLargeException
public boolean generatesString(java.lang.String s)
Specified by the CREModel interface.
generatesString
in interface CREModel
public double[] getBackgroundProbs()
public java.util.Comparator<Motif> getComparator()
scoreString(String)
method.getComparator
in interface CREModel
public MotifList getHits(java.lang.String seq)
generatesString(String)
as a MotifList. The returned
MotifList is a set, meaning there are guarenteed to be no duplicates. The order is unspecified. The score of each Motif in the
MotifList is the score assigned to it by this PWM.
Specified by the CREModel interface.
public java.lang.String getName()
public double getScore()
public double getStringency()
public int length()
public CREModel newInstanceOf(MotifList ml)
newInstanceOf
in interface CREModel
public double probabilityOf(java.lang.String s)
public Motif.ScoreData scoreString(java.lang.String s)
setScoringTable(double[])
to update the reference
weights on the scoring table.scoreString
in interface CREModel
java.lang.IllegalArgumentException
- if s is of a different length than this pwm.public void setBeta(double d)
public void setProbs(double pseudo)
public void setScore(double s)
public void setScoringTable(double[] d)
PWM.BASE_KEY
, which is {a,t,g,c}.setScoringTable
in interface ProbCREModel
public void setStringency(double s)
CREModel
setStringency
in interface CREModel
private double simpleScore(java.lang.String s)
public java.lang.String toString()
public boolean useRevComp()