#Initialize the SELEX package
#options(java.parameters="-Xmx1500M")
#library(SELEX)
# Configure the current session
workDir = file.path(".", "SELEX_workspace")
selex.config(workingDir=workDir,verbose=FALSE, maxThreadNumber= 4)
# Extract sample data from package, including XML database
sampleFiles = selex.exampledata(workDir)
# Load & display all sample files using XML database
selex.loadAnnotation(sampleFiles[3])
selex.sampleSummary()
# Create sample handles
r0 = selex.sample(seqName="R0.libraries", sampleName="R0.barcodeGC", round=0)
r2 = selex.sample(seqName='R2.libraries', sampleName='ExdHox.R2', round=2)
# Split the r0 sample into testing and training sets
r0.split = selex.split(sample=r0)
r0.split
# Display all currently loaded samples
selex.sampleSummary()
# Find kmax on the test dataset
k = selex.kmax(sample=r0.split$test)
# Build the Markov model on the training dataset
mm = selex.mm(sample=r0.split$train, order=NA, crossValidationSample=r0.split$test)
# See Markov model R^2 values
selex.mmSummary()
# Kmer counting with an offset
t1 = selex.counts(sample=r2, k=2, offset=14, markovModel=NULL)
# Kmer counting with a Markov model (produces expected counts)
t2 = selex.counts(sample=r2, k=4, markovModel=mm)
# Display all available kmer statistics
selex.countSummary()
# Calculate information gain
ig = selex.infogain(sample=r2, k=8, mm)
# View information gain results
selex.infogainSummary()
# Perform the default analysis
selex.run(trainingSample=r0.split$train, crossValidationSample=r0.split$test,
infoGainSample=r2)
# View all stats
selex.summary()
Run the code above in your browser using DataLab