Skip to content

Commit

Permalink
Introduce pandas sorting in CRISPRessoCompare (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snicker7 authored and mbowcut2 committed Mar 18, 2024
1 parent baf7561 commit e6b74ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CRISPResso2/CRISPRessoCompareCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ def get_plot_title_with_ref_name(plotTitle, refName):
merged[quant_cols] = merged[quant_cols].fillna(0)
lfc_error =0.1
merged['each_LFC'] = np.log2(((merged['%Reads_'+sample_1_name]+lfc_error)/(merged['%Reads_'+sample_2_name]+lfc_error)).astype(float)).replace([np.inf, np.NaN], 0)
merged = merged.reset_index().set_index('Aligned_Sequence')
merged = merged.sort_values(['%Reads_'+sample_1_name, 'Reference_Sequence', 'n_deleted', 'n_inserted', 'n_mutated'], ascending=False)
merged = merged.reset_index(drop=True).set_index('Aligned_Sequence')
output_root = allele_file_1_name.replace(".txt", "")
allele_comparison_file = _jp(output_root+'.txt')
merged.to_csv(allele_comparison_file, sep="\t", index=None)
Expand Down

0 comments on commit e6b74ce

Please sign in to comment.