AAlhendi1707 / countToFPKM

Convert Counts to Fragments per Kilobase of Transcript per Million (FPKM)
GNU General Public License v3.0
61 stars 15 forks source link

fpkm function generate a NA matrix #5

Closed MiriamRiquelmeP closed 4 years ago

MiriamRiquelmeP commented 4 years ago

I am trying to run the fpkm function on my data and I can only obtain an empty matrix with NA in every rows and columns.

Also, the size of the fpkm matrix is smaller than the initial counting matrix (it has less rows). Why is this happening ?

Here is the code I am using:

cuentas <-read.csv('Counts.csv', row.names=1) counts <- as.matrix(cuentas)

featureLength_GC <- read.csv('featureLength.csv') featureLength <- featureLength_GC$length

meanFragments <- read.csv('meanFragmentLength/meanFragments.csv') meanFragmentLength <- meanFragments$MEAN

fpkm_matrix <- fpkm (counts = counts, featureLength = featureLength, meanFragmentLength = meanFragmentLength )

Thank you in advance.

AAlhendi1707 commented 4 years ago

Hi Miriam,

This is not happen before!

Frist you need to check if you can reproduce data in usage example.. see if you can get the same outputs!

Second, you need to each counts, featureLength, meanFragmentLength, all should be numeric!

For example try to check the structure your input counts after you convert it to matrix:

cuentas <-read.csv('Counts.csv', row.names=1)
counts <- as.matrix(cuentas)
str(counts)

You should see all the columns in your matrix as numeric. if NOT then you need to convert it into numeric!

Please let me now if this work with you?

MiriamRiquelmeP commented 4 years ago

Thanks for answering, Ahmed

Apparently my matrix of featureLength has some NAs that were making the fpkm_matrix fail in every value. That was the problem. I solve it by filtering and removing the NAs.

Apart of that, it works pretty good. Thank you again, Miriam