I have raw counts data from featureCounts. I actually wanted to do survival analysis. For a specific gene I want to classify the samples into Low and High based on expression cutoff. For that I'm using maxstat package.
First I would like to convert raw counts to FPKM. So, I did like following.
sample1 sample2 sample3 sample4 sample5 A1BG-AS1 195 612 145 131 300 A2M-AS1 373 445 573 1388 1386 A2ML1-AS1 75 27 45 18 35 A2ML1-AS2 0 0 0 0 0 AA06 0 0 0 0 0
I have a matrix like above having genes as rows and samples as columns.
library("DESeq2") dds <- DESeqDataSetFromMatrix(countData = counts, colData = coldata, design = ~ Type) dds dds <- estimateSizeFactors(dds)
And now I used fpm() function to calculate FPKM from counts data.
fpkm_data <- fpkm(dds) Error in fpkm(dds) : rowRanges(object) has all ranges of zero width. the user should instead supply a column, mcols(object)$basepairs, which will be used to produce FPKM values
Sorry, no idea about what to do now. Can you please tell me what I need to do to the data to calculate FPKM. Thank you
Hello,
I am having the same question. So I have a matrix with the gene length which i calculated from the gff file and I want to add this in the dds in order to run the fpkm(dds) can you help me with this?
Just add the number of basepairs to here: