gravatar for rhasanvandj

2 hours ago by

I want to plot heatmap with the DESeq2 result. the heatmap will be for differentially expressed genes with FDR<0.05. but the data coming from DESeq2 includes NA which create problem when sub setting them for heatmap.

how can I deal with these NAs? this is the code:

## Differential abundance
alpha <- 0.05 #set the cutoff value
    ## subset only significant genes
    sig <- res[res$padj < alpha, ] 
    sig_genes <- rownames(sig)
    subset <- rdata[sig_genes,]
    ## log transform data for visualization
    tdata <- log2(subset + 0.5)
    mat <- as(tdata, "matrix")

    ## Set colours
    my_colour = list(
            Group = c("0" = "blue", "1" = "yellow"))

    #################
    pheatmap(symbreaks = FALSE,cluster_cols = FALSE,
             cluster_rows = TRUE,color = colorRampPalette(c("#f71616","#f71616","white",
    "#1919d4", "#1919d4"))(100),annotation_col = sample_org,
    annotation_colors = my_colour, mat, scale = "row")

Error is created here :

 sig <- res[res$padj < alpha, ]

error:

Error: logical subscript contains NAs



Source link