Previous changeset 0:7f827a8e4ec5 (2018-10-26) |
Commit message:
planemo upload for repository https://github.com/bardin-lab/damid_galaxy_tools commit c753dd4f3e1863aae7ba45dcc7efdf6937b03542-dirty |
modified:
consecutive_peaks.py test-data/grouped.bed |
b |
diff -r 7f827a8e4ec5 -r f3ca59e53b73 consecutive_peaks.py --- a/consecutive_peaks.py Fri Oct 26 11:58:06 2018 -0400 +++ b/consecutive_peaks.py Mon Oct 29 06:49:17 2018 -0400 |
[ |
@@ -19,11 +19,11 @@ grouped = df.groupby(groupby_column, sort=False) if add_number_of_peaks: df[PEAKS_PER_GROUP] = grouped[groupby_column].transform(np.size) - df[SHIFTED_PADJ_COLUMN] = grouped[8].shift() + df[SHIFTED_PADJ_COLUMN] = grouped[padj_column].shift() df[CONSECUTIVE_MAX] = df[[padj_column, SHIFTED_PADJ_COLUMN]].max(axis=1) grouped = df.groupby(groupby_column, sort=False) - idx = grouped[CONSECUTIVE_MAX].transform(min) # index of groupwise consecutive minimum - new_df = df[df[CONSECUTIVE_MAX] == idx] + idx = grouped[CONSECUTIVE_MAX].idxmin() # index of groupwise consecutive minimum + new_df = df.loc[idx] new_df.sort_values(by=CONSECUTIVE_MAX) new_df[padj_column].replace(new_df[CONSECUTIVE_MAX]) new_df = new_df.drop(labels=[CONSECUTIVE_MAX, SHIFTED_PADJ_COLUMN], axis=1) |
b |
diff -r 7f827a8e4ec5 -r f3ca59e53b73 test-data/grouped.bed --- a/test-data/grouped.bed Fri Oct 26 11:58:06 2018 -0400 +++ b/test-data/grouped.bed Mon Oct 29 06:49:17 2018 -0400 |
b |
@@ -1,9 +1,7 @@ +39 2L 65671 65675 49.717233352585495 1.78672093221744 0.65335924547836 2.73466847616013 0.006244313130270829 0.0293462152487687 . 6 3 2L 7691 7695 11.843536367488001 0.151639310614245 0.802284946799774 0.18900929304372102 0.8500855332762621 0.9110416695899171 "gene_id ""FBgn0031208""; gene_symbol ""CG11023"";" 2 22 2L 16173 16177 57.966776255547295 1.83956446735437 0.5875566682056651 3.1308715684773 0.0017428836310417 0.0114466453224446 "gene_id ""FBgn0002121""; gene_symbol ""l(2)gl"";" 21 -23 2L 16954 16958 104.269971829585 2.00754698293392 0.578809459512681 3.46840734880895 0.0005235530249270281 0.0046887086279990605 "gene_id ""FBgn0002121""; gene_symbol ""l(2)gl"";" 21 27 2L 22094 22098 156.619353330383 1.30715333943466 0.521853623943724 2.50482755979792 0.0122511106265175 0.0482672435893478 "gene_id ""FBgn0031209""; gene_symbol ""Ir21a"";gene_id ""FBgn0263584""; gene_symbol ""CR43609"";" 4 31 2L 24357 24361 56.181376195022104 0.41561332875758095 0.5959634297847359 0.6973805907985021 0.48556464487102 0.6406936968052429 "gene_id ""FBgn0031209""; gene_symbol ""Ir21a"";" 2 -32 2L 25083 25087 47.4292294853296 0.713596808954638 0.648352348117706 1.1006311784423202 0.27105721016165 0.4344207343049721 "gene_id ""FBgn0031209""; gene_symbol ""Ir21a"";" 2 +37 2L 65315 65319 137.10185797165198 1.23449113928199 0.524990063103154 2.3514562008756097 0.0187000910325455 0.065785553432607 "gene_id ""FBgn0051973""; gene_symbol ""Cda5"";" 4 36 2L 55633 55637 7.6690308960147595 0.10176038755412299 0.9304591967365029 0.109365771127888 0.9129123815446079 0.949924793245379 "gene_id ""FBgn0051973""; gene_symbol ""Cda5"";gene_id ""FBgn0267987""; gene_symbol ""CR46254"";" 1 -37 2L 65315 65319 137.10185797165198 1.23449113928199 0.524990063103154 2.3514562008756097 0.0187000910325455 0.065785553432607 "gene_id ""FBgn0051973""; gene_symbol ""Cda5"";" 4 -39 2L 65671 65675 49.717233352585495 1.78672093221744 0.65335924547836 2.73466847616013 0.006244313130270829 0.0293462152487687 . 6 |