#get sequence data
data(TULASequences)
#Create a fixed and optional type model
TULAFixed <- motifModel(TULASequences)
print(TULAFixed)
plotPositions(TULAFixed)
TULAOpt <- motifModel(TULASequences, type="optional")
print(TULAOpt)
plotPositions(TULAOpt)
#Something more interesting, cluster the data, fit two motif models, and
# then calculate the residuals
clusters <- aclust(dist(TULASequences), 2)
TULA.M1 <- motifModel(TULASequences[clusters[[1]],], type="fixed")
TULA.M2 <- motifModel(TULASequences[clusters[[2]],], type="fixed")
#Goodness of fit for model 1 and then using model 1 on the sequences in
# model 2, which is obviously a bad fit
#get threshold by including all sequences, no matter how bad the fit is.
threshold <- min(predict(TULA.M1))
print(threshold)
print(residuals(TULA.M1), threshold=threshold)
print(residuals(TULA.M1, seqs=TULA.M2@seqs, threshold=threshold))Run the code above in your browser using DataLab