treangenlab / methphaser

MethPhaser: methylation-based haplotype phasing of human genomes
https://www.nature.com/articles/s41467-024-49588-0
MIT License
42 stars 1 forks source link

The command of Methphaser N50 #24

Open Humonex opened 2 months ago

Humonex commented 2 months ago

We noticed that your N50 is different from Whatshap N50, and the Methphaser N50 is more reasonable. Could you please provide a command to call the N50 calculation method in the code or provide a script to calculate N50? for example the code in the [post_processing_script.ipynb] get_methphase_n50(block_relationships_df_30x_high_acc), get_methphase_n50(block_relationships_df_60x_high_acc), get_methphase_n50(block_relationships_df_LSK60x_high_acc), get_methphase_n50(block_relationships_df_LSK30x_high_acc), get_methphase_n50(block_relationships_df_80x_high_acc) or the code in the file [meth_phaser_post_processing] def get_n50(final_block_dict): chrom_n50 = {} for chrom in final_block_dict.keys(): block_len_list = [] for i in final_block_dict[chrom]: block_len_list.append(i[1] - i[0]) sum_block_len = 0 for i in sorted(block_len_list, reverse=False): sum_block_len += i if sum_block_len > sum(block_len_list) / 2: chrom_n50.update({chrom: i}) break return chrom_n50 But it seems that this function has not been called.

Fu-Yilei commented 2 months ago

get_genome_n50

should be this one I guess. Forgot the details.

Humonex commented 2 months ago

Yes, I have seen the get_genome_n50 in the [post_processing_script.ipynb], do I need to fully run this .ipynb every time if want to get the Methphaser N50?

Fu-Yilei commented 2 months ago

Not really. I think it takes the middle csv files as input.

Humonex commented 2 months ago

Thank you, I know this, I think it would be more convenient for people to use the software and promote the popularity of Methphaser N50 if the get_genome_n50 could be added to [methphasing] or have a command to call the function.