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 kclem committed Mar 14, 2024
1 parent ebd14ba commit 0af8fe1
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 0af8fe1

Please sign in to comment.