From f779366d0dc8c584a719d36329a5fbc11717a7ca Mon Sep 17 00:00:00 2001 From: e-sollier Date: Wed, 21 Aug 2024 08:39:47 +0200 Subject: [PATCH] Add min height for sv track --- docs/content/describe_figure.rst | 3 +++ figeno/cli/cli.py | 2 +- figeno/gui/package.json | 2 +- figeno/gui/src/Track.jsx | 9 +++++++++ figeno/gui/src/TracksContainer.jsx | 3 ++- figeno/track_sv.py | 8 +++++--- pyproject.toml | 2 +- 7 files changed, 22 insertions(+), 7 deletions(-) diff --git a/docs/content/describe_figure.rst b/docs/content/describe_figure.rst index c188e14..3dace9b 100644 --- a/docs/content/describe_figure.rst +++ b/docs/content/describe_figure.rst @@ -373,6 +373,9 @@ Parameters: * ``color_del``, ``color_dup``, ``color_T2T``, ``color_H2H``, ``color_trans``: color of the arc representing the SV, depending on the SV type (respectively: deletion, duplication, tail-to-tail inversion, head-to-head inversion, translocation). +* ``min_sv_height``: when a circular layout is used, minimum height of the SVs, between 0 and 1 (default: 0.1). Increasing this value will result in short SVs (where both breakends are close) to have a larger height. + + copynumber ^^^^^^^^^^ diff --git a/figeno/cli/cli.py b/figeno/cli/cli.py index 8bfb8e0..20b558c 100644 --- a/figeno/cli/cli.py +++ b/figeno/cli/cli.py @@ -2,7 +2,7 @@ from figeno.cli import gui, init,make -__version__ = "1.4.5" +__version__ = "1.4.6" def main(): parser = ArgumentParser("figeno",formatter_class=ArgumentDefaultsHelpFormatter) diff --git a/figeno/gui/package.json b/figeno/gui/package.json index 6558fa0..c324e22 100644 --- a/figeno/gui/package.json +++ b/figeno/gui/package.json @@ -1,6 +1,6 @@ { "name": "figeno", - "version": "1.4.5", + "version": "1.4.6", "private": true, "homepage": "./", "dependencies": { diff --git a/figeno/gui/src/Track.jsx b/figeno/gui/src/Track.jsx index f8c7c1c..688eee6 100644 --- a/figeno/gui/src/Track.jsx +++ b/figeno/gui/src/Track.jsx @@ -652,6 +652,15 @@ function SvTrack({track,set_value,openColorPanel, setFileDialogData,setFileDialo + +
+ +
+ + set_value("min_sv_height",e.target.value)} > +
+ +
diff --git a/figeno/gui/src/TracksContainer.jsx b/figeno/gui/src/TracksContainer.jsx index c15778a..c4c6510 100644 --- a/figeno/gui/src/TracksContainer.jsx +++ b/figeno/gui/src/TracksContainer.jsx @@ -155,7 +155,8 @@ export const defaultTrackValues={ color_dup:"#e55039", color_t2t:"#8e44ad", color_h2h:"#8e44ad", - color_trans:"#27ae60" + color_trans:"#27ae60", + min_sv_height:0.1 }, "copynumber":{ height:"30", diff --git a/figeno/track_sv.py b/figeno/track_sv.py index 8df39e0..92e3a87 100644 --- a/figeno/track_sv.py +++ b/figeno/track_sv.py @@ -10,7 +10,7 @@ class sv_track: def __init__(self,file=None,df_SVs=None,sv_across_regions=True,upside_down=False,label="BP",label_rotate=True, - color_del="#4a69bd",color_dup="#e55039",color_h2h="#8e44ad",color_t2t="#8e44ad",color_trans="#27ae60",lw=0.6, + color_del="#4a69bd",color_dup="#e55039",color_h2h="#8e44ad",color_t2t="#8e44ad",color_trans="#27ae60",lw=0.6,min_sv_height=0.1, fontscale=1,bounding_box=True,height=10,margin_above=1.5,**kwargs): self.file=file self.df_SVs = df_SVs # Can directly provide a dataframe of SVs instead of providing a file (for use with python API). @@ -24,7 +24,9 @@ def __init__(self,file=None,df_SVs=None,sv_across_regions=True,upside_down=False self.color_t2t=color_t2t self.color_trans=color_trans self.lw=float(lw) - + self.min_sv_height=float(min_sv_height) + if self.min_sv_height>1: self.min_sv_height=1.0 + if self.min_sv_height<0: self.min_sv_height=0.0 self.fontscale=float(fontscale) self.bounding_box=bounding_box self.height = float(height) @@ -131,7 +133,7 @@ def draw_circle(self, regions, box ,hmargin): y = box["top"] if self.upside_down else box["bottom"] - 0.2 control_theta = (x1+x2)/2 control_r = 0 - if i==j: control_r = y * max(0,0.9-abs(df_SV_regions.loc[a,"pos1"]-df_SV_regions.loc[a,"pos2"]) / 400000000) + if i==j: control_r = y * max(0,(1.0-self.min_sv_height)-abs(df_SV_regions.loc[a,"pos1"]-df_SV_regions.loc[a,"pos2"]) / 400000000) pp1 = patches.PathPatch(mpath.Path([(x1, y), (control_theta, control_r), (x2, y)],[Path.MOVETO, Path.CURVE3, Path.CURVE3]),facecolor="none",edgecolor=df_SV_regions.loc[a,"color"]) boxes[0]["ax"].add_patch(pp1) diff --git a/pyproject.toml b/pyproject.toml index 7f57d4c..298f9c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = ["figeno", "figeno.data", "figeno.cli", "figeno.gui"] [project] name = 'figeno' -version = "1.4.5" +version = "1.4.6" description = 'Package for generating genomics figures.' readme = 'README.md' authors = [