diff --git a/docs/content/describe_figure.rst b/docs/content/describe_figure.rst
index baaef9d..c188e14 100644
--- a/docs/content/describe_figure.rst
+++ b/docs/content/describe_figure.rst
@@ -151,12 +151,18 @@ Parameters:
* ``scale``: how the maximum value for the y-axis is chosen
* ``auto`` (default): will select as maximum the maximum across all regions.
+
+ * ``group auto`` (default): will select as maximum the maximum across all regions, for all tracks in the same group (defined by the group parameter, see below).
* ``auto per region``: will select as maximum the maximum of each region (so a different scale is used for each region)
+
+ * ``group auto per region``: will select as maximum the maximum of each region (so a different scale is used for each region), for all tracks in the same group (defined by the group parameter, see below).
* ``custom``: manually specify the maximum value. Can either specify a single value, which will then be used for all regions, or a comma-separated list of values (one per region)
* ``scale_max``: in case "scale" is "custom", indicate the maximum value for the y-axis.
+
+* ``group``: if "scale" is "group auto" or "group auto per region", all tracks with the same value for this parameter will be scaled together.
* ``scale_pos``: where the scale (min and max value of the y-axis) will be displayed
@@ -218,12 +224,18 @@ Parameters:
* ``scale``: how the maximum value for the y-axis is chosen
* ``auto`` (default): will select as maximum the maximum across all regions.
+
+ * ``group auto`` (default): will select as maximum the maximum across all regions, for all tracks in the same group (defined by the group parameter, see below).
* ``auto per region``: will select as maximum the maximum of each region (so a different scale is used for each region)
+
+ * ``group auto per region``: will select as maximum the maximum of each region (so a different scale is used for each region), for all tracks in the same group (defined by the group parameter, see below).
* ``custom``: manually specify the maximum value. Can either specify a single value, which will then be used for all regions, or a comma-separated list of values (one per region)
-
+
* ``scale_max``: in case "scale" is "custom", indicate the maximum value for the y-axis.
+
+* ``group``: if "scale" is "group auto" or "group auto per region", all tracks with the same value for this parameter will be scaled together.
* ``scale_pos``: where the scale (min and max value of the y-axis) will be displayed
diff --git a/figeno/cli/cli.py b/figeno/cli/cli.py
index e072d35..eacf2e7 100644
--- a/figeno/cli/cli.py
+++ b/figeno/cli/cli.py
@@ -2,7 +2,7 @@
from figeno.cli import gui, init,make
-__version__ = "1.3.3"
+__version__ = "1.4.0"
def main():
parser = ArgumentParser("figeno",formatter_class=ArgumentDefaultsHelpFormatter)
diff --git a/figeno/figeno.py b/figeno/figeno.py
index 2a5de0b..d2b3630 100644
--- a/figeno/figeno.py
+++ b/figeno/figeno.py
@@ -316,6 +316,9 @@ def draw(self,output_config=None,warnings=[]):
if max_size>100*min_size:
warnings.append("You used regions with very different sizes, so the smaller regions may not be visible.")
+ # Check if group autoscale was used, in which case compute them.
+ self.compute_scales()
+
if self.figure_layout=="horizontal":
self.draw_horizontal(**self.output,warnings=warnings)
elif self.figure_layout=="stacked":
@@ -507,6 +510,55 @@ def draw_circular(self,file,width=183,dpi=150,transparent=False,warnings=[]):
plt.clf()
plt.close('all')
+ def compute_scales(self):
+ self.compute_scales_instance(bigwig_track,"bigwig")
+ self.compute_scales_instance(coverage_track,"coverage")
+
+ def compute_scales_instance(self,instance=bigwig_track,instance_name="bigwig"):
+ group2scales={}
+ group2scaletype={}
+ for t in self.tracks_list:
+ if isinstance(t,instance):
+ if t.scale=="custom":
+ if t.scale_max=="": t.scale_max=None
+ if t.scale_max is None: raise KnownException("Please provide the scale_max parameter if you use a custom scale.")
+ if isinstance(t.scale_max,str) and "," in t.scale_max:
+ try:t.scale_max=[float(x) for x in t.scale_max.split(",")]
+ except: raise KnownException("The scale_max parameter in a "+instance_name+" track should be a number (or a list of numbers separated by commas): "+str(self.scale_max))
+ else:
+ try: t.scale_max=[float(t.scale_max)]
+ except: raise KnownException("The scale_max parameter in a "+instance_name+" track should be a number: "+str(self.scale_max))
+ elif t.scale=="auto":
+ t.scale_max=t.compute_max(self.regions,per_region=False)
+ elif t.scale=="group auto":
+ if not hasattr(t,"group"): raise KnownException("Please provide the group parameter, if you use the group auto scale.")
+ maximum=t.compute_max(self.regions,per_region=False)
+ if t.group in group2scaletype:
+ if group2scaletype[t.group]!="group auto": raise KnownException("Please use the same scale (group auto or group auto per region) for all bigwig tracks of the same group.")
+ else: group2scaletype[t.group]="group auto"
+ if t.group in group2scales: group2scales[t.group] = max(maximum,group2scales[t.group])
+ else: group2scales[t.group] = maximum
+ elif t.scale=="auto per region":
+ t.scale_max= t.compute_max(self.regions,per_region=True)
+ elif t.scale=="group auto per region":
+ if not hasattr(t,"group"): raise KnownException("Please provide the group parameter, if you use the group auto per region scale.")
+ if t.group in group2scaletype:
+ if group2scaletype[t.group]!="group auto per region": raise KnownException("Please use the same scale (group auto or group auto per region) for all bigwig tracks of the same group.")
+ else: group2scaletype[t.group]="group auto per region"
+ maxima=t.compute_max(self.regions,per_region=True)
+ if t.group in group2scales: group2scales[t.group] = [max(group2scales[t.group][i],maxima[i]) for i in range(len(maxima))]
+ else: group2scales[t.group] = maxima
+ else:
+ raise KnownException("Invalid scale for "+instance_name+" track: "+str(t.scale)+". Must be auto, auto per region, group auto, group auto per region, or custom.")
+
+ for t in self.tracks_list:
+ if isinstance(t,instance):
+ if t.scale=="group auto" or t.scale=="group auto per region":
+ t.scale_max=group2scales[t.group]
+ if len(t.scale_max)>1 and t.scale_pos!="none": t.scale_pos="corner all"
+
+
+
def figeno_make(config=None,config_file=None,warnings=[]):
if config is None and config_file is None: raise Exception("ERROR: a config or a config_file is required for figeno_make.")
tp = tracks_plot(config=config,config_file=config_file)
diff --git a/figeno/gui/package.json b/figeno/gui/package.json
index 55857ea..6cb0221 100644
--- a/figeno/gui/package.json
+++ b/figeno/gui/package.json
@@ -1,6 +1,6 @@
{
"name": "figeno",
- "version": "1.3.3",
+ "version": "1.4.0",
"private": true,
"homepage": "./",
"dependencies": {
diff --git a/figeno/gui/src/App.js b/figeno/gui/src/App.js
index ea847f9..585715d 100644
--- a/figeno/gui/src/App.js
+++ b/figeno/gui/src/App.js
@@ -158,12 +158,15 @@ export default function App() {
t.bedmethyls = t.bedmethyls.map((b)=>{const newBed={...b};delete newBed.id; return newBed;})
}
else if (t.type=="bigwig" || t.type=="coverage"){
- if (t.scale=="auto"){
+ if (t.scale!="custom"){
delete t.scale_max;
}
+ if (t.scale!="group auto" && t.scale!="group auto per region"){
+ delete t.group;
+ }
}
else if (t.type=="hic"){
- if (t.scale=="auto"){
+ if (t.scale!="auto"){
delete t.scale_min;
delete t.scale_max;
}
diff --git a/figeno/gui/src/Track.jsx b/figeno/gui/src/Track.jsx
index 1fe6af4..f8c7c1c 100644
--- a/figeno/gui/src/Track.jsx
+++ b/figeno/gui/src/Track.jsx
@@ -244,7 +244,9 @@ function BigWigTrack({track,set_value,openColorPanel, setFileDialogData,setFileD
@@ -254,6 +256,13 @@ function BigWigTrack({track,set_value,openColorPanel, setFileDialogData,setFileD
set_value("scale_max",e.target.value)} >
):""
}
+ {(track.scale=="group auto" || track.scale=="group auto per region")?(
+
+
+ set_value("group",e.target.value)} >
+
):""
+ }
+
@@ -304,6 +315,12 @@ function CoverageTrack({track,set_value,openColorPanel, setFileDialogData,setFil
set_value("scale_max",e.target.value)} >
):""
}
+ {(track.scale=="group auto" || track.scale=="group auto per region")?(
+
+
+ set_value("group",e.target.value)} >
+
):""
+ }
{set_value("scale_pos",e.target.value)}}>
diff --git a/figeno/gui/src/TracksContainer.jsx b/figeno/gui/src/TracksContainer.jsx
index b22048b..c15778a 100644
--- a/figeno/gui/src/TracksContainer.jsx
+++ b/figeno/gui/src/TracksContainer.jsx
@@ -57,6 +57,7 @@ export const defaultTrackValues={
n_bins:500,
scale:"auto",
scale_max:"",
+ group:"1",
scale_pos:"corner",
upside_down:false
},
@@ -72,6 +73,7 @@ export const defaultTrackValues={
n_bins:500,
scale:"auto",
scale_max:"",
+ group:"1",
scale_pos:"corner",
upside_down:false
},
diff --git a/figeno/track_bigwig.py b/figeno/track_bigwig.py
index 0eb41b1..737e472 100644
--- a/figeno/track_bigwig.py
+++ b/figeno/track_bigwig.py
@@ -7,7 +7,7 @@
from figeno.utils import KnownException, correct_region_chr, split_box,draw_bounding_box, interpolate_polar_vertices, polar2cartesian, cartesian2polar
class bigwig_track:
- def __init__(self,file,n_bins=500,scale="auto",scale_max=None,scale_pos="corner",color="gray",upside_down=False,label="",label_rotate=False,fontscale=1,
+ def __init__(self,file,n_bins=500,scale="auto",scale_max=None,scale_pos="corner",color="gray",upside_down=False,group=None,label="",label_rotate=False,fontscale=1,
bounding_box=False,height=10,margin_above=1.5,**kwargs):
if file=="" or file is None: raise KnownException("Please provide a file for the bigwig track.")
if (not file.startswith("http")) and not os.path.exists(file): raise KnownException("The following file does not exist (in bigwig track): "+file)
@@ -24,10 +24,9 @@ def __init__(self,file,n_bins=500,scale="auto",scale_max=None,scale_pos="corner"
self.label_rotate=label_rotate
self.scale = scale
self.scale_max= scale_max
+ self.group=group
self.upside_down=upside_down
- if self.scale_max is not None: self.scale_max=float(self.scale_max)
self.scale_pos = scale_pos
- if scale=="auto per region": self.scale_pos = "corner all" # If each region has its own scale, we cannot use one global label for the whole track
self.fontscale=float(fontscale)
self.bounding_box=bounding_box
self.height = float(height)
@@ -36,22 +35,24 @@ def __init__(self,file,n_bins=500,scale="auto",scale_max=None,scale_pos="corner"
def draw(self, regions, box ,hmargin,warnings=[]):
# Assign bins to regions depending on their sizes
- total_length_regions = np.sum([abs(reg[0].end-reg[0].start) for reg in regions])
- bins_regions = [max(1,int(self.n_bins/total_length_regions * abs(reg[0].end-reg[0].start))) for reg in regions]
+ bins_regions = self.compute_bins(regions)
# Autoscale across all regions
- if self.scale=="auto": self.scale_max = self.compute_max_regions(regions,bins_regions)
+ #if self.scale=="auto": self.scale_max = self.compute_max_regions(regions,bins_regions)
- if self.scale=="custom" and isinstance(self.scale_max,str) and "," in self.scale_max:
- scale_max_regions = [float(x) for x in self.scale_max.split(",")]
- else:
- scale_max_regions=None
+ #if self.scale=="custom" and isinstance(self.scale_max,str) and "," in self.scale_max:
+ # scale_max_regions = [float(x) for x in self.scale_max.split(",")]
+ #else:
+ # scale_max_regions=None
boxes = split_box(box,regions,hmargin)
for i in range(len(regions)):
show_scale_inside = self.scale_pos=="corner all" or (self.scale_pos=="corner" and i==0)
- if scale_max_regions is not None:
- self.scale_max = scale_max_regions[i]
- self.draw_region(regions[i][0],boxes[i],nbins=bins_regions[i],show_scale_inside=show_scale_inside)
+ if i1: warnings.append("You provided only "+str(len(self.scale_max))+" values for scale_max, even though "+str(len(regions))+" were used. "\
+ "The first scale_max parameter will be used for all regions for which no scale_max value was provided.")
+ self.draw_region(regions[i][0],boxes[i],scale_max=scale_max_region,nbins=bins_regions[i],show_scale_inside=show_scale_inside)
self.draw_title(box)
for x in self.kwargs:
@@ -59,7 +60,7 @@ def draw(self, regions, box ,hmargin,warnings=[]):
- def draw_region(self,region,box,nbins,show_scale_inside):
+ def draw_region(self,region,box,scale_max,nbins,show_scale_inside):
if self.bounding_box: draw_bounding_box(box)
region = correct_region_chr(region,self.bw.chroms())
@@ -70,9 +71,8 @@ def draw_region(self,region,box,nbins,show_scale_inside):
rect_width = (box["right"] - box["left"]) / nbins
- if self.scale=="auto per region": self.scale_max = np.max(values_binned) * 1.1
- if self.scale_max<=0: self.scale_max=0.001
- values_binned = [max(min(self.scale_max,x),0) for x in values_binned]
+ if scale_max<=0: scale_max=0.001
+ values_binned = [max(min(scale_max,x),0) for x in values_binned]
if not self.upside_down:
polygon_vertices=[(box["right"],box["bottom"]) , (box["left"],box["bottom"])]
@@ -81,9 +81,9 @@ def draw_region(self,region,box,nbins,show_scale_inside):
for i in range(nbins):
x=box["left"] + i*n_bases_per_bin/(region.end-region.start) * (box["right"] - box["left"])
if not self.upside_down:
- y= box["bottom"] + values_binned[i]/self.scale_max * (box["top"]-box["bottom"])
+ y= box["bottom"] + values_binned[i]/scale_max * (box["top"]-box["bottom"])
else:
- y= box["top"] - values_binned[i]/self.scale_max * (box["top"]-box["bottom"])
+ y= box["top"] - values_binned[i]/scale_max * (box["top"]-box["bottom"])
polygon_vertices.append((x,y))
if "projection" in box and box["projection"]=="polar":
polygon_vertices = interpolate_polar_vertices(polygon_vertices)
@@ -92,7 +92,7 @@ def draw_region(self,region,box,nbins,show_scale_inside):
if show_scale_inside and ((not "projection" in box) or box["projection"]!="polar"):
- upperlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ upperlimit_string = "{:.1f}".format(scale_max) if scale_max>=1 else "{:.2f}".format(scale_max)
lowerlimit_string = "0"
label="["+lowerlimit_string+"-"+upperlimit_string+"]"
box["ax"].text(box["left"]+0.05,box["top"]-0.02,label,horizontalalignment="left",verticalalignment="top",fontsize=6*self.fontscale)
@@ -109,10 +109,10 @@ def draw_title(self,box):
self.label,rotation=rotation,horizontalalignment="right",verticalalignment="center",fontsize=10*self.fontscale)
if self.scale_pos=="left":
if not self.upside_down:
- upperlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ upperlimit_string = "{:.1f}".format(self.scale_max[0]) if self.scale_max[0]>=1 else "{:.2f}".format(self.scale_max[0])
lowerlimit_string = "0"
else:
- lowerlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ lowerlimit_string = "{:.1f}".format(self.scale_max[0]) if self.scale_max[0]>=1 else "{:.2f}".format(self.scale_max[0])
upperlimit_string = "0"
x,y= polar2cartesian((box["left"],box["top"]))
theta,r = cartesian2polar((x-0.2,y))
@@ -130,7 +130,7 @@ def draw_title(self,box):
box["ax"].text(box["left"] - 1.0,(box["top"]+box["bottom"])/2,
self.label,rotation=rotation,horizontalalignment="right",verticalalignment="center",fontsize=7*self.fontscale)
if self.scale_pos=="left":
- upperlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ upperlimit_string = "{:.1f}".format(self.scale_max[0]) if self.scale_max[0]>=1 else "{:.2f}".format(self.scale_max[0])
lowerlimit_string = "0"
if not self.upside_down:
box["ax"].text(box["left"] - 0.5,box["top"],
@@ -143,14 +143,24 @@ def draw_title(self,box):
box["ax"].text(box["left"] - 0.5,box["bottom"],
upperlimit_string,horizontalalignment="right",verticalalignment="bottom",fontsize=6*self.fontscale)
- def compute_max_regions(self,regions,bins):
+
+ def compute_bins(self,regions):
+ total_length_regions = np.sum([abs(reg[0].end-reg[0].start) for reg in regions])
+ return [max(1,int(self.n_bins/total_length_regions * abs(reg[0].end-reg[0].start))) for reg in regions]
+
+ def compute_max(self,regions,per_region=False):
+ bins = self.compute_bins(regions)
+ l=[]
m=0
for i in range(len(regions)):
+ if per_region: m=0
reg = regions[i][0]
region = correct_region_chr(reg,self.bw.chroms())
if region.end>self.bw.chroms()[region.chr]:
raise KnownException("The region "+region.chr+":"+str(region.start)+"-"+str(region.end)+" has coordinates greater than the chromosome length ("+str(self.bw.chroms()[region.chr])+") in the bigwig file "+self.filename)
values_binned=self.bw.stats(region.chr,region.start,region.end,nBins=bins[i],exact=True,type="mean")
values_binned = [x if x is not None else 0 for x in values_binned]
- m=max(m,np.max(values_binned)*1.1)
- return m
\ No newline at end of file
+ m = max(m,np.max(values_binned)*1.1)
+ if per_region: l.append(m)
+ if not per_region: l.append(m)
+ return l
\ No newline at end of file
diff --git a/figeno/track_coverage.py b/figeno/track_coverage.py
index 284c6d8..c96d908 100644
--- a/figeno/track_coverage.py
+++ b/figeno/track_coverage.py
@@ -8,7 +8,7 @@
from figeno.utils import KnownException, correct_region_chr, split_box, draw_bounding_box
class coverage_track:
- def __init__(self,file,n_bins=500,color="gray",scale="auto",scale_max=None,scale_pos="corner",upside_down=False,label="",label_rotate=False,fontscale=1,
+ def __init__(self,file,n_bins=500,color="gray",scale="auto",scale_max=None,scale_pos="corner",group=None,upside_down=False,label="",label_rotate=False,fontscale=1,
vcf=None,SNP_colors="auto",exchange_haplotypes=False,bounding_box=False,height=10,margin_above=1.5,**kwargs):
if file=="" or file is None:
raise KnownException("Please provide a bam file for the coverage track.")
@@ -28,9 +28,8 @@ def __init__(self,file,n_bins=500,color="gray",scale="auto",scale_max=None,scale
self.fontscale=float(fontscale)
self.scale = scale
self.scale_max = scale_max
- if self.scale_max is not None: self.scale_max=float(self.scale_max)
+ self.group=group
self.scale_pos = scale_pos
- if scale=="auto per region": self.scale_pos = "corner all" # If each region has its own scale, we cannot use one global label for the whole track
self.upside_down= upside_down
self.vcf = vcf
self.SNP_colors=SNP_colors
@@ -44,11 +43,15 @@ def __init__(self,file,n_bins=500,color="gray",scale="auto",scale_max=None,scale
def draw(self, regions, box ,hmargin,warnings=[]):
- if self.scale=="auto": self.scale_max = self.compute_max_regions(regions)
boxes = split_box(box,regions,hmargin)
for i in range(len(regions)):
show_scale_inside = self.scale_pos=="corner all" or (self.scale_pos=="corner" and i==0)
- self.draw_region(regions[i][0],boxes[i],show_scale_inside=show_scale_inside)
+ if i1: warnings.append("You provided only "+str(len(self.scale_max))+" values for scale_max, even though "+str(len(regions))+" were used. "\
+ "The first scale_max parameter will be used for all regions for which no scale_max value was provided.")
+ self.draw_region(regions[i][0],boxes[i],scale_max=scale_max_region,show_scale_inside=show_scale_inside)
self.draw_title(box)
for x in self.kwargs:
@@ -56,7 +59,7 @@ def draw(self, regions, box ,hmargin,warnings=[]):
if not self.atleast_one_region_has_coverage: warnings.append("The coverage was null for all displayed regions in the bam file "+self.filename+".")
- def draw_region(self,region,box,show_scale_inside):
+ def draw_region(self,region,box,scale_max,show_scale_inside):
region = correct_region_chr(region,self.samfile.references)
if self.bounding_box: draw_bounding_box(box)
coverage=np.sum(self.samfile.count_coverage(region.chr,region.start,region.end),axis=0)
@@ -67,8 +70,6 @@ def draw_region(self,region,box,show_scale_inside):
max_coverage = np.max(coverage_bin) * 1.1
if max_coverage>=1: self.atleast_one_region_has_coverage=True
- if max_coverage<1 or max_coverage!=max_coverage: max_coverage=1
- if self.scale=="auto per region": self.scale_max=max_coverage
rect_width = (box["right"] - box["left"]) / len(coverage_bin)
@@ -81,9 +82,9 @@ def draw_region(self,region,box,show_scale_inside):
rect_left = box["left"] + i*rect_width
if region.orientation=="+":
- rect_height = coverage_bin[i]/self.scale_max * (box["top"]-box["bottom"])
+ rect_height = coverage_bin[i]/scale_max * (box["top"]-box["bottom"])
else:
- rect_height = coverage_bin[len(coverage_bin)-1-i]/self.scale_max * (box["top"]-box["bottom"])
+ rect_height = coverage_bin[len(coverage_bin)-1-i]/scale_max * (box["top"]-box["bottom"])
#rect = patches.Rectangle((rect_left,box["bottom"]),
# rect_width,rect_height,color=self.color,lw=0.2,zorder=1)
#box["ax"].add_patch(rect)
@@ -105,7 +106,7 @@ def draw_region(self,region,box,show_scale_inside):
box["ax"].add_patch(polygon)
if show_scale_inside:
- upperlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ upperlimit_string = "{:d}".format(int(scale_max))
lowerlimit_string = "0"
label="["+lowerlimit_string+"-"+upperlimit_string+"]"
box["ax"].text(box["left"]+0.05,box["top"]-0.02,label,horizontalalignment="left",verticalalignment="top",fontsize=6*self.fontscale)
@@ -119,21 +120,23 @@ def draw_title(self,box):
self.label,rotation=rotation,horizontalalignment="right",verticalalignment="center",fontsize=7*self.fontscale)
if self.scale_pos=="left":
if not self.upside_down:
- upperlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ upperlimit_string = "{:d}".format(int(self.scale_max[0]))
lowerlimit_string = "0"
else:
- lowerlimit_string = "{:.1f}".format(self.scale_max) if self.scale_max>=1 else "{:.2f}".format(self.scale_max)
+ lowerlimit_string = "{:d}".format(int(self.scale_max[0]))
upperlimit_string = "0"
box["ax"].text(box["left"] - 0.5,box["top"],
upperlimit_string,horizontalalignment="right",verticalalignment="top",fontsize=6*self.fontscale)
box["ax"].text(box["left"] - 0.5,box["bottom"],
lowerlimit_string,horizontalalignment="right",verticalalignment="bottom",fontsize=6*self.fontscale)
-
- def compute_max_regions(self,regions):
- max_cov=0
- for region in regions:
- reg = region[0]
+
+ def compute_max(self,regions,per_region=False):
+ l=[]
+ max_cov=1
+ for i in range(len(regions)):
+ if per_region: max_cov=1
+ reg = regions[i][0]
region = correct_region_chr(reg,self.samfile.references)
coverage=np.sum(self.samfile.count_coverage(region.chr,region.start,region.end),axis=0)
coverage=np.nan_to_num(coverage,nan=0)
@@ -145,11 +148,9 @@ def compute_max_regions(self,regions):
if new_value==new_value:coverage_bin.append(new_value)
coverage_bin+= []
max_cov=max(max_cov,np.max(coverage_bin) * 1.1)
- if max_cov<1 or max_cov!=max_cov: max_cov=1
- return round(max_cov)
-
-
-
-
+ if max_cov<1 or max_cov!=max_cov: max_cov=1
+ if per_region: l.append(round(max_cov))
+ if not per_region: l.append(round(max_cov))
+ return l
diff --git a/figeno/utils.py b/figeno/utils.py
index fe42044..ac966d0 100644
--- a/figeno/utils.py
+++ b/figeno/utils.py
@@ -22,6 +22,7 @@ def correct_region_chr(region,chromosomes,file=""):
error_message="Could not find chromosome "+region.chr
if file!="": error_message+=" in file "+file+"."
else: error_message+="."
+ error_message+=" Only the following chromosome names were found: "+", ".join(chromosomes)+" (the chr prefix can be omitted)."
raise KnownException(error_message)
def split_box(box,regions,hmargin):
diff --git a/pyproject.toml b/pyproject.toml
index febbb53..68fdfbb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ packages = ["figeno", "figeno.data", "figeno.cli", "figeno.gui"]
[project]
name = 'figeno'
-version = "1.3.3"
+version = "1.4.0"
description = 'Package for generating genomics figures.'
readme = 'README.md'
authors = [