Mononucleotide+Fixed Shape Values 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/ShapeFixedValuesSymmetry"
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)
# 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 = ""))
# Inputs about library are data specific 
load(paste(selexDir, "/gabriella/SelexGLMtest/ShapeSymmetry/model.RData", sep = ""))
Shape.values = ModelTest@features@Shape@Shape.values[c("Shape.MGW", "Shape.HelTA", "Shape.HelTB"),]
ModelTest = model(name = "AR-DBD R8 Nucleotides + Fixed Shape Values (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(8)),
                rcSymmetric = TRUE,
                verbose = FALSE,
                includeShape = TRUE,
                shapeTable = ST,
                shapeParams = list(c("MGW", "HelT")),
                Shape.values = Shape.values,
                useFixedValuesOffset.Shape = TRUE,
                Shape.set = c(0))

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: 1 (8)
## Number of previous iterations: 0
## 
## Slot "Shape": 
## ShapeParamsUsed:  HelT MGW 
## Shape.upFootprintExtend:  0 
## Shape.downFootprintExtend:  0 
## Shape.set:  0 
## Number of previous iterations:  0
# 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 R8 Nucleotides+Fixed Shape Values\nSeeding Model", ddG = TRUE)

Next we score the probes using topModelMatch

sample1 = sample(nrow(data.probeCounts), 1000000)
data = data.probeCounts[sample1,]
#data = data.probeCounts
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)
##            8  Total
## Round 998602 998602
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   5057  64448  97022  69913 107574 129495 141334 153755 110908
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56913   62183      998602
## 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   583012  637923  348200 428069
## 2   718433  470565  371671 436535
## 3   908581  499325  171102 418196
## 4   926804  254270  407373 408757
## 5  1289516   18250  647348  42090
## 6      638     213 1981071  15282
## 7   843219  104875   93365 955745
## 8  1994876     388    1103    837
## 9      684 1995725     221    574
## 10 1878970     677  114640   2917
## 11   80186 1112788  111512 692718
## 12  342880  655722       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)+offset(fixedSddG)+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"
fit = glm(regressionFormula, 
          data=data, 
          family = poisson(link="log"))
## Warning: glm.fit: fitted rates numerically 0 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted rates numerically 0 occurred
## Warning in glm(regressionFormula, data = data, family = poisson(link
## = "log")): fitting to calculate the null deviance did not converge --
## increase 'maxit'?
summary(fit)
## 
## Call:
## glm(formula = regressionFormula, family = poisson(link = "log"), 
##     data = data)
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -56.041   -1.210   -0.390    0.918   67.797  
## 
## Coefficients:
##               Estimate Std. Error   z value Pr(>|z|)    
## (Intercept) 39.3616830  0.0026175 15037.654   <2e-16 ***
## N.A1         0.0061139  0.0001378    44.380   <2e-16 ***
## N.G1         0.0072465  0.0001705    42.499   <2e-16 ***
## N.T1        -0.0362859  0.0001706  -212.706   <2e-16 ***
## N.C2        -0.0529322  0.0001560  -339.385   <2e-16 ***
## N.G2         0.0238781  0.0001452   164.408   <2e-16 ***
## N.T2        -0.0345194  0.0001754  -196.775   <2e-16 ***
## N.C3        -0.0550794  0.0001771  -310.934   <2e-16 ***
## N.G3        -0.1432979  0.0002368  -605.022   <2e-16 ***
## N.T3        -0.0393158  0.0001696  -231.836   <2e-16 ***
## N.C4        -0.1445761  0.0002581  -560.061   <2e-16 ***
## N.G4        -0.0623558  0.0001626  -383.492   <2e-16 ***
## N.T4        -0.1165680  0.0001654  -704.951   <2e-16 ***
## N.C5        -0.4237589  0.0010614  -399.240   <2e-16 ***
## N.G5        -0.0959986  0.0001477  -649.813   <2e-16 ***
## N.T5        -0.6078251  0.0006348  -957.519   <2e-16 ***
## N.A6        -0.9801375  0.0279512   -35.066   <2e-16 ***
## N.C6        -0.9163720  0.0625001   -14.662   <2e-16 ***
## N.T6        -0.7966607  0.0011788  -675.843   <2e-16 ***
## N.A7        -0.8070699  0.0001294 -6236.586   <2e-16 ***
## N.C7        -1.1118090  0.0002961 -3754.363   <2e-16 ***
## N.G7        -0.2800741  0.0003998  -700.572   <2e-16 ***
## N.C8        -2.2179610 29.6438029    -0.075   0.9404    
## N.G8        -1.7297537  0.0195223   -88.604   <2e-16 ***
## N.T8        -0.6964109  0.0264497   -26.330   <2e-16 ***
## N.A9        -1.8600765  0.0188446   -98.706   <2e-16 ***
## N.G9         0.3026519  0.1254515     2.413   0.0158 *  
## N.T9        -0.6568010  0.0475211   -13.821   <2e-16 ***
## N.C10       -1.0511035  0.0416668   -25.226   <2e-16 ***
## N.G10       -0.5121916  0.0003194 -1603.619   <2e-16 ***
## N.T10       -0.6164851  0.0050177  -122.863   <2e-16 ***
## N.A11       -0.3482993  0.0004190  -831.261   <2e-16 ***
## N.G11       -0.2860060  0.0003275  -873.373   <2e-16 ***
## N.T11       -0.0842063  0.0001299  -648.258   <2e-16 ***
## N.A12       -0.1058304  0.0001783  -593.436   <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: 124521737  on 998601  degrees of freedom
## Residual deviance:   7149588  on 998567  degrees of freedom
## AIC: 8588943
## 
## Number of Fisher Scoring iterations: 18
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 R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006113935  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05293223 -0.05507943 -0.14457613 -0.42375888
## N.G  0.007246529  0.02387814 -0.14329785 -0.06235576 -0.09599862
## N.T -0.036285917 -0.03451938 -0.03931584 -0.11656801 -0.60782509
##              6          7          8          9         10          11
## N.A -0.9801375 -0.8070699  0.0000000 -1.8600765  0.0000000 -0.34829933
## N.C -0.9163720 -1.1118090 -2.2179610  0.0000000 -1.0511035  0.00000000
## N.G  0.0000000 -0.2800741 -1.7297537  0.3026519 -0.5121916 -0.28600603
## N.T -0.7966607  0.0000000 -0.6964109 -0.6568010 -0.6164851 -0.08420628
##             12          13         14         15         16         17
## N.A -0.1058304 -0.08420628 -0.6164851 -0.6568010 -0.6964109  0.0000000
## N.C  0.0000000 -0.28600603 -0.5121916  0.3026519 -1.7297537 -0.2800741
## N.G  0.0000000  0.00000000 -1.0511035  0.0000000 -2.2179610 -1.1118090
## N.T -0.1058304 -0.34829933  0.0000000 -1.8600765  0.0000000 -0.8070699
##             18          19          20          21          22
## N.A -0.7966607 -0.60782509 -0.11656801 -0.03931584 -0.03451938
## N.C  0.0000000 -0.09599862 -0.06235576 -0.14329785  0.02387814
## N.G -0.9163720 -0.42375888 -0.14457613 -0.05507943 -0.05293223
## N.T -0.9801375  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036285917
## N.C  0.007246529
## N.G  0.000000000
## N.T  0.006113935
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001377629 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001559650 0.0001771418 0.0002581435 0.0010614148
## N.G 0.0001705119 0.0001452371 0.0002368472 0.0001625998 0.0001477328
## N.T 0.0001705920 0.0001754259 0.0001695850 0.0001653561 0.0006347914
##               6            7           8          9           10
## N.A 0.027951234 0.0001294089  0.00000000 0.01884457 0.0000000000
## N.C 0.062500090 0.0002961379 29.64380288 0.00000000 0.0416668313
## N.G 0.000000000 0.0003997790  0.01952225 0.12545152 0.0003193972
## N.T 0.001178766 0.0000000000  0.02644966 0.04752105 0.0050176758
##               11          12           13           14         15
## N.A 0.0004190012 0.000178335 0.0001298962 0.0050176758 0.04752105
## N.C 0.0000000000 0.000000000 0.0003274728 0.0003193972 0.12545152
## N.G 0.0003274728 0.000000000 0.0000000000 0.0416668313 0.00000000
## N.T 0.0001298962 0.000178335 0.0004190012 0.0000000000 0.01884457
##              16           17          18           19           20
## N.A  0.02644966 0.0000000000 0.001178766 0.0006347914 0.0001653561
## N.C  0.01952225 0.0003997790 0.000000000 0.0001477328 0.0001625998
## N.G 29.64380288 0.0002961379 0.062500090 0.0010614148 0.0002581435
## N.T  0.00000000 0.0001294089 0.027951234 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001695850 0.0001754259 0.0001705920
## N.C 0.0002368472 0.0001452371 0.0001705119
## N.G 0.0001771418 0.0001559650 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001377629
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.36168
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002617542
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
vPheight = verticalPlot_height(ModelTest)
pM <- plot(ModelTest, plotTitle = "AR-DBD Nucleotide + Fixed Shape Values 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 = data.probeCounts[sample1,]
#data = data.probeCounts
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 R8 Nucleotide+ Fixed Shape Values 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: "
##            8  Total
## Round 998104 998104
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   582528  637831  348184 427665
## 2   718056  470469  371677 436006
## 3   908425  498958  170857 417968
## 4   926424  254094  407115 408575
## 5  1289035   18433  646573  42167
## 6      720     334 1979935  15219
## 7   841699  104776   93505 956228
## 8  1993623     327    1099   1159
## 9      678 1994256     609    665
## 10 1877487     727  114882   3112
## 11   79687 1111962  111525 693034
## 12  342946  655158       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   5091  64374  96871  69847 107518 129598 141257 153696 110851
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56852   62149      998104
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted rates numerically 0 occurred
## Warning: glm.fit: algorithm did not converge
## Warning: glm.fit: fitted rates numerically 0 occurred
## Warning in glm(regressionFormula, data = data, family = poisson(link
## = "log")): fitting to calculate the null deviance did not converge --
## increase 'maxit'?
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006103358  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05289212 -0.05511278 -0.14463839 -0.42369065
## N.G  0.007256250  0.02391278 -0.14326843 -0.06237793 -0.09609331
## N.T -0.036280412 -0.03447726 -0.03931120 -0.11660322 -0.60782364
##              6          7          8          9         10          11
## N.A -0.7752476 -0.8071446  0.0000000 -1.9506264  0.0000000 -0.34882272
## N.C -0.6285128 -1.1118885 -0.4373724  0.0000000 -0.9003735  0.00000000
## N.G  0.0000000 -0.2800461 -1.7099007  0.4529522 -0.5121286 -0.28594046
## N.T -0.7975488  0.0000000 -1.1882996 -0.5276423 -0.6138186 -0.08420791
##             12          13         14         15         16         17
## N.A -0.1058195 -0.08420791 -0.6138186 -0.5276423 -1.1882996  0.0000000
## N.C  0.0000000 -0.28594046 -0.5121286  0.4529522 -1.7099007 -0.2800461
## N.G  0.0000000  0.00000000 -0.9003735  0.0000000 -0.4373724 -1.1118885
## N.T -0.1058195 -0.34882272  0.0000000 -1.9506264  0.0000000 -0.8071446
##             18          19          20          21          22
## N.A -0.7975488 -0.60782364 -0.11660322 -0.03931120 -0.03447726
## N.C  0.0000000 -0.09609331 -0.06237793 -0.14326843  0.02391278
## N.G -0.6285128 -0.42369065 -0.14463839 -0.05511278 -0.05289212
## N.T -0.7752476  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036280412
## N.C  0.007256250
## N.G  0.000000000
## N.T  0.006103358
## 
## Nucleotide beta errors:
##                1            2            3            4           5
## N.A 0.0001377786 0.0000000000 0.0000000000 0.0000000000 0.000000000
## N.C 0.0000000000 0.0001559732 0.0001771755 0.0002581687 0.001060001
## N.G 0.0001705080 0.0001452433 0.0002368831 0.0001626176 0.000147751
## N.T 0.0001706143 0.0001754550 0.0001695992 0.0001653681 0.000634667
##               6            7          8          9           10
## N.A 0.012317098 0.0001294108 0.00000000 0.02727699 0.0000000000
## N.C 0.019632769 0.0002962170 0.04166681 0.00000000 0.0228219778
## N.G 0.000000000 0.0003996975 0.01804277 0.05872959 0.0003192132
## N.T 0.001183016 0.0000000000 0.05734733 0.05896035 0.0049448411
##               11           12           13           14         15
## N.A 0.0004204734 0.0001783287 0.0001298898 0.0049448411 0.05896035
## N.C 0.0000000000 0.0000000000 0.0003274428 0.0003192132 0.05872959
## N.G 0.0003274428 0.0000000000 0.0000000000 0.0228219778 0.00000000
## N.T 0.0001298898 0.0001783287 0.0004204734 0.0000000000 0.02727699
##             16           17          18          19           20
## N.A 0.05734733 0.0000000000 0.001183016 0.000634667 0.0001653681
## N.C 0.01804277 0.0003996975 0.000000000 0.000147751 0.0001626176
## N.G 0.04166681 0.0002962170 0.019632769 0.001060001 0.0002581687
## N.T 0.00000000 0.0001294108 0.012317098 0.000000000 0.0000000000
##               21           22           23
## N.A 0.0001695992 0.0001754550 0.0001706143
## N.C 0.0002368831 0.0001452433 0.0001705080
## N.G 0.0001771755 0.0001559732 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001377786
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.36242
## 
## Intercept beta errors:
## Round.8:
## [1] 0.00261764
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 992334"
## No shape parameters included in fit.
## [1] "i = 3"
## [1] "Round summary: "
##            8  Total
## Round 992334 992334
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   578798  634475  345980 425415
## 2   713000  468119  369403 434146
## 3   904808  495879  168310 415671
## 4   922498  252340  405276 404554
## 5  1283737   17453  642160  41318
## 6      709     451 1968988  14520
## 7   835414  104455   93013 951786
## 8  1982214     674     947    833
## 9      588 1982631     858    591
## 10 1867153     706  113729   3080
## 11   79357 1105674  111273 688364
## 12  342383  649951       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   5072  63812  96434  69453 106766 128861 140302 152573 110474
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56629   61958      992334
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006078596  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05285798 -0.05538693 -0.14499125 -0.42680932
## N.G  0.007207626  0.02394681 -0.14374003 -0.06255949 -0.09655342
## N.T -0.036265591 -0.03435153 -0.03940771 -0.11706989 -0.60888093
##              6          7          8          9         10          11
## N.A -0.7992291 -0.8075073  0.0000000 -1.9483814  0.0000000 -0.34890706
## N.C -0.6109298 -1.1121540 -0.5693159  0.0000000 -0.9715652  0.00000000
## N.G  0.0000000 -0.2803594 -1.7261507  0.1461386 -0.5121385 -0.28600896
## N.T -0.8013201  0.0000000 -0.9583589 -0.6986228 -0.6137702 -0.08438165
##             12          13         14         15         16         17
## N.A -0.1056784 -0.08438165 -0.6137702 -0.6986228 -0.9583589  0.0000000
## N.C  0.0000000 -0.28600896 -0.5121385  0.1461386 -1.7261507 -0.2803594
## N.G  0.0000000  0.00000000 -0.9715652  0.0000000 -0.5693159 -1.1121540
## N.T -0.1056784 -0.34890706  0.0000000 -1.9483814  0.0000000 -0.8075073
##             18          19          20          21          22
## N.A -0.8013201 -0.60888093 -0.11706989 -0.03940771 -0.03435153
## N.C  0.0000000 -0.09655342 -0.06255949 -0.14374003  0.02394681
## N.G -0.6109298 -0.42680932 -0.14499125 -0.05538693 -0.05285798
## N.T -0.7992291  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036265591
## N.C  0.007207626
## N.G  0.000000000
## N.T  0.006078596
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001378775 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001560677 0.0001773752 0.0002584840 0.0010816572
## N.G 0.0001706382 0.0001453533 0.0002374205 0.0001627232 0.0001478749
## N.T 0.0001707187 0.0001755608 0.0001697169 0.0001655874 0.0006376307
##               6            7          8          9           10
## N.A 0.013558950 0.0001295034 0.00000000 0.02727747 0.0000000000
## N.C 0.016753870 0.0002963470 0.05125807 0.00000000 0.0303171816
## N.G 0.000000000 0.0003998916 0.01928846 0.05018130 0.0003195155
## N.T 0.001199812 0.0000000000 0.05093628 0.05948299 0.0049351917
##               11          12           13           14         15
## N.A 0.0004206859 0.000178391 0.0001299858 0.0049351917 0.05948299
## N.C 0.0000000000 0.000000000 0.0003275073 0.0003195155 0.05018130
## N.G 0.0003275073 0.000000000 0.0000000000 0.0303171816 0.00000000
## N.T 0.0001299858 0.000178391 0.0004206859 0.0000000000 0.02727747
##             16           17          18           19           20
## N.A 0.05093628 0.0000000000 0.001199812 0.0006376307 0.0001655874
## N.C 0.01928846 0.0003998916 0.000000000 0.0001478749 0.0001627232
## N.G 0.05125807 0.0002963470 0.016753870 0.0010816572 0.0002584840
## N.T 0.00000000 0.0001295034 0.013558950 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001697169 0.0001755608 0.0001707187
## N.C 0.0002374205 0.0001453533 0.0001706382
## N.G 0.0001773752 0.0001560677 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001378775
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.36999
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002618464
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 992117"
## No shape parameters included in fit.
## [1] "i = 4"
## [1] "Round summary: "
##            8  Total
## Round 992117 992117
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   578655  634393  345895 425291
## 2   712816  468041  369304 434073
## 3   904715  495755  168157 415607
## 4   922297  252245  405233 404459
## 5  1283470   17394  642100  41270
## 6      668     275 1968811  14480
## 7   835228  104451   92941 951614
## 8  1982155     358     943    778
## 9      583 1982621     450    580
## 10 1866901     697  113700   2936
## 11   79183 1105661  111230 688160
## 12  342350  649767       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   5062  63784  96422  69438 106742 128834 140284 152557 110458
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56608   61928      992117
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006077568  0.00000000  0.00000000  0.00000000  0.0000000 -0.7995496
## N.C  0.000000000 -0.05285850 -0.05537880 -0.14499029 -0.4265195 -0.6975009
## N.G  0.007208404  0.02394527 -0.14374535 -0.06255652 -0.0965528  0.0000000
## N.T -0.036262319 -0.03435356 -0.03940367 -0.11707599 -0.6088717 -0.8011972
##              7         8          9         10          11         12
## N.A -0.8075087  0.000000 -1.9483894  0.0000000 -0.34889908 -0.1056801
## N.C -1.1121536 -1.102018  0.0000000 -0.9714363  0.00000000  0.0000000
## N.G -0.2803507 -1.726147  0.6530464 -0.5121407 -0.28600519  0.0000000
## N.T  0.0000000 -0.739690 -1.5823726 -0.6128446 -0.08437955 -0.1056801
##              13         14         15        16         17         18
## N.A -0.08437955 -0.6128446 -1.5823726 -0.739690  0.0000000 -0.8011972
## N.C -0.28600519 -0.5121407  0.6530464 -1.726147 -0.2803507  0.0000000
## N.G  0.00000000 -0.9714363  0.0000000 -1.102018 -1.1121536 -0.6975009
## N.T -0.34889908  0.0000000 -1.9483894  0.000000 -0.8075087 -0.7995496
##             19          20          21          22           23
## N.A -0.6088717 -0.11707599 -0.03940367 -0.03435356 -0.036262319
## N.C -0.0965528 -0.06255652 -0.14374535  0.02394527  0.007208404
## N.G -0.4265195 -0.14499029 -0.05537880 -0.05285850  0.000000000
## N.T  0.0000000  0.00000000  0.00000000  0.00000000  0.006077568
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001378782 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001560686 0.0001773760 0.0002584855 0.0010811413
## N.G 0.0001706386 0.0001453544 0.0002374291 0.0001627242 0.0001478759
## N.T 0.0001707187 0.0001755629 0.0001697171 0.0001655913 0.0006376543
##               6            7          8          9          10
## N.A 0.013559407 0.0001295043 0.00000000 0.02727757 0.000000000
## N.C 0.026001922 0.0002963472 0.04008662 0.00000000 0.030317178
## N.G 0.000000000 0.0003999249 0.01928846 0.03233685 0.000319518
## N.T 0.001199819 0.0000000000 0.02903231 0.06367150 0.004947338
##               11           12           13          14         15
## N.A 0.0004206813 0.0001783911 0.0001299862 0.004947338 0.06367150
## N.C 0.0000000000 0.0000000000 0.0003275132 0.000319518 0.03233685
## N.G 0.0003275132 0.0000000000 0.0000000000 0.030317178 0.00000000
## N.T 0.0001299862 0.0001783911 0.0004206813 0.000000000 0.02727757
##             16           17          18           19           20
## N.A 0.02903231 0.0000000000 0.001199819 0.0006376543 0.0001655913
## N.C 0.01928846 0.0003999249 0.000000000 0.0001478759 0.0001627242
## N.G 0.04008662 0.0002963472 0.026001922 0.0010811413 0.0002584855
## N.T 0.00000000 0.0001295043 0.013559407 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001697171 0.0001755629 0.0001707187
## N.C 0.0002374291 0.0001453544 0.0001706386
## N.G 0.0001773760 0.0001560686 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001378782
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.36996
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002618458
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 988927"
## No shape parameters included in fit.
## [1] "i = 5"
## [1] "Round summary: "
##            8  Total
## Round 988927 988927
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   576765  632850  344675 423564
## 2   710277  466852  368516 432209
## 3   902683  494133  166656 414382
## 4   919627  251279  404224 402724
## 5  1280324   17325  639272  40933
## 6      654     255 1962601  14344
## 7   831518  104181   92629 949526
## 8  1975861     321     920    752
## 9      574 1976393     435    452
## 10 1860824     685  113443   2902
## 11   78268 1102207  110981 686398
## 12  341378  647549       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   5043  63425  96053  69219 106303 128672 139833 152054 110214
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56418   61693      988927
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006065039  0.00000000  0.00000000  0.0000000  0.00000000 -0.7989972
## N.C  0.000000000 -0.05282577 -0.05542611 -0.1450768 -0.42644547 -0.7779214
## N.G  0.007209796  0.02397266 -0.14384247 -0.0626175 -0.09673257  0.0000000
## N.T -0.036278854 -0.03431445 -0.03943247 -0.1172086 -0.60927650 -0.8017470
##              7          8          9         10          11         12
## N.A -0.8076300  0.0000000 -2.0085642  0.0000000 -0.34950410 -0.1056982
## N.C -1.1122210 -1.2182972  0.0000000 -1.0509511  0.00000000  0.0000000
## N.G -0.2804762 -1.7420307  0.7435719 -0.5121817 -0.28599711  0.0000000
## N.T  0.0000000 -0.6770943 -1.9540027 -0.6155590 -0.08439218 -0.1056982
##              13         14         15         16         17         18
## N.A -0.08439218 -0.6155590 -1.9540027 -0.6770943  0.0000000 -0.8017470
## N.C -0.28599711 -0.5121817  0.7435719 -1.7420307 -0.2804762  0.0000000
## N.G  0.00000000 -1.0509511  0.0000000 -1.2182972 -1.1122210 -0.7779214
## N.T -0.34950410  0.0000000 -2.0085642  0.0000000 -0.8076300 -0.7989972
##              19         20          21          22           23
## N.A -0.60927650 -0.1172086 -0.03943247 -0.03431445 -0.036278854
## N.C -0.09673257 -0.0626175 -0.14384247  0.02397266  0.007209796
## N.G -0.42644547 -0.1450768 -0.05542611 -0.05282577  0.000000000
## N.T  0.00000000  0.0000000  0.00000000  0.00000000  0.006065039
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001379289 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001561209 0.0001774569 0.0002586165 0.0010809722
## N.G 0.0001706915 0.0001454015 0.0002377685 0.0001627889 0.0001479497
## N.T 0.0001707965 0.0001756681 0.0001697708 0.0001656763 0.0006390689
##               6            7          8          9           10
## N.A 0.013481926 0.0001295572 0.00000000 0.03466907 0.0000000000
## N.C 0.036084558 0.0002964438 0.03656940 0.00000000 0.0416668326
## N.G 0.000000000 0.0004001387 0.02055038 0.02149963 0.0003196237
## N.T 0.001202279 0.0000000000 0.02101136 0.06265854 0.0050005480
##               11          12           13           14         15
## N.A 0.0004225257 0.000178446 0.0001300260 0.0050005480 0.06265854
## N.C 0.0000000000 0.000000000 0.0003276029 0.0003196237 0.02149963
## N.G 0.0003276029 0.000000000 0.0000000000 0.0416668326 0.00000000
## N.T 0.0001300260 0.000178446 0.0004225257 0.0000000000 0.03466907
##             16           17          18           19           20
## N.A 0.02101136 0.0000000000 0.001202279 0.0006390689 0.0001656763
## N.C 0.02055038 0.0004001387 0.000000000 0.0001479497 0.0001627889
## N.G 0.03656940 0.0002964438 0.036084558 0.0010809722 0.0002586165
## N.T 0.00000000 0.0001295572 0.013481926 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001697708 0.0001756681 0.0001707965
## N.C 0.0002377685 0.0001454015 0.0001706915
## N.G 0.0001774569 0.0001561209 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001379289
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.37224
## 
## Intercept beta errors:
## Round.8:
## [1] 0.0026191
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 986714"
## No shape parameters included in fit.
## [1] "i = 6"
## [1] "Round summary: "
##            8  Total
## Round 986714 986714
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   575376  631750  343781 422521
## 2   708711  466029  367824 430864
## 3   901319  493117  165635 413357
## 4   917936  250668  403565 401259
## 5  1278197   17288  637232  40711
## 6      645     249 1958246  14288
## 7   829029  104030   92384 947985
## 8  1971465     313     912    738
## 9      570 1972064     428    366
## 10 1856554     681  113305   2888
## 11   77929 1099748  110830 684921
## 12  340321  646393       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   5031  63204  95790  69060 106024 128507 139449 151760 110038
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56303   61548      986714
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006040944  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05279784 -0.05543689 -0.14516382 -0.42643495
## N.G  0.007218393  0.02397867 -0.14383838 -0.06265629 -0.09687191
## N.T -0.036283332 -0.03427430 -0.03945393 -0.11732245 -0.60963045
##              6          7          8          9         10          11
## N.A -0.8004893 -0.8077304  0.0000000 -2.0071724  0.0000000 -0.34974760
## N.C -0.7779108 -1.1122544 -1.2187106  0.0000000 -1.0509815  0.00000000
## N.G  0.0000000 -0.2805716 -1.7420457  0.7441363 -0.5121789 -0.28600896
## N.T -0.8018132  0.0000000 -0.6716486 -1.9879498 -0.6155583 -0.08441039
##             12          13         14         15         16         17
## N.A -0.1057471 -0.08441039 -0.6155583 -1.9879498 -0.6716486  0.0000000
## N.C  0.0000000 -0.28600896 -0.5121789  0.7441363 -1.7420457 -0.2805716
## N.G  0.0000000  0.00000000 -1.0509815  0.0000000 -1.2187106 -1.1122544
## N.T -0.1057471 -0.34974760  0.0000000 -2.0071724  0.0000000 -0.8077304
##             18          19          20          21          22
## N.A -0.8018132 -0.60963045 -0.11732245 -0.03945393 -0.03427430
## N.C  0.0000000 -0.09687191 -0.06265629 -0.14383838  0.02397867
## N.G -0.7779108 -0.42643495 -0.14516382 -0.05543689 -0.05279784
## N.T -0.8004893  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036283332
## N.C  0.007218393
## N.G  0.000000000
## N.T  0.006040944
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001379754 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001561662 0.0001775189 0.0002587256 0.0010811715
## N.G 0.0001707335 0.0001454432 0.0002380312 0.0001628362 0.0001480137
## N.T 0.0001708624 0.0001757644 0.0001698287 0.0001657529 0.0006402737
##              6            7          8          9           10
## N.A 0.01356108 0.0001296018 0.00000000 0.03466908 0.0000000000
## N.C 0.03608456 0.0002964923 0.03645032 0.00000000 0.0416668328
## N.G 0.00000000 0.0004002757 0.02055038 0.02129569 0.0003196875
## N.T 0.00120320 0.0000000000 0.02060052 0.06596692 0.0050005604
##               11           12           13           14         15
## N.A 0.0004233749 0.0001785151 0.0001300609 0.0050005604 0.06596692
## N.C 0.0000000000 0.0000000000 0.0003276749 0.0003196875 0.02129569
## N.G 0.0003276749 0.0000000000 0.0000000000 0.0416668328 0.00000000
## N.T 0.0001300609 0.0001785151 0.0004233749 0.0000000000 0.03466908
##             16           17         18           19           20
## N.A 0.02060052 0.0000000000 0.00120320 0.0006402737 0.0001657529
## N.C 0.02055038 0.0004002757 0.00000000 0.0001480137 0.0001628362
## N.G 0.03645032 0.0002964923 0.03608456 0.0010811715 0.0002587256
## N.T 0.00000000 0.0001296018 0.01356108 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001698287 0.0001757644 0.0001708624
## N.C 0.0002380312 0.0001454432 0.0001707335
## N.G 0.0001775189 0.0001561662 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001379754
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.374
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002619743
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 986604"
## No shape parameters included in fit.
## [1] "i = 7"
## [1] "Round summary: "
##            8  Total
## Round 986604 986604
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   575309  631681  343742 422476
## 2   708615  465993  367793 430807
## 3   901239  493080  165580 413309
## 4   917842  250637  403535 401194
## 5  1278080   17287  637145  40696
## 6      645     249 1958029  14285
## 7   828916  104025   92376 947891
## 8  1971246     312     912    738
## 9      570 1971849     428    361
## 10 1856341     681  113298   2888
## 11   77914 1099620  110817 684857
## 12  340280  646324       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   5030  63192  95778  69057 106009 128500 139431 151738 110027
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56300   61542      986604
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006038364  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05279580 -0.05543861 -0.14516828 -0.42643510
## N.G  0.007217709  0.02398093 -0.14383314 -0.06266071 -0.09687665
## N.T -0.036285376 -0.03426805 -0.03945558 -0.11732747 -0.60964801
##              6          7          8          9         10          11
## N.A -0.8004890 -0.8077337  0.0000000 -2.0071708  0.0000000 -0.34979259
## N.C -0.7779117 -1.1122550 -1.2187024  0.0000000 -1.0509835  0.00000000
## N.G  0.0000000 -0.2805733 -1.7420470  0.7441532 -0.5121767 -0.28601188
## N.T -0.8018140  0.0000000 -0.6716346 -1.9879509 -0.6155596 -0.08441138
##             12          13         14         15         16         17
## N.A -0.1057464 -0.08441138 -0.6155596 -1.9879509 -0.6716346  0.0000000
## N.C  0.0000000 -0.28601188 -0.5121767  0.7441532 -1.7420470 -0.2805733
## N.G  0.0000000  0.00000000 -1.0509835  0.0000000 -1.2187024 -1.1122550
## N.T -0.1057464 -0.34979259  0.0000000 -2.0071708  0.0000000 -0.8077337
##             18          19          20          21          22
## N.A -0.8018140 -0.60964801 -0.11732747 -0.03945558 -0.03426805
## N.C  0.0000000 -0.09687665 -0.06266071 -0.14383314  0.02398093
## N.G -0.7779117 -0.42643510 -0.14516828 -0.05543861 -0.05279580
## N.T -0.8004890  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036285376
## N.C  0.007217709
## N.G  0.000000000
## N.T  0.006038364
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001379786 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001561686 0.0001775221 0.0002587298 0.0010811718
## N.G 0.0001707361 0.0001454455 0.0002380502 0.0001628399 0.0001480179
## N.T 0.0001708647 0.0001757681 0.0001698314 0.0001657582 0.0006403368
##              6            7          8          9           10
## N.A 0.01356109 0.0001296038 0.00000000 0.03466908 0.0000000000
## N.C 0.03608456 0.0002964930 0.03644976 0.00000000 0.0416668328
## N.G 0.00000000 0.0004002780 0.02055038 0.02129473 0.0003196888
## N.T 0.00120320 0.0000000000 0.02059960 0.06596740 0.0050005605
##               11           12           13           14         15
## N.A 0.0004234784 0.0001785179 0.0001300629 0.0050005605 0.06596740
## N.C 0.0000000000 0.0000000000 0.0003276898 0.0003196888 0.02129473
## N.G 0.0003276898 0.0000000000 0.0000000000 0.0416668328 0.00000000
## N.T 0.0001300629 0.0001785179 0.0004234784 0.0000000000 0.03466908
##             16           17         18           19           20
## N.A 0.02059960 0.0000000000 0.00120320 0.0006403368 0.0001657582
## N.C 0.02055038 0.0004002780 0.00000000 0.0001480179 0.0001628399
## N.G 0.03644976 0.0002964930 0.03608456 0.0010811718 0.0002587298
## N.T 0.00000000 0.0001296038 0.01356109 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001698314 0.0001757681 0.0001708647
## N.C 0.0002380502 0.0001454455 0.0001707361
## N.G 0.0001775221 0.0001561686 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001379786
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.37408
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002619789
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 986603"
## No shape parameters included in fit.
## [1] "i = 8"
## [1] "Round summary: "
##            8  Total
## Round 986603 986603
## [1] "Mono-nucleotide summary: "
##        N.A     N.C     N.G    N.T
## 1   575309  631680  343741 422476
## 2   708614  465992  367793 430807
## 3   901237  493080  165580 413309
## 4   917841  250637  403534 401194
## 5  1278078   17287  637145  40696
## 6      645     249 1958027  14285
## 7   828914  104025   92376 947891
## 8  1971244     312     912    738
## 9      570 1971847     428    361
## 10 1856339     681  113298   2888
## 11   77913 1099619  110817 684857
## 12  340280  646323       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   5030  63192  95778  69057 106009 128500 139431 151738 110026
## Strand.R      0      0      0      0      0      0      0      0      0
##          View.10 View.11 StrandTotal
## Strand.F   56300   61542      986603
## Strand.R       0       0           0
## [1] "Regression Formula: "
## [1] "ObservedCount ~ offset(logProb)+offset(fixedSddG)+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"
## Warning: glm.fit: fitted rates numerically 0 occurred
## No shape parameters included in fit.
## An object of class 'model'
## 
## Slot "name":  AR-DBD R8 Nucleotides + Fixed Shape Values (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 and shape features (shape = HelT, MGW) with fixed values for shape parameter positions not included in Shape.set used as offsets for the glm fit, and 11 view(s) per strand of DNA and 1 round(s) of data (round = 8) with reverse complement symmetry.
## 
## Slot "regressionFormula":  ObservedCount ~ offset(logProb)+offset(fixedSddG)+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 
## 
## Slot "shapeParamsUsed[[1]]":  HelT MGW 
## 
## 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.006038310  0.00000000  0.00000000  0.00000000  0.00000000
## N.C  0.000000000 -0.05279567 -0.05543868 -0.14516820 -0.42643505
## N.G  0.007217837  0.02398088 -0.14383322 -0.06266048 -0.09687667
## N.T -0.036285438 -0.03426806 -0.03945569 -0.11732744 -0.60964800
##              6          7          8          9         10          11
## N.A -0.8004890 -0.8077336  0.0000000 -2.0071709  0.0000000 -0.34979092
## N.C -0.7779117 -1.1122550 -1.2187028  0.0000000 -1.0509835  0.00000000
## N.G  0.0000000 -0.2805732 -1.7420469  0.7441527 -0.5121768 -0.28601192
## N.T -0.8018141  0.0000000 -0.6716349 -1.9879514 -0.6155596 -0.08441141
##             12          13         14         15         16         17
## N.A -0.1057464 -0.08441141 -0.6155596 -1.9879514 -0.6716349  0.0000000
## N.C  0.0000000 -0.28601192 -0.5121768  0.7441527 -1.7420469 -0.2805732
## N.G  0.0000000  0.00000000 -1.0509835  0.0000000 -1.2187028 -1.1122550
## N.T -0.1057464 -0.34979092  0.0000000 -2.0071709  0.0000000 -0.8077336
##             18          19          20          21          22
## N.A -0.8018141 -0.60964800 -0.11732744 -0.03945569 -0.03426806
## N.C  0.0000000 -0.09687667 -0.06266048 -0.14383322  0.02398088
## N.G -0.7779117 -0.42643505 -0.14516820 -0.05543868 -0.05279567
## N.T -0.8004890  0.00000000  0.00000000  0.00000000  0.00000000
##               23
## N.A -0.036285438
## N.C  0.007217837
## N.G  0.000000000
## N.T  0.006038310
## 
## Nucleotide beta errors:
##                1            2            3            4            5
## N.A 0.0001379787 0.0000000000 0.0000000000 0.0000000000 0.0000000000
## N.C 0.0000000000 0.0001561686 0.0001775221 0.0002587298 0.0010811718
## N.G 0.0001707361 0.0001454455 0.0002380502 0.0001628401 0.0001480178
## N.T 0.0001708647 0.0001757681 0.0001698315 0.0001657582 0.0006403368
##              6            7          8          9           10
## N.A 0.01356109 0.0001296039 0.00000000 0.03466908 0.0000000000
## N.C 0.03608456 0.0002964930 0.03644978 0.00000000 0.0416668328
## N.G 0.00000000 0.0004002780 0.02055038 0.02129476 0.0003196888
## N.T 0.00120320 0.0000000000 0.02059962 0.06596736 0.0050005605
##               11          12           13           14         15
## N.A 0.0004234824 0.000178518 0.0001300629 0.0050005605 0.06596736
## N.C 0.0000000000 0.000000000 0.0003276898 0.0003196888 0.02129476
## N.G 0.0003276898 0.000000000 0.0000000000 0.0416668328 0.00000000
## N.T 0.0001300629 0.000178518 0.0004234824 0.0000000000 0.03466908
##             16           17         18           19           20
## N.A 0.02059962 0.0000000000 0.00120320 0.0006403368 0.0001657582
## N.C 0.02055038 0.0004002780 0.00000000 0.0001480178 0.0001628401
## N.G 0.03644978 0.0002964930 0.03608456 0.0010811718 0.0002587298
## N.T 0.00000000 0.0001296039 0.01356109 0.0000000000 0.0000000000
##               21           22           23
## N.A 0.0001698315 0.0001757681 0.0001708647
## N.C 0.0002380502 0.0001454455 0.0001707361
## N.G 0.0001775221 0.0001561686 0.0000000000
## N.T 0.0000000000 0.0000000000 0.0001379787
## 
## 
## An object of class 'Intercept'
## Fits intercept(s) for 1 round(s) (round = 8).
## Intercept beta values:
## Round.8:
## [1] 39.37408
## 
## Intercept beta errors:
## Round.8:
## [1] 0.002619789
## 
## 
## 
## An object of class 'Shape'
## Fits 3 shape coefficients for 3 kinds of shape parameter(s) (shape = HelT, MGW) for a feature model of length 23.
## Shape features are reverse complement symmetric.
## Shape beta values:
##                       1            2           3           4            5
## Shape.HelTA 0.012777702  0.009207855  0.01059514  0.02979068 -0.050599877
## Shape.HelTB 0.005339387 -0.003648404 -0.03570894 -0.01147808 -0.008140565
## Shape.MGW   0.011501160 -0.008920502 -0.02962055 -0.18939069 -0.087382882
##                       6          7         8           9          10
## Shape.HelTA -0.04637238 -0.1065263 0.1929080  0.19583385  0.11049638
## Shape.HelTB -0.12908078  0.3710017 0.7437455 -0.03934332 -0.07502132
## Shape.MGW    0.06924589  0.3766392 1.2499150  0.17179767 -0.17550875
##                      11         12          13          14          15
## Shape.HelTA  0.09218623 0.02171862 -0.03883268 -0.07502132 -0.03934332
## Shape.HelTB -0.03883268 0.02171862  0.09218623  0.11049638  0.19583385
## Shape.MGW   -0.12381238 0.15027160 -0.12381238 -0.17550875  0.17179767
##                    16         17          18           19          20
## Shape.HelTA 0.7437455  0.3710017 -0.12908078 -0.008140565 -0.01147808
## Shape.HelTB 0.1929080 -0.1065263 -0.04637238 -0.050599877  0.02979068
## Shape.MGW   1.2499150  0.3766392  0.06924589 -0.087382882 -0.18939069
##                      21           22          23
## Shape.HelTA -0.03570894 -0.003648404 0.005339387
## Shape.HelTB  0.01059514  0.009207855 0.012777702
## Shape.MGW   -0.02962055 -0.008920502 0.011501160
## 
## Shape beta errors:
##             1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
## Shape.HelTA 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.HelTB 0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## Shape.MGW   0 0 0 0 0 0 0 0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
## 
## [1] "Number of Observations in Design Matrix: 986603"
## No shape parameters included in fit.
## [1] "Stability Reached after 8 iterations."
ModelTest <- finalizeFeatureBetas(ModelTest)

pM <- plot(ModelTest, plotTitle = "AR-DBD R8 Nucleotides + Fixed Shape Values 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