Description Usage Arguments Value Examples
Performs PCA+tSNE of a k-mer frequency matrix. First, the k-mer matrix is scaled, then PCA (prcomp) is performed, then the number of significant PCs is determined, then tSNE is performed using the significant PCs.
1 |
x |
A matrix of k-mer frequencies, kmers (rows) by samples (columns), as would be produced by inputKMerFreqs. |
nPCs |
Method for identifying significant PCs, or the number of PCs to use. Either one of ("jackstraw", or "permutation"), or an integer number of PCs. defaults to "jackstraw" |
scale |
scale the data? defaults to True. |
Returns a PCA object (as created by prcomp), also including $nPCs (the number of significant PCs), $nPCMethod (the method used to get the number of PCs), $tSNE, the tsne object (as created by tsne), and $tSNEProj, the projection of the samples onto the two tSNE components.
1 2 3 4 5 | kmerMat = inputKMerFreqs(sprintf("kMerFiles/%s.freq.gz",sampleDesc$id), IDs = sampleDesc$id)
myPCA = doKMerPCA(kmerMat, nPCs = "jackstraw")
p = ggplot(pcs$tSNEProj, aes(tSNE1, tSNE2)) + geom_point(); print(p) # plot tSNE projection
pcs$tSNEProj = merge(pcs$tSNEProj,sampleDesc, by.x="ID",by.y="goodID") # add sample information to tSNE projection
p = ggplot(pcs$tSNEProj, aes(tSNE1, tSNE2, colour=celltype)) + geom_point() + theme_classic(); print(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.