Package org.snpeff.motif

# Class Pwm

java.lang.Object
org.snpeff.motif.Pwm

Direct Known Subclasses:
  `PwmAndSeqs`

public class Pwm extends Object
Create a DNA motif count matrix Refrence http://en.wikipedia.org/wiki/Position-specific_scoring_matrix

Author:
  pcingola

## Field Summary

Fields
Modifier and Type
Field
Description
`static final char[]`
`BASES`
`static final int`
`SCALE`

## Constructor Summary

Constructors
Constructor
Description
`Pwm(int length)`
`Pwm(String file)`

## Method Summary

Modifier and Type
Method
Description
`void`
`calcLogOddsWeight()`
Calculate log odds matrix from counts Reference: http://en.wikipedia.org/wiki/Position-specific_scoring_matrix
`char[]`
`getBestSequence()`
Get best matching sequence (highest score)
`String`
`getBestSequenceStr()`
`int`
`getCount(char base, int position)`
Get counts for a given position
`String`
`getId()`
`double`
`getLogOdds(char base, int position)`
`String`
`getName()`
`int`
`getTotalCount()`
`boolean`
`isConserved(int pos)`
Is position 'pos' conserved (only one base has non-zero counts)
`int`
`length()`
`double`
`score(String dna)`
Calculate PWM score for a string
`void`
`set(String dna)`
Set PWM as a perfect match to a dna sequence
`void`
`setCounts(char base, int[] counts)`
Set counts for one base
`void`
`setId(String id)`
`void`
`setName(String name)`
`String`
`toString()`
`void`
`updateCounts(String dna)`
`void`
`updateCounts(String dna, int inc)`
Update counts matrix.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### SCALE

public static final int SCALE

See Also:
  - Constant Field Values

### BASES

public static final char[] BASES

## Constructor Details

### Pwm

public Pwm(int length)

### Pwm

public Pwm(String file)

## Method Details

### calcLogOddsWeight

public void calcLogOddsWeight()
Calculate log odds matrix from counts Reference: http://en.wikipedia.org/wiki/Position-specific_scoring_matrix

### getBestSequence

public char[] getBestSequence()
Get best matching sequence (highest score)

Returns:

### getBestSequenceStr

public String getBestSequenceStr()

### getCount

public int getCount(char base, int position)
Get counts for a given position

### getId

public String getId()

### getLogOdds

public double getLogOdds(char base, int position)

### getName

public String getName()

### getTotalCount

public int getTotalCount()

### isConserved

public boolean isConserved(int pos)
Is position 'pos' conserved (only one base has non-zero counts)

### length

public int length()

### score

public double score(String dna)
Calculate PWM score for a string

### set

public void set(String dna)
Set PWM as a perfect match to a dna sequence

### setCounts

public void setCounts(char base, int[] counts)
Set counts for one base

### setId

public void setId(String id)

### setName

public void setName(String name)

### toString

public String toString()

Overrides:
  `toString` in class `Object`

### updateCounts

public void updateCounts(String dna)

### updateCounts

public void updateCounts(String dna, int inc)
Update counts matrix.