raerose01 / deconstructSigs

deconstructSigs
138 stars 47 forks source link

Issue in mut.to.sigs.input, "Error in ans[] <- x : replacement has length zero" #53

Closed Salvobioinfo closed 4 years ago

Salvobioinfo commented 4 years ago

I'ḿ using one my old script (i wrote it 2 month ago), but now the function mut.to.sigs.input give me an error. my command is: sigs.input = mut.to.sigs.input(Mut_for_sig, sample.id = "Sample", chr = "Chr", pos = "Pos", ref = "Ref", alt = "Alt", bsg = BSgenome.Hsapiens.NCBI.GRCh38) My dataframe: ´> head(Mut_for_sig) Sample Chr Pos Ref Alt 1 TCGA-2F-A9KO-01A 1 30240 T A 2 TCGA-2F-A9KO-01A 1 69968 A G 3 TCGA-2F-A9KO-01A 1 258588 C T 4 TCGA-2F-A9KO-01A 1 258868 T C 5 TCGA-2F-A9KO-01A 1 348192 C A 6 TCGA-2F-A9KO-01A 1 348301 G A´

´> str(Mut_for_sig) 'data.frame': 520624 obs. of 5 variables: $ Sample: Factor w/ 37 levels "TCGA-2F-A9KO-01A",..: 1 1 1 1 1 1 1 1 1 1 ... $ Chr : Factor w/ 24 levels "1","10","11",..: 1 1 1 1 1 1 1 1 1 1 ... $ Pos : int 30240 69968 258588 258868 348192 348301 874226 961899 1564698 2030143 ... $ Ref : Factor w/ 4 levels "A","C","G","T": 4 1 2 4 2 3 1 1 4 2 ... $ Alt : Factor w/ 16 levels "A","A/C","A/G",..: 1 9 13 5 1 1 13 9 5 13 ...´

the error is: Error in ans[] <- x : replacement has length zero In addition: Warning message: In mut.to.sigs.input(Mut_for_sig, sample.id = "Sample", chr = "Chr", : Check chr names -- not all match BSgenome.Hsapiens.NCBI.GRCh38 object: chr1, chr10, chr11, chr12, chr13, chr14, chr15, chr16, chr17, chr18, chr19, chr2, chr20, chr21, chr22, chr3, chr4, chr5, chr6, chr7, chr8, chr9, chrX, chrY

What exactly does this mean? I known that warning means that there are positions that do not match the reference base when it's being looked up in the BSgenome object. But what is the error ??? PS The script doesn't even work with my old data, that sound very strange.

Thanks.

njalloul90 commented 4 years ago

I'm having the exact same problem, any ideas why it's not working ?

raerose01 commented 4 years ago

Could you try using "BSgenome.Hsapiens.UCSC.hg38" as the BSgenome object instead and see if that works?

Salvobioinfo commented 4 years ago

I'm writing exactly: did you try using "BSgenome.Hsapiens.UCSC.hg38" ? I solved my issue in that way, i don't know why.

chiguashaonv commented 4 years ago

I also have the same problem, my data is build in "BSgenome.Hsapiens.NCBI.GRCh38", is it right that change the genome to "BSgenome.Hsapiens.UCSC.hg38" ?