ZhenxingGuo0015 / TRESS

Toobox for RNA Methylation Sequencing Analysis
GNU General Public License v3.0
8 stars 4 forks source link

Error in Step2 for TRESS_DMRfit #2

Closed MaestSi closed 2 years ago

MaestSi commented 2 years ago

Dear Zhenking, I'm running TRESS_DMRfit function from TRESS_1.2.0 to call differential m6A peaks at different time points after a drug treatment, but the command results in errors. This is the command I ran:

DMR.fit <- TRESS_DMRfit(IP.file = basename(IP_bam_files),
             Input.file = basename(input_bam_files),
             InputDir = bam_dir,
             OutputDir = output_dir,
             Path_To_AnnoSqlite = annotation_sqlite,
             variable = variable_treatment,
             model = model_treatment,
             experimentName = "treatment_time_course")

with:

> model_treatment
[1] "~1 + time"

> str(model_treatment)
 chr "~1 + time"

and:

> variable_treatment
   time
1    0h
2    0h
3    0h
4    1h
5    1h
6    1h
7    2h
8    2h
9    2h
10   4h
11   4h
12   4h
13   8h
14   8h
15   8h
16  16h
17  16h
18  16h

> str(variable_treatment)
'data.frame':   18 obs. of  1 variable:
 $ time: chr  "0h" "0h" "0h" "1h" ...

I have 3 replicates for each time point in both input and IP, and bam files are provided in the same order as specified in the variable_treatment dataframe. This is the error I got:

##### Divid the genome into bins and obtain bin counts...
Time used to obtain bin-level data is: 
31.86404
##### Step 1: Call candidate DMRs...
Merge bumps from different replicates...
The number of candidates is: 
25475
Time used in Step 1 is: 
11.58883
##### Step 2: Model fitting on candidates...
[1] "Start to estimate preliminary MLE ..."
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': error in evaluating the argument 'x' in selecting a method for function 'ncol': $ operator is invalid for atomic vectors
In addition: Warning messages:
1: In .Seqinfo.mergexy(x, y) :
  Each of the 2 combined objects has sequence levels not in the other:
  - in 'x': GL000219.1
  - in 'y': KI270721.1, KI270711.1
  Make sure to always combine/compare objects based on the same reference
  genome (use suppressWarnings() to suppress this warning).
2: In mclapply(seq_len(nrow(Ratio)), iMLE, X, Y, sx, sy, Ratio, D,  :
  all scheduled cores encountered errors in user code

The command that is failing is:

res.MLE = MLE.parallel(mat = as.matrix(counts),
                         sf = sf,
                         D = model.matrix(model, variable)
                         )

When I run it, I find:

Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'x' in selecting a method for function 'as.matrix': error in evaluating the argument 'x' in selecting a method for function 'ncol': $ operator is invalid for atomic vectors
In addition: Warning message:
In mclapply(seq_len(nrow(Ratio)), iMLE, X, Y, sx, sy, Ratio, D,  :
  all scheduled cores encountered errors in user code

In particular, it seems it doesn't like model_treatment or variable_treaments variables: D = model.matrix(model_treatment, variable_treatment) I get: Error: $ operator is invalid for atomic vectors

Could you please suggest me if you spot any errors in model_treatment and variable_treatment variables? Thanks in advance, Simone

MaestSi commented 2 years ago

Hi @ZhenxingGuo0015 , I think the issue was due to an error in model_treatment variable. in fact, when changing: model_treatment <- "~1 + time" to: model_treatment <- ~1 + time the script continued after that point. I have another question, I'll open another issue for that one. Thanks, Simone