harbourlab / uphyloplot2

Draw phylogenetic trees of tumor evolution
68 stars 24 forks source link

Leiden - script fail #24

Open HowieJM opened 12 months ago

HowieJM commented 12 months ago

Hi, thanks for this tool ;) A quick Q. I already ran InferCNV, HMM = T, on current "best", which is Leiden.

io2 = infercnv::run(io1,
                    cutoff=0.1, 
                    out_dir="cutoff0_1_res0_000375_HMM", 
                    cluster_by_groups=F, 
                    HMM=T, 
                    analysis_mode='subclusters',
                    tumor_subcluster_partition_method='leiden',
                    leiden_resolution=0.000375,
                    denoise=T,
                    sd_amplifier=2,
                    #up_to_step = 15, 
                    resume_mode = TRUE,
                    num_threads=14
) 

I used this for some downstream analysis, but I now want to make a phylogenetic tree, ideally without re-running all prior analysis steps. Your tool looks good. I ran the test fine. But on my data, it fails.

Here is a snippet from test, and from my data:

Test:

cell_group_name cell
Retinoblastoma.Retinoblastoma_sRetinoblastoma.1.1.1.1   GATTCAGAGACGCAAC
Retinoblastoma.Retinoblastoma_sRetinoblastoma.1.1.1.1   GGCCGATCAAGTTCTG
Retinoblastoma.Retinoblastoma_sRetinoblastoma.1.1.1.1   AACTCTTAGACGCTTT
Retinoblastoma.Retinoblastoma_sRetinoblastoma.1.1.1.1   CACATTTGTACAGCAG

Mine:

cell_group_name cell
all_observations.all_observations_s1    AAAGTGAAGTGGAAGA
all_observations.all_observations_s1    AACAACCTCAGTCTTT
all_observations.all_observations_s1    AACCACAGTTTGGGTT
all_observations.all_observations_s1    AACGGGACAAGCGCAA

For my one, I edited out the reference cells, and also prefixes like REL TN ahead of cell names. Nonetheless, the result of mine is:

,100.0

Where the test is like:

1,0.0
1.1,0.0,B
1.1.1,0.0,C
1.1.1.1,15.776699029126213,D
1.1.1.2,16.74757281553398,E
1.1.2,0.0,F
1.1.2.1,15.29126213592233,G
1.1.2.2,27.9126213592233,H
1.2,0.0,I
1.2.1,0.0,J
1.2.1.1,9.466019417475728,K
1.2.1.2,6.553398058252427,L

I guess the difference relates to the .1.1.1.1 etc format, where I have .1-15. Do you know if there is some way I can get round this, or a way I could make my file in the format?

Would be great to know, as would be very useful if it was possible to run this tool with the Leiden approach ..

atzatsos commented 7 months ago

I experience the same problem. I used Leiden partition for infercnv and used the "cell_groupings" file as input but I failed to draw phylogenetic trees. Any help will be greatly appreciated.

andynkili commented 6 months ago

@atzatsos, @JamesHowie14 I am not part of the Dev Team but I had the same issue and the fix that I used is write_phylo=T when running infercnv. It will produce a newick file "infercnv.observations_dendrogram.txt". Then you can run python newick_input.py to load that file to choose tree length and ouput name. The latter will yield the corresponding cell.grouping file that you have to put inside uphyloplot2/Inputs path.

Best, Andy