I am having trouble generating heatmaps and PCA plots after using the aggTax function in metagenomeSeq. I receive the following error:
Error in hclustfun(distfun(x)) :
NA/NaN/Inf in foreign function call (arg 11)
Here is the code:
#Aggregate data (using normalized counts); unaggregated data has 319 features and 69 samples; aggregated data has 16 features and 69 samples:
class = as.character(fData(unaggregated)[, 1])
aggregated = aggTax(MRcounts(unaggregated, norm=TRUE), lvl = class, out = "MRexperiment")
#Remove samples that will not cluster b/c they do not contain at least 2 features:
EmptySamples = which(colSums(MRcounts(aggregated) > 0) < 2)
aggregated = aggregated[ ,-EmptySamples]
#Generate heatmap (or use display()):
trials = pData(unaggregated)$Time
heatmapColColors = brewer.pal(12, "Set3")[as.integer(factor(trials))]
heatmapCols = colorRampPalette(brewer.pal(9, "RdBu"))(50)
plotMRheatmap(obj = aggregated, n = 200, cexRow = 0.4, cexCol = 0.4, trace = "none", col = heatmapCols, ColSideColors = heatmapColColors)
Then I get the error message (which I also receive when trying to use display()). I've checked that the data matrix doesn't contain any samples with <2 features, so I'm not sure what is happening. Thanks again.