Multi-round Mononucleotide+View Reverse Complement-Symmetric Example

Gabriella Martini

2016-07-09

options(java.parameters = "-Xmx4000M")
library(SELEX)
library(SelexGLM)
library(grid)
workDir = "./cache/"
selex.config(workingDir=workDir, maxThreadNumber=4)

### LOCAL PATHS NEED TO BE RE-DEFINED TO RUN OFF OF MY COMPUTER
##################################################################
selexDir = "/Users/gabriella/Columbia/SELEX/"
#rawdataDir = "/Users/gabriella/Columbia/rawdata/Pufall/"
processedDataDir = "/Users/gabriella/Columbia/SplitFastqData/Pufall/ConcatFiles/"
# CLUSTER VERSIONS ARE COMMENTED OUT
#selexDir = "/vega/hblab/users/gdm2120/SELEX/SELEX/"
#rawdataDir = "/vega/hblab/projects/selex/rawdata/Pufall"
#processedDataDir = "/vega/hblab/users/gdm2120/SplitFastqData/Pufall/"
##################################################################

saveDir = "gabriella/SelexGLMtest/MultiroundViewSymmetry"
dir.create(file.path(selexDir, saveDir), showWarnings = FALSE, recursive = TRUE)


shapeTable = read.table(paste(selexDir, "gabriella/ShapeParamData/ShapeTableOrthogonal.txt", sep = ""), sep = "\t",
                        stringsAsFactors = FALSE)
ST = shapeTable[,c(1, 14:19)]
colnames(ST) = c("Sequence", "MGW", "ProT", "HelTA",
                 "HelTB", "RollA", "RollB")



selex.defineSample('r0.Pufall',
                   paste(processedDataDir, "/Demultiplexed.R0.fastq.gz", sep = ""),
                   'r0',
                   0, 23, '', 'TGGAA')


selex.defineSample('AR.R8',
                   paste(processedDataDir,"/AR.R8.fastq.gz",sep = ""),
                   'AR-DBD',
                   8, 23, '', 'TGGAA')


selex.defineSample('AR.R7',
                   paste(processedDataDir,"/AR.R7.fastq.gz",sep = ""),
                   'AR-DBD',
                   7, 23, '', 'TGGAA')





r0 = selex.sample(seqName = 'r0.Pufall', sampleName='r0', round = 0)
r0.split = selex.split(r0)
r0.train = r0.split$train
r0.test = r0.split$test
dataSample = selex.sample(seqName = 'AR.R8', sampleName = 'AR-DBD', round = 8)
dataSample.R7 = selex.sample(seqName = 'AR.R7', sampleName = 'AR-DBD', round = 7)
# MARKOV MODEL BUILT
kmax = selex.kmax(sample = r0.test)
mm = selex.mm(sample = r0.train, order = NA, crossValidationSample =r0.test, Kmax = kmax, mmMethod = "TRANSITION")
mmscores = selex.mmSummary(sample = r0.train)
ido = which(mmscores$R==max(mmscores$R))
mm.order = mmscores$Order[ido]

libLen = as.numeric(as.character(selex.getAttributes(dataSample)$VariableRegionLength))
kLen = 15

#data.probeCounts = getProbeCounts(dataSample, markovModel = mm)
#save(data.probeCounts, file = paste(selexDir, saveDir, "/data.probeCounts.RData", sep = ""))
load(file = paste(selexDir, saveDir, "/data.probeCounts.RData", sep = ""))
#data.kmerTable = getKmerCountAffinities(dataSample, k = kLen, minCount = 100, markovModel = mm)
#save(data.kmerTable, file = paste(selexDir, saveDir, "/data.kmerTable.RData", sep = ""))
load(file = paste(selexDir, saveDir, "/data.kmerTable.RData", sep = ""))
#data.probeCounts.R7 = getProbeCounts(dataSample.R7, markovModel = mm)
#save(data.probeCounts.R7, file = paste(selexDir, saveDir, "/data.probeCounts.R7.RData", sep = ""))
load(file = paste(selexDir, saveDir, "/data.probeCounts.R7.RData", sep = ""))
# Inputs about library are data specific 
ModelTest = model(name = "AR-DBD R7+R8 Nucleotides+View (Rev. Comp. Sym.)",
                varRegLen = libLen,
                leftFixedSeq =  "GTTCAGAGTTCTACAGTCCGACGATC",
                rightFixedSeq ="TGGAATTCTCGGGTGCCAAGG", 
                consensusSeq = "RGWACANNNTGTWCY",
                affinityType = "AffinitySym",
                leftFixedSeqOverlap = 5,
                minAffinity = 0.01,
                missingValueSuppression = .5,
                minSeedValue = .01, 
                upFootprintExtend = 4,
                confidenceLevel = .99, 
                rounds = list(c(7,8)),
                rcSymmetric = TRUE,
                verbose = FALSE,
                includeView = TRUE)

getFeatureDesign(ModelTest)
## Feature design for object of class 'model'
## 
## seedLen:  15 
## upFootprintExtend:  4 
## downFootprintExtend:  4 
## rcSymmetric:  TRUE 
## 
## Slot "N": 
## N.upFootprintExtend:  4 
## N.downFootprintExtend:  4 
## N.set:  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
## Number of previous iterations:  0 
## 
## Slot "Intercept": 
## Number of Views per Strand of DNA: 11
## Number of Rounds: 2 (7, 8)
## Number of previous iterations: 0
## 
## Slot "Shape": 
## "ShapeParamsUsed": NONE
# Add seed model
addSeedPsam(ModelTest) = seedTable2psam(ModelTest, data.kmerTable)

# Model nucleotide Betas after seed PSAM is added
print(getValues(getN(ModelTest)))
##     1 2 3 4           5          6           7         8         9
## N.A 0 0 0 0  0.00000000 -1.2968295 -0.03073087  0.000000 -1.296829
## N.C 0 0 0 0 -0.60728754 -1.2968295 -0.25628921 -1.296829  0.000000
## N.G 0 0 0 0 -0.09864725  0.0000000 -0.34036727 -1.296829 -1.296829
## N.T 0 0 0 0 -0.42644057 -0.5591611  0.00000000 -1.296829 -1.296829
##             10          11         12          13         14        15
## N.A  0.0000000 -0.40799975 -0.1359377 -0.09020211 -0.7968295 -1.296829
## N.C -1.2968295  0.00000000  0.0000000 -0.36546623 -0.3957275 -1.296829
## N.G -0.3957275 -0.36546623  0.0000000  0.00000000 -1.2968295  0.000000
## N.T -0.7968295 -0.09020211 -0.1359377 -0.40799975  0.0000000 -1.296829
##            16          17         18          19 20 21 22 23
## N.A -1.296829  0.00000000 -0.5591611 -0.42644057  0  0  0  0
## N.C -1.296829 -0.34036727  0.0000000 -0.09864725  0  0  0  0
## N.G -1.296829 -0.25628921 -1.2968295 -0.60728754  0  0  0  0
## N.T  0.000000 -0.03073087 -1.2968295  0.00000000  0  0  0  0
plot(ModelTest@features@N, Ntitle = "AR-DBD R7+R8 Nucleotides+View\nSeeding Model", ddG = TRUE)

Next we score the probes using topModelMatch

sample1 = sample(nrow(data.probeCounts), 500000)
sample2 = sample(nrow(data.probeCounts.R7), 500000)
data = rbind(data.probeCounts[sample1, ], data.probeCounts.R7[sample2, ])
#data = rbind(data.probeCounts, data.probeCounts.R7)
data = topModelMatch(data, ModelTest)
# Uses aligned probes to build design matrix
data = addDesignMatrix(data, ModelTest)
designMatrixSummary = getDesignMatrix(ModelTest, data)
## No shape parameters included in fit.
print("Round summary: ")
## [1] "Round summary: "
print (designMatrixSummary$Round)
##            7      8  Total
## Round 499581 499718 999299
print("View/strand orientation summary: ")
## [1] "View/strand orientation summary: "
print (designMatrixSummary$Intercept)
##          View.1 View.2 View.3 View.4 View.5 View.6 View.7 View.8 View.9
## Strand.F   5847  66854  97198  70552 105723 126490 138041 150703 111559
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   60870   65462      999299
## Strand.R       0       0           0
print("Mono-nucleotide summary: ")
## [1] "Mono-nucleotide summary: "
print (designMatrixSummary$N)
##        N.A     N.C     N.G    N.T
## 1   576865  634142  349626 437965
## 2   703666  481338  370837 442757
## 3   877164  517391  179687 424356
## 4   901809  270554  412957 413278
## 5  1272237   21324  656874  48163
## 6      809     183 1979327  18279
## 7   840111  110069  104813 943605
## 8  1996215     373    1113    897
## 9      544 1997271     275    508
## 10 1867156     555  127073   3814
## 11   91519 1088171  122255 696653
## 12  356730  642569       0      0
# # Constructs regression expression with independent features using design matrix
regressionFormula = updatedRegressionFormula(data, ModelTest)
print("Regression Formula: ")
## [1] "Regression Formula: "
print (regressionFormula)
## [1] "ObservedCount ~ offset(logProb)+Round.7+N.A1+N.G1+N.T1+N.C2+N.G2+N.T2+N.C3+N.G3+N.T3+N.C4+N.G4+N.T4+N.C5+N.G5+N.T5+N.A6+N.C6+N.T6+N.A7+N.C7+N.G7+N.C8+N.G8+N.T8+N.A9+N.G9+N.T9+N.C10+N.G10+N.T10+N.A11+N.G11+N.T11+N.A12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F9+Strand.F10+Strand.F11"
fit = glm(regressionFormula, 
          data=data, 
          family = poisson(link="log"))
summary(fit)
## 
## Call:
## glm(formula = regressionFormula, family = poisson(link = "log"), 
##     data = data)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -19.886   -1.313   -0.677    0.276   54.807  
## 
## Coefficients:
##               Estimate Std. Error   z value Pr(>|z|)    
## (Intercept) 36.6458963  0.0030051 12194.610  < 2e-16 ***
## Round.7     -0.7266037  0.0014436  -503.340  < 2e-16 ***
## N.A1        -0.0008111  0.0002253    -3.601 0.000317 ***
## N.G1         0.0005642  0.0002330     2.422 0.015451 *  
## N.T1        -0.0394440  0.0002521  -156.463  < 2e-16 ***
## N.C2        -0.0783187  0.0002295  -341.211  < 2e-16 ***
## N.G2        -0.0187381  0.0001801  -104.015  < 2e-16 ***
## N.T2        -0.0883330  0.0002213  -399.105  < 2e-16 ***
## N.C3        -0.1108885  0.0002179  -508.901  < 2e-16 ***
## N.G3        -0.1610918  0.0002724  -591.361  < 2e-16 ***
## N.T3        -0.1256622  0.0001990  -631.615  < 2e-16 ***
## N.C4        -0.1816360  0.0003629  -500.451  < 2e-16 ***
## N.G4        -0.0818377  0.0001831  -447.023  < 2e-16 ***
## N.T4        -0.1061007  0.0001815  -584.589  < 2e-16 ***
## N.C5        -0.3177106  0.0013849  -229.411  < 2e-16 ***
## N.G5        -0.0810742  0.0001531  -529.493  < 2e-16 ***
## N.T5        -0.2910179  0.0007061  -412.129  < 2e-16 ***
## N.A6        -0.7021228  0.0236082   -29.741  < 2e-16 ***
## N.C6        -0.3973665  0.0172842   -22.990  < 2e-16 ***
## N.T6        -0.3342999  0.0012829  -260.588  < 2e-16 ***
## N.A7         0.0050363  0.0001312    38.395  < 2e-16 ***
## N.C7        -0.1629302  0.0003427  -475.454  < 2e-16 ***
## N.G7        -0.2011151  0.0004470  -449.942  < 2e-16 ***
## N.C8        -0.4159030  0.0133396   -31.178  < 2e-16 ***
## N.G8        -0.6945242  0.0189549   -36.641  < 2e-16 ***
## N.T8        -0.7927078  0.0255980   -30.968  < 2e-16 ***
## N.A9        -0.7511801  0.0386077   -19.457  < 2e-16 ***
## N.G9        -0.7576921  0.0496303   -15.267  < 2e-16 ***
## N.T9        -0.9045085  0.0547623   -16.517  < 2e-16 ***
## N.C10       -0.7473897  0.0381685   -19.581  < 2e-16 ***
## N.G10       -0.2146832  0.0003623  -592.618  < 2e-16 ***
## N.T10       -0.5432751  0.0048788  -111.354  < 2e-16 ***
## N.A11       -0.2735805  0.0004760  -574.775  < 2e-16 ***
## N.G11       -0.2095735  0.0003730  -561.859  < 2e-16 ***
## N.T11       -0.0675742  0.0001426  -473.771  < 2e-16 ***
## N.A12       -0.1045250  0.0002070  -504.858  < 2e-16 ***
## Strand.F1   -0.0705664  0.0026108   -27.029  < 2e-16 ***
## Strand.F2    0.0314530  0.0006508    48.328  < 2e-16 ***
## Strand.F3    0.0408631  0.0005189    78.754  < 2e-16 ***
## Strand.F4    0.0037351  0.0005347     6.986 2.83e-12 ***
## Strand.F5   -0.0070186  0.0003275   -21.431  < 2e-16 ***
## Strand.F6    0.0180938  0.0003407    53.109  < 2e-16 ***
## Strand.F7    0.0177024  0.0003743    47.293  < 2e-16 ***
## Strand.F9   -0.0542113  0.0004059  -133.567  < 2e-16 ***
## Strand.F10  -0.0373022  0.0006337   -58.864  < 2e-16 ***
## Strand.F11   0.0583660  0.0007480    78.025  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for poisson family taken to be 1)
## 
##     Null deviance: 6896588  on 999298  degrees of freedom
## Residual deviance: 3570321  on 999253  degrees of freedom
## AIC: 4891898
## 
## Number of Fisher Scoring iterations: 12
ModelTest = addNewBetas(ModelTest, data, fit)
## No shape parameters included in fit.
# # Nucleotide Features after first round of fitting
summary(ModelTest)
## An object of class 'model'
## 
## Slot "name":  AR-DBD R7+R8 Nucleotides+View (Rev. Comp. Sym.) 
## Slot "varRegLen":  23 
## Slot "leftFixedSeq":  GTTCAGAGTTCTACAGTCCGACGATC 
## Slot "rightFixedSeq":  TGGAATTCTCGGGTGCCAAGG 
## Slot "leftFixedSeqOverlap":  5 
## Slot "rightFixedSeqOverlap":  5 
## Slot "confidenceLevel":  0.99 
## Slot "minAffinity":  0.01 
## Slot "missingValueSuppression":  0.5 
## Slot "minSeedValue":  0.01 
## Slot "seedLen":  15 
## Slot "consensusSeq":  [AG]G[AT]ACA[ACGT][ACGT][ACGT]TGT[AT]C[CT] 
## Slot "upFootprintExtend":  4 
## Slot "downFootprintExtend":  4 
## Slot "fpLen":  23 
## 
## Fits a model of footprint length 23 for mono-nucleotide features with 11 view(s) per strand of DNA and 2 round(s) of data (round = 7, 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+Round.7+Round.8+N.A1+N.C1+N.G1+N.T1+N.A2+N.C2+N.G2+N.T2+N.A3+N.C3+N.G3+N.T3+N.A4+N.C4+N.G4+N.T4+N.A5+N.C5+N.G5+N.T5+N.A6+N.C6+N.G6+N.T6+N.A7+N.C7+N.G7+N.T7+N.A8+N.C8+N.G8+N.T8+N.A9+N.C9+N.G9+N.T9+N.A10+N.C10+N.G10+N.T10+N.A11+N.C11+N.G11+N.T11+N.A12+N.C12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F8+Strand.F9+Strand.F10+Strand.F11 
## 
## 
## Includes the following feature sub-classes: 
## An object of class 'N'
## Fits 23 nucleotides for a feature model of length 23.
## Nucleotide features are reverse complement symmetric.
## Nucleotide beta values:
##                 1           2          3          4           5          6
## N.A -0.0008111264  0.00000000  0.0000000  0.0000000  0.00000000 -0.7021228
## N.C  0.0000000000 -0.07831867 -0.1108885 -0.1816360 -0.31771060 -0.3973665
## N.G  0.0005641848 -0.01873810 -0.1610918 -0.0818377 -0.08107421  0.0000000
## N.T -0.0394440451 -0.08833295 -0.1256622 -0.1061007 -0.29101786 -0.3342999
##                7          8          9         10         11        12
## N.A  0.005036262  0.0000000 -0.7511801  0.0000000 -0.2735805 -0.104525
## N.C -0.162930199 -0.4159030  0.0000000 -0.7473897  0.0000000  0.000000
## N.G -0.201115057 -0.6945242 -0.7576921 -0.2146832 -0.2095735  0.000000
## N.T  0.000000000 -0.7927078 -0.9045085 -0.5432751 -0.0675742 -0.104525
##             13         14         15         16           17         18
## N.A -0.0675742 -0.5432751 -0.9045085 -0.7927078  0.000000000 -0.3342999
## N.C -0.2095735 -0.2146832 -0.7576921 -0.6945242 -0.201115057  0.0000000
## N.G  0.0000000 -0.7473897  0.0000000 -0.4159030 -0.162930199 -0.3973665
## N.T -0.2735805  0.0000000 -0.7511801  0.0000000  0.005036262 -0.7021228
##              19         20         21          22            23
## N.A -0.29101786 -0.1061007 -0.1256622 -0.08833295 -0.0394440451
## N.C -0.08107421 -0.0818377 -0.1610918 -0.01873810  0.0005641848
## N.G -0.31771060 -0.1816360 -0.1108885 -0.07831867  0.0000000000
## N.T  0.00000000  0.0000000  0.0000000  0.00000000 -0.0008111264
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0002252659 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0002295318 0.0002178978 0.0003629445 0.0013848940
## N.G 0.0002329773 0.0001801475 0.0002724087 0.0001830725 0.0001531167
## N.T 0.0002520987 0.0002213274 0.0001989537 0.0001814962 0.0007061326
##               6            7          8          9           10
## N.A 0.023608223 0.0001311707 0.00000000 0.03860767 0.0000000000
## N.C 0.017284197 0.0003426834 0.01333963 0.00000000 0.0381684889
## N.G 0.000000000 0.0004469803 0.01895493 0.04963033 0.0003622626
## N.T 0.001282868 0.0000000000 0.02559804 0.05476229 0.0048788327
##               11           12           13           14         15
## N.A 0.0004759784 0.0002070382 0.0001426306 0.0048788327 0.05476229
## N.C 0.0000000000 0.0000000000 0.0003730000 0.0003622626 0.04963033
## N.G 0.0003730000 0.0000000000 0.0000000000 0.0381684889 0.00000000
## N.T 0.0001426306 0.0002070382 0.0004759784 0.0000000000 0.03860767
##             16           17          18           19           20
## N.A 0.02559804 0.0000000000 0.001282868 0.0007061326 0.0001814962
## N.C 0.01895493 0.0004469803 0.000000000 0.0001531167 0.0001830725
## N.G 0.01333963 0.0003426834 0.017284197 0.0013848940 0.0003629445
## N.T 0.00000000 0.0001311707 0.023608223 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001989537 0.0002213274 0.0002520987
## N.C 0.0002724087 0.0001801475 0.0002329773
## N.G 0.0002178978 0.0002295318 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0002252659
## 
## 
## An object of class 'Intercept'
## Fits 11 views and 2 round(s) (round = 7, 8).
## Intercept beta values:
## Round.7:
##              View.1   View.2   View.3   View.4   View.5   View.6 View.7
## StrandView 35.84873 35.95075 35.96016 35.92303 35.91227 35.93739 35.937
##              View.8   View.9  View.10  View.11
## StrandView 35.91929 35.86508 35.88199 35.97766
## 
## Round.8:
##             View.1  View.2  View.3  View.4  View.5  View.6  View.7  View.8
## StrandView 36.6459 36.6459 36.6459 36.6459 36.6459 36.6459 36.6459 36.6459
##             View.9 View.10 View.11
## StrandView 36.6459 36.6459 36.6459
## 
## Intercept beta errors:
## Round.7:
##                 View.1      View.2      View.3      View.4      View.5
## StrandView 0.004234477 0.003396764 0.003373969 0.003376436 0.003349881
##                 View.6      View.7      View.8      View.9     View.10
## StrandView 0.003351196 0.003354781 0.003333833 0.003358449 0.003393526
##                View.11
## StrandView 0.003416724
## 
## Round.8:
##                View.1     View.2     View.3     View.4     View.5
## StrandView 0.00300509 0.00300509 0.00300509 0.00300509 0.00300509
##                View.6     View.7     View.8     View.9    View.10
## StrandView 0.00300509 0.00300509 0.00300509 0.00300509 0.00300509
##               View.11
## StrandView 0.00300509
## 
## 
## 
## An object of class 'Shape'
## Fits 0 shape coefficients for 0 kinds of shape parameter(s) (shape = ) for a feature model of length 23.
vPheight = verticalPlot_height(ModelTest)
pM <- plot(ModelTest, plotTitle = "AR-DBD R7+R8 Nucleotide+View Fit", Nplot.ddG = TRUE, verticalPlots = TRUE)

ggplot2::ggsave(pM, file = paste(selexDir, saveDir, "/modelPlot.pdf", sep = ""), height = vPheight, width = 6)

ggplot2::ggsave(pM, file = paste(selexDir, saveDir, "/modelPlot.",1, ".pdf", sep = ""), height = vPheight, width = 6)

some text

data = rbind(data.probeCounts[sample1, ], data.probeCounts.R7[sample2, ])
#data = rbind(data.probeCounts, data.probeCounts.R7)
data = topModelMatch(data, ModelTest)
data = addDesignMatrix(data, ModelTest)
if (nrow(data) > 0) {
  designMatrixSummary.v2 = getDesignMatrix(ModelTest, data)
  if ((all(designMatrixSummary.v2$N == designMatrixSummary$N)) & (all(designMatrixSummary.v2$Round == designMatrixSummary$Round)) & (all(designMatrixSummary.v2$Intercept == designMatrixSummary$Intercept)))  {
    print ("Stability Reached")
  }
} 
## No shape parameters included in fit.
for (i in 2:20) {
  if (nrow(data) == 0) {
    break
  } else if ((all(designMatrixSummary.v2$N == designMatrixSummary$N)) & (all(designMatrixSummary.v2$Round == designMatrixSummary$Round)) & (all(designMatrixSummary.v2$Intercept == designMatrixSummary$Intercept)))  {
    break
  }
  data.nrow = nrow(data)
  print (paste("i =",i))
  
  designMatrixSummary = designMatrixSummary.v2
  print("Round summary: ")
  print (designMatrixSummary$Round)
  print("Mono-nucleotide summary: ")
  print (designMatrixSummary$N)
  print("View/strand orientation summary: ")
  print (designMatrixSummary$Intercept)
  # # Constructs regression expression with independent features using design matrix
  regressionFormula = updatedRegressionFormula(data, ModelTest)
  print("Regression Formula: ")
  print (regressionFormula)
  fit = glm(regressionFormula, 
            data=data, 
            family = poisson(link="log"))
  summary(fit)
  ModelTest = addNewBetas(ModelTest, data, fit)
  # # Nucleotide Features after first round of fitting
  summary(ModelTest)
   
  pM <- plot(ModelTest, plotTitle = "AR-DBD R7+R8 Nucleotide+View Fit", Nplot.ddG = TRUE, verticalPlots = TRUE)

  ggplot2::ggsave(pM, file = paste(selexDir, saveDir, "/modelPlot.",i, ".pdf", sep = ""), height = vPheight, width = 6)
  
  ggplot2::ggsave(pM, file = paste(selexDir, saveDir, "/modelPlot.pdf", sep = ""), height = vPheight, width = 6)
  
  data = topModelMatch(data, ModelTest)
  data = addDesignMatrix(data, ModelTest)
  print(paste("Number of Observations in Design Matrix: ",nrow(data), sep = ""))
  if (nrow(data) > 0) {
    designMatrixSummary.v2 = getDesignMatrix(ModelTest, data)
    if ((all(designMatrixSummary.v2$N == designMatrixSummary$N)) & (all(designMatrixSummary.v2$Round == designMatrixSummary$Round)) & (all(designMatrixSummary.v2$Intercept == designMatrixSummary$Intercept)))  {
      print (paste("Stability Reached after ", i, " iterations.", sep = ""))
      break
    }
  } else  {
    print (paste("Algorithm failed to converge: No probes meet the confidence level requirement (Confidence Level:", ModelTest@confidenceLevel, ")", sep = ""))
  }
}
## [1] "i = 2"
## [1] "Round summary: "
##            7      8  Total
## Round 499611 499764 999375
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   576896  634212  349663 437979
## 2   703735  481366  370872 442777
## 3   877221  517408  179707 424414
## 4   901867  270584  412988 413311
## 5  1272314   21356  656899  48181
## 6      851     252 1979333  18314
## 7   840201  110086  104828 943635
## 8  1996253     447    1126    924
## 9      558 1997333     332    527
## 10 1867186     578  127143   3843
## 11   91570 1088192  122283 696705
## 12  356748  642627       0      0
## [1] "View/strand orientation summary: "
##          View.1 View.2 View.3 View.4 View.5 View.6 View.7 View.8 View.9
## Strand.F   5854  66882  97201  70556 105732 126496 138047 150718 111570
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   60867   65452      999375
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+Round.7+N.A1+N.G1+N.T1+N.C2+N.G2+N.T2+N.C3+N.G3+N.T3+N.C4+N.G4+N.T4+N.C5+N.G5+N.T5+N.A6+N.C6+N.T6+N.A7+N.C7+N.G7+N.C8+N.G8+N.T8+N.A9+N.G9+N.T9+N.C10+N.G10+N.T10+N.A11+N.G11+N.T11+N.A12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F9+Strand.F10+Strand.F11"
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R7+R8 Nucleotides+View (Rev. Comp. Sym.) 
## Slot "varRegLen":  23 
## Slot "leftFixedSeq":  GTTCAGAGTTCTACAGTCCGACGATC 
## Slot "rightFixedSeq":  TGGAATTCTCGGGTGCCAAGG 
## Slot "leftFixedSeqOverlap":  5 
## Slot "rightFixedSeqOverlap":  5 
## Slot "confidenceLevel":  0.99 
## Slot "minAffinity":  0.01 
## Slot "missingValueSuppression":  0.5 
## Slot "minSeedValue":  0.01 
## Slot "seedLen":  15 
## Slot "consensusSeq":  [AG]G[AT]ACA[ACGT][ACGT][ACGT]TGT[AT]C[CT] 
## Slot "upFootprintExtend":  4 
## Slot "downFootprintExtend":  4 
## Slot "fpLen":  23 
## 
## Fits a model of footprint length 23 for mono-nucleotide features with 11 view(s) per strand of DNA and 2 round(s) of data (round = 7, 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+Round.7+Round.8+N.A1+N.C1+N.G1+N.T1+N.A2+N.C2+N.G2+N.T2+N.A3+N.C3+N.G3+N.T3+N.A4+N.C4+N.G4+N.T4+N.A5+N.C5+N.G5+N.T5+N.A6+N.C6+N.G6+N.T6+N.A7+N.C7+N.G7+N.T7+N.A8+N.C8+N.G8+N.T8+N.A9+N.C9+N.G9+N.T9+N.A10+N.C10+N.G10+N.T10+N.A11+N.C11+N.G11+N.T11+N.A12+N.C12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F8+Strand.F9+Strand.F10+Strand.F11 
## 
## 
## Includes the following feature sub-classes: 
## An object of class 'N'
## Fits 23 nucleotides for a feature model of length 23.
## Nucleotide features are reverse complement symmetric.
## Nucleotide beta values:
##                 1           2          3           4           5
## N.A -0.0008149542  0.00000000  0.0000000  0.00000000  0.00000000
## N.C  0.0000000000 -0.07830985 -0.1108709 -0.18159540 -0.31759490
## N.G  0.0005593578 -0.01873436 -0.1610667 -0.08182424 -0.08106457
## N.T -0.0394435268 -0.08832365 -0.1256426 -0.10608890 -0.29083336
##              6            7          8          9         10         11
## N.A -0.6695495  0.005040855  0.0000000 -0.7011121  0.0000000 -0.2735546
## N.C -0.3397277 -0.162905777 -0.3844257  0.0000000 -0.7473570  0.0000000
## N.G  0.0000000 -0.201064869 -0.6837596 -0.6454396 -0.2146403 -0.2095342
## N.T -0.3340028  0.000000000 -0.7754598 -0.7258555 -0.5413663 -0.0675646
##             12         13         14         15         16           17
## N.A -0.1045142 -0.0675646 -0.5413663 -0.7258555 -0.7754598  0.000000000
## N.C  0.0000000 -0.2095342 -0.2146403 -0.6454396 -0.6837596 -0.201064869
## N.G  0.0000000  0.0000000 -0.7473570  0.0000000 -0.3844257 -0.162905777
## N.T -0.1045142 -0.2735546  0.0000000 -0.7011121  0.0000000  0.005040855
##             18          19          20         21          22
## N.A -0.3340028 -0.29083336 -0.10608890 -0.1256426 -0.08832365
## N.C  0.0000000 -0.08106457 -0.08182424 -0.1610667 -0.01873436
## N.G -0.3397277 -0.31759490 -0.18159540 -0.1108709 -0.07830985
## N.T -0.6695495  0.00000000  0.00000000  0.0000000  0.00000000
##                23
## N.A -0.0394435268
## N.C  0.0005593578
## N.G  0.0000000000
## N.T -0.0008149542
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0002252629 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0002295322 0.0002178973 0.0003629179 0.0013844498
## N.G 0.0002329755 0.0001801465 0.0002724040 0.0001830727 0.0001531173
## N.T 0.0002520958 0.0002213266 0.0001989511 0.0001814960 0.0007057425
##               6            7          8          9           10
## N.A 0.020934337 0.0001311705 0.00000000 0.03180847 0.0000000000
## N.C 0.013749357 0.0003426779 0.01181693 0.00000000 0.0381684926
## N.G 0.000000000 0.0004469354 0.01820035 0.03197647 0.0003622392
## N.T 0.001281606 0.0000000000 0.02400388 0.02770075 0.0048445962
##               11           12           13           14         15
## N.A 0.0004759796 0.0002070368 0.0001426306 0.0048445962 0.02770075
## N.C 0.0000000000 0.0000000000 0.0003729790 0.0003622392 0.03197647
## N.G 0.0003729790 0.0000000000 0.0000000000 0.0381684926 0.00000000
## N.T 0.0001426306 0.0002070368 0.0004759796 0.0000000000 0.03180847
##             16           17          18           19           20
## N.A 0.02400388 0.0000000000 0.001281606 0.0007057425 0.0001814960
## N.C 0.01820035 0.0004469354 0.000000000 0.0001531173 0.0001830727
## N.G 0.01181693 0.0003426779 0.013749357 0.0013844498 0.0003629179
## N.T 0.00000000 0.0001311705 0.020934337 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001989511 0.0002213266 0.0002520958
## N.C 0.0002724040 0.0001801465 0.0002329755
## N.G 0.0002178973 0.0002295322 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0002252629
## 
## 
## An object of class 'Intercept'
## Fits 11 views and 2 round(s) (round = 7, 8).
## Intercept beta values:
## Round.7:
##              View.1   View.2  View.3   View.4   View.5   View.6   View.7
## StrandView 35.84829 35.95017 35.9596 35.92248 35.91172 35.93683 35.93644
##              View.8   View.9  View.10  View.11
## StrandView 35.91874 35.86454 35.88147 35.97708
## 
## Round.8:
##              View.1   View.2   View.3   View.4   View.5   View.6   View.7
## StrandView 36.64534 36.64534 36.64534 36.64534 36.64534 36.64534 36.64534
##              View.8   View.9  View.10  View.11
## StrandView 36.64534 36.64534 36.64534 36.64534
## 
## Intercept beta errors:
## Round.7:
##                View.1      View.2      View.3      View.4      View.5
## StrandView 0.00423354 0.003396818 0.003374026 0.003376494 0.003349939
##                 View.6      View.7      View.8      View.9     View.10
## StrandView 0.003351254 0.003354839 0.003333892 0.003358507 0.003393578
##                View.11
## StrandView 0.003416778
## 
## Round.8:
##                View.1     View.2     View.3     View.4     View.5
## StrandView 0.00300516 0.00300516 0.00300516 0.00300516 0.00300516
##                View.6     View.7     View.8     View.9    View.10
## StrandView 0.00300516 0.00300516 0.00300516 0.00300516 0.00300516
##               View.11
## StrandView 0.00300516
## 
## 
## 
## An object of class 'Shape'
## Fits 0 shape coefficients for 0 kinds of shape parameter(s) (shape = ) for a feature model of length 23.
## [1] "Number of Observations in Design Matrix: 999340"
## No shape parameters included in fit.
## [1] "i = 3"
## [1] "Round summary: "
##            7      8  Total
## Round 499585 499755 999340
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   576866  634190  349657 437967
## 2   703712  481347  370860 442761
## 3   877203  517384  179692 424401
## 4   901846  270563  412971 413300
## 5  1272289   21346  656889  48156
## 6      847     247 1979292  18294
## 7   840178  110081  104822 943599
## 8  1996213     440    1115    912
## 9      552 1997279     326    523
## 10 1867156     571  127127   3826
## 11   91552 1088178  122273 696677
## 12  356721  642619       0      0
## [1] "View/strand orientation summary: "
##          View.1 View.2 View.3 View.4 View.5 View.6 View.7 View.8 View.9
## Strand.F   5852  66879  97199  70554 105730 126494 138044 150706 111569
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   60864   65449      999340
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+Round.7+N.A1+N.G1+N.T1+N.C2+N.G2+N.T2+N.C3+N.G3+N.T3+N.C4+N.G4+N.T4+N.C5+N.G5+N.T5+N.A6+N.C6+N.T6+N.A7+N.C7+N.G7+N.C8+N.G8+N.T8+N.A9+N.G9+N.T9+N.C10+N.G10+N.T10+N.A11+N.G11+N.T11+N.A12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F9+Strand.F10+Strand.F11"
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R7+R8 Nucleotides+View (Rev. Comp. Sym.) 
## Slot "varRegLen":  23 
## Slot "leftFixedSeq":  GTTCAGAGTTCTACAGTCCGACGATC 
## Slot "rightFixedSeq":  TGGAATTCTCGGGTGCCAAGG 
## Slot "leftFixedSeqOverlap":  5 
## Slot "rightFixedSeqOverlap":  5 
## Slot "confidenceLevel":  0.99 
## Slot "minAffinity":  0.01 
## Slot "missingValueSuppression":  0.5 
## Slot "minSeedValue":  0.01 
## Slot "seedLen":  15 
## Slot "consensusSeq":  [AG]G[AT]ACA[ACGT][ACGT][ACGT]TGT[AT]C[CT] 
## Slot "upFootprintExtend":  4 
## Slot "downFootprintExtend":  4 
## Slot "fpLen":  23 
## 
## Fits a model of footprint length 23 for mono-nucleotide features with 11 view(s) per strand of DNA and 2 round(s) of data (round = 7, 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+Round.7+Round.8+N.A1+N.C1+N.G1+N.T1+N.A2+N.C2+N.G2+N.T2+N.A3+N.C3+N.G3+N.T3+N.A4+N.C4+N.G4+N.T4+N.A5+N.C5+N.G5+N.T5+N.A6+N.C6+N.G6+N.T6+N.A7+N.C7+N.G7+N.T7+N.A8+N.C8+N.G8+N.T8+N.A9+N.C9+N.G9+N.T9+N.A10+N.C10+N.G10+N.T10+N.A11+N.C11+N.G11+N.T11+N.A12+N.C12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F8+Strand.F9+Strand.F10+Strand.F11 
## 
## 
## Includes the following feature sub-classes: 
## An object of class 'N'
## Fits 23 nucleotides for a feature model of length 23.
## Nucleotide features are reverse complement symmetric.
## Nucleotide beta values:
##                 1           2          3           4           5
## N.A -0.0008150682  0.00000000  0.0000000  0.00000000  0.00000000
## N.C  0.0000000000 -0.07831249 -0.1108769 -0.18160230 -0.31761892
## N.G  0.0005595451 -0.01873625 -0.1610734 -0.08182858 -0.08106755
## N.T -0.0394444898 -0.08832695 -0.1256460 -0.10609355 -0.29087120
##              6            7          8          9         10          11
## N.A -0.6805083  0.005040567  0.0000000 -0.7357226  0.0000000 -0.27356599
## N.C -0.3440666 -0.162914828 -0.3898515  0.0000000 -0.7473660  0.00000000
## N.G  0.0000000 -0.201075697 -0.6919688 -0.6917885 -0.2146580 -0.20954607
## N.T -0.3340863  0.000000000 -0.7837923 -0.7258670 -0.5420836 -0.06756632
##             12          13         14         15         16           17
## N.A -0.1045185 -0.06756632 -0.5420836 -0.7258670 -0.7837923  0.000000000
## N.C  0.0000000 -0.20954607 -0.2146580 -0.6917885 -0.6919688 -0.201075697
## N.G  0.0000000  0.00000000 -0.7473660  0.0000000 -0.3898515 -0.162914828
## N.T -0.1045185 -0.27356599  0.0000000 -0.7357226  0.0000000  0.005040567
##             18          19          20         21          22
## N.A -0.3340863 -0.29087120 -0.10609355 -0.1256460 -0.08832695
## N.C  0.0000000 -0.08106755 -0.08182858 -0.1610734 -0.01873625
## N.G -0.3440666 -0.31761892 -0.18160230 -0.1108769 -0.07831249
## N.T -0.6805083  0.00000000  0.00000000  0.0000000  0.00000000
##                23
## N.A -0.0394444898
## N.C  0.0005595451
## N.G  0.0000000000
## N.T -0.0008150682
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0002252635 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0002295322 0.0002178985 0.0003629198 0.0013845291
## N.G 0.0002329757 0.0001801471 0.0002724056 0.0001830730 0.0001531172
## N.T 0.0002520963 0.0002213271 0.0001989509 0.0001814967 0.0007058192
##               6            7          8          9           10
## N.A 0.021798700 0.0001311705 0.00000000 0.03636902 0.0000000000
## N.C 0.014111160 0.0003426825 0.01206635 0.00000000 0.0381684911
## N.G 0.000000000 0.0004469436 0.01877619 0.03834534 0.0003622531
## N.T 0.001281964 0.0000000000 0.02476263 0.02770077 0.0048575122
##               11           12           13           14         15
## N.A 0.0004759874 0.0002070377 0.0001426304 0.0048575122 0.02770077
## N.C 0.0000000000 0.0000000000 0.0003729868 0.0003622531 0.03834534
## N.G 0.0003729868 0.0000000000 0.0000000000 0.0381684911 0.00000000
## N.T 0.0001426304 0.0002070377 0.0004759874 0.0000000000 0.03636902
##             16           17          18           19           20
## N.A 0.02476263 0.0000000000 0.001281964 0.0007058192 0.0001814967
## N.C 0.01877619 0.0004469436 0.000000000 0.0001531172 0.0001830730
## N.G 0.01206635 0.0003426825 0.014111160 0.0013845291 0.0003629198
## N.T 0.00000000 0.0001311705 0.021798700 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001989509 0.0002213271 0.0002520963
## N.C 0.0002724056 0.0001801471 0.0002329757
## N.G 0.0002178985 0.0002295322 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0002252635
## 
## 
## An object of class 'Intercept'
## Fits 11 views and 2 round(s) (round = 7, 8).
## Intercept beta values:
## Round.7:
##              View.1   View.2   View.3   View.4   View.5 View.6  View.7
## StrandView 35.84843 35.95033 35.95976 35.92264 35.91188 35.937 35.9366
##             View.8  View.9  View.10  View.11
## StrandView 35.9189 35.8647 35.88163 35.97725
## 
## Round.8:
##             View.1  View.2  View.3  View.4  View.5  View.6  View.7  View.8
## StrandView 36.6455 36.6455 36.6455 36.6455 36.6455 36.6455 36.6455 36.6455
##             View.9 View.10 View.11
## StrandView 36.6455 36.6455 36.6455
## 
## Intercept beta errors:
## Round.7:
##                View.1      View.2     View.3      View.4      View.5
## StrandView 0.00423372 0.003396802 0.00337401 0.003376478 0.003349922
##                 View.6      View.7      View.8     View.9     View.10
## StrandView 0.003351238 0.003354823 0.003333875 0.00335849 0.003393561
##                View.11
## StrandView 0.003416762
## 
## Round.8:
##                View.1     View.2     View.3     View.4     View.5
## StrandView 0.00300514 0.00300514 0.00300514 0.00300514 0.00300514
##                View.6     View.7     View.8     View.9    View.10
## StrandView 0.00300514 0.00300514 0.00300514 0.00300514 0.00300514
##               View.11
## StrandView 0.00300514
## 
## 
## 
## An object of class 'Shape'
## Fits 0 shape coefficients for 0 kinds of shape parameter(s) (shape = ) for a feature model of length 23.
## [1] "Number of Observations in Design Matrix: 999338"
## No shape parameters included in fit.
## [1] "i = 4"
## [1] "Round summary: "
##            7      8  Total
## Round 499583 499755 999338
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   576865  634189  349655 437967
## 2   703711  481346  370859 442760
## 3   877202  517383  179692 424399
## 4   901845  270560  412971 413300
## 5  1272286   21346  656888  48156
## 6      847     246 1979289  18294
## 7   840177  110081  104822 943596
## 8  1996212     439    1114    911
## 9      551 1997278     324    523
## 10 1867154     571  127125   3826
## 11   91551 1088177  122272 696676
## 12  356720  642618       0      0
## [1] "View/strand orientation summary: "
##          View.1 View.2 View.3 View.4 View.5 View.6 View.7 View.8 View.9
## Strand.F   5852  66878  97199  70554 105730 126494 138044 150706 111568
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   60864   65449      999338
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+Round.7+N.A1+N.G1+N.T1+N.C2+N.G2+N.T2+N.C3+N.G3+N.T3+N.C4+N.G4+N.T4+N.C5+N.G5+N.T5+N.A6+N.C6+N.T6+N.A7+N.C7+N.G7+N.C8+N.G8+N.T8+N.A9+N.G9+N.T9+N.C10+N.G10+N.T10+N.A11+N.G11+N.T11+N.A12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F9+Strand.F10+Strand.F11"
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R7+R8 Nucleotides+View (Rev. Comp. Sym.) 
## Slot "varRegLen":  23 
## Slot "leftFixedSeq":  GTTCAGAGTTCTACAGTCCGACGATC 
## Slot "rightFixedSeq":  TGGAATTCTCGGGTGCCAAGG 
## Slot "leftFixedSeqOverlap":  5 
## Slot "rightFixedSeqOverlap":  5 
## Slot "confidenceLevel":  0.99 
## Slot "minAffinity":  0.01 
## Slot "missingValueSuppression":  0.5 
## Slot "minSeedValue":  0.01 
## Slot "seedLen":  15 
## Slot "consensusSeq":  [AG]G[AT]ACA[ACGT][ACGT][ACGT]TGT[AT]C[CT] 
## Slot "upFootprintExtend":  4 
## Slot "downFootprintExtend":  4 
## Slot "fpLen":  23 
## 
## Fits a model of footprint length 23 for mono-nucleotide features with 11 view(s) per strand of DNA and 2 round(s) of data (round = 7, 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+Round.7+Round.8+N.A1+N.C1+N.G1+N.T1+N.A2+N.C2+N.G2+N.T2+N.A3+N.C3+N.G3+N.T3+N.A4+N.C4+N.G4+N.T4+N.A5+N.C5+N.G5+N.T5+N.A6+N.C6+N.G6+N.T6+N.A7+N.C7+N.G7+N.T7+N.A8+N.C8+N.G8+N.T8+N.A9+N.C9+N.G9+N.T9+N.A10+N.C10+N.G10+N.T10+N.A11+N.C11+N.G11+N.T11+N.A12+N.C12+Strand.F1+Strand.F2+Strand.F3+Strand.F4+Strand.F5+Strand.F6+Strand.F7+Strand.F8+Strand.F9+Strand.F10+Strand.F11 
## 
## 
## Includes the following feature sub-classes: 
## An object of class 'N'
## Fits 23 nucleotides for a feature model of length 23.
## Nucleotide features are reverse complement symmetric.
## Nucleotide beta values:
##                 1           2          3           4          5          6
## N.A -0.0008152151  0.00000000  0.0000000  0.00000000  0.0000000 -0.6805089
## N.C  0.0000000000 -0.07831268 -0.1108771 -0.18160343 -0.3176194 -0.3440671
## N.G  0.0005595236 -0.01873646 -0.1610737 -0.08182874 -0.0810678  0.0000000
## N.T -0.0394445556 -0.08832711 -0.1256465 -0.10609372 -0.2908717 -0.3340869
##                7          8          9         10          11        12
## N.A  0.005040685  0.0000000 -0.7453305  0.0000000 -0.27356643 -0.104519
## N.C -0.162915092 -0.3898521  0.0000000 -0.7473666  0.00000000  0.000000
## N.G -0.201075962 -0.6919694 -0.7025205 -0.2146593 -0.20954730  0.000000
## N.T  0.000000000 -0.7881556 -0.7258679 -0.5420843 -0.06756637 -0.104519
##              13         14         15         16           17         18
## N.A -0.06756637 -0.5420843 -0.7258679 -0.7881556  0.000000000 -0.3340869
## N.C -0.20954730 -0.2146593 -0.7025205 -0.6919694 -0.201075962  0.0000000
## N.G  0.00000000 -0.7473666  0.0000000 -0.3898521 -0.162915092 -0.3440671
## N.T -0.27356643  0.0000000 -0.7453305  0.0000000  0.005040685 -0.6805089
##             19          20         21          22            23
## N.A -0.2908717 -0.10609372 -0.1256465 -0.08832711 -0.0394445556
## N.C -0.0810678 -0.08182874 -0.1610737 -0.01873646  0.0005595236
## N.G -0.3176194 -0.18160343 -0.1108771 -0.07831268  0.0000000000
## N.T  0.0000000  0.00000000  0.0000000  0.00000000 -0.0008152151
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0002252636 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0002295321 0.0002178985 0.0003629208 0.0013845291
## N.G 0.0002329757 0.0001801471 0.0002724056 0.0001830730 0.0001531172
## N.T 0.0002520962 0.0002213271 0.0001989510 0.0001814967 0.0007058191
##               6            7          8          9           10
## N.A 0.021798700 0.0001311705 0.00000000 0.03774671 0.0000000000
## N.C 0.014111007 0.0003426825 0.01206635 0.00000000 0.0381684902
## N.G 0.000000000 0.0004469436 0.01877619 0.03999185 0.0003622541
## N.T 0.001281964 0.0000000000 0.02516993 0.02770077 0.0048575120
##               11           12           13           14         15
## N.A 0.0004759873 0.0002070378 0.0001426304 0.0048575120 0.02770077
## N.C 0.0000000000 0.0000000000 0.0003729880 0.0003622541 0.03999185
## N.G 0.0003729880 0.0000000000 0.0000000000 0.0381684902 0.00000000
## N.T 0.0001426304 0.0002070378 0.0004759873 0.0000000000 0.03774671
##             16           17          18           19           20
## N.A 0.02516993 0.0000000000 0.001281964 0.0007058191 0.0001814967
## N.C 0.01877619 0.0004469436 0.000000000 0.0001531172 0.0001830730
## N.G 0.01206635 0.0003426825 0.014111007 0.0013845291 0.0003629208
## N.T 0.00000000 0.0001311705 0.021798700 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001989510 0.0002213271 0.0002520962
## N.C 0.0002724056 0.0001801471 0.0002329757
## N.G 0.0002178985 0.0002295321 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0002252636
## 
## 
## An object of class 'Intercept'
## Fits 11 views and 2 round(s) (round = 7, 8).
## Intercept beta values:
## Round.7:
##              View.1   View.2   View.3   View.4   View.5   View.6   View.7
## StrandView 35.84844 35.95034 35.95977 35.92265 35.91189 35.93701 35.93661
##              View.8   View.9  View.10  View.11
## StrandView 35.91891 35.86471 35.88164 35.97726
## 
## Round.8:
##              View.1   View.2   View.3   View.4   View.5   View.6   View.7
## StrandView 36.64551 36.64551 36.64551 36.64551 36.64551 36.64551 36.64551
##              View.8   View.9  View.10  View.11
## StrandView 36.64551 36.64551 36.64551 36.64551
## 
## Intercept beta errors:
## Round.7:
##                 View.1      View.2      View.3      View.4      View.5
## StrandView 0.004233719 0.003396801 0.003374009 0.003376476 0.003349921
##                 View.6      View.7      View.8      View.9    View.10
## StrandView 0.003351237 0.003354822 0.003333874 0.003358489 0.00339356
##                View.11
## StrandView 0.003416761
## 
## Round.8:
##                 View.1      View.2      View.3      View.4      View.5
## StrandView 0.003005138 0.003005138 0.003005138 0.003005138 0.003005138
##                 View.6      View.7      View.8      View.9     View.10
## StrandView 0.003005138 0.003005138 0.003005138 0.003005138 0.003005138
##                View.11
## StrandView 0.003005138
## 
## 
## 
## An object of class 'Shape'
## Fits 0 shape coefficients for 0 kinds of shape parameter(s) (shape = ) for a feature model of length 23.
## [1] "Number of Observations in Design Matrix: 999338"
## No shape parameters included in fit.
## [1] "Stability Reached after 4 iterations."
ModelTest <- finalizeFeatureBetas(ModelTest)

pM <- plot(ModelTest, plotTitle = "AR-DBD R7+R8 Nucleotide+View Fit", Nplot.ddG = TRUE, verticalPlots = TRUE)
ggplot2::ggsave(pM, file = paste(selexDir, saveDir, "/modelPlot.pdf", sep = ""), height = vPheight, width = 6)

save(ModelTest, file = paste(selexDir, saveDir, "/model.RData",sep = ""))
saveRDS(ModelTest, file = paste(selexDir, saveDir, "/model.rds",sep = ""))

some text