tzhu-bio / cisDynet

An integrated platform for modeling gene-regulatory dynamics and networks
MIT License
22 stars 3 forks source link

Error when running p2g_res <- getPeak2Gene(...) #2

Closed yashi99 closed 8 months ago

yashi99 commented 8 months ago

Hi, I could successfully generate the three input files for the function getPeak2Gene , but it went wrong as shown below:

p2g_res <- getPeak2Gene(atac_matrix = "./ATAC_CPM_Norm_Data.tsv",
            rna_matrix = "./selected_sample_tpm_matrix.tsv", 
            peak_annotation = "./Merged_Peaks_Annotations.tsv",
            max_distance = 50000,N_permutation = 10000,save_path = "./atac4_downstream_results/")

2023-11-02 00:58:56 Remove the gene with all expression value is 0.
2023-11-02 00:58:56 Make the pseudo data for permutation...
Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column          
In addition: There were 50 or more warnings (use warnings() to see the first 50)

I have sent the three input files to your mail address. Could you please help to solve it?

tzhu-bio commented 8 months ago

Sure, but I didn't get an email about your input files.

tzhu-bio commented 8 months ago

To ensure that getPeak2Gene runs successfully, please note the following:

  1. The number of samples was the same for ATAC and RNA and in the same order;
  2. The rownames of the gene expression matrix should be the same as the fourth column of the _genebed in the addAnnotation you set.
yashi99 commented 8 months ago

Thank you for your reminder! I re-made the gene_bed file using my .gtf to make sure the consistence between the gene expression matrix and the gene_bed, and then it works!

tzhu-bio commented 8 months ago

OK, that's great!

yashi99 commented 8 months ago

Then I could sucuessfully run plotPeakGene(...) using the generated object _p2gres , but I got error when running plotP2GHeatmap() :

plotP2GHeatmap(p2g_res = "./Peak2Gene_All_Links.rds",
              cor_cutoff = 0.4,
              atac_matrix = "./ATAC_CPM_Norm_Data.tsv",
              rna_matrix = "./selected_sample_tpm_matrix_final.tsv")
2023-11-02 17:01:19 Depending on the cutoff. The Peak2Gene links number: 54315

2023-11-02 17:01:20 Calculating ATAC matrix.

2023-11-02 17:05:10 Calculating RNA matrix.

Error in grid.Call.graphics(C_downvppath, name$path, name$name, strict): Viewport 'log10(Summit2TSS + 1)_heatmap_body_1_1' was not found
Traceback:

1. plotP2GHeatmap(p2g_res = "./atac4_downstream_results/Peak2Gene_All_Links.rds", 
 .     cor_cutoff = 0.2, atac_matrix = "./atac4_downstream_results/ATAC_CPM_Norm_Data.tsv", 
 .     rna_matrix = "./atac4_downstream_results/gse99350_selected_sample_tpm_matrix_final.tsv")
2. ComplexHeatmap::draw(p3 + p4 + pdis + ptype + pcor + ppvalue, 
 .     column_title = sprintf("%s Peak-to-Gene linkages", dim(p2g)[1]))
3. ComplexHeatmap::draw(p3 + p4 + pdis + ptype + pcor + ppvalue, 
 .     column_title = sprintf("%s Peak-to-Gene linkages", dim(p2g)[1]))
4. .local(object, ...)
5. grid.draw(p)
6. grid.draw.gTree(p)
7. recordGraphics(drawGTree(x), list(x = x), getNamespace("grid"))
8. drawGTree(x)
9. grid.draw(x$children[[i]], recording = FALSE)
10. grid.draw.grob(x$children[[i]], recording = FALSE)
11. recordGraphics(drawGrob(x), list(x = x), getNamespace("grid"))
12. drawGrob(x)
13. preDraw(x)
14. preDraw.grob(x)
15. pushvpgp(x)
16. pushgrobvp(x$vp)
17. pushgrobvp.vpPath(x$vp)
18. downViewport(vp, strict = TRUE, recording = FALSE)
19. downViewport.vpPath(vp, strict = TRUE, recording = FALSE)
20. grid.Call.graphics(C_downvppath, name$path, name$name, strict)

I will send you the three files soon. Could you please give some suggestions?