Skip to content

Commit

Permalink
Fix genes for copynumber track and improve support for mcool files
Browse files Browse the repository at this point in the history
  • Loading branch information
e-sollier committed Jun 27, 2024
1 parent d0cd349 commit 41f7dcb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion figeno/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from figeno.cli import gui, init,make

__version__ = "1.4.0"
__version__ = "1.4.1"

def main():
parser = ArgumentParser("figeno",formatter_class=ArgumentDefaultsHelpFormatter)
Expand Down
1 change: 1 addition & 0 deletions figeno/figeno.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ def draw_symmetrical(self,file,width=183,dpi=150,transparent=False,warnings=[]):
self.update_total_width(width)
self.update_regions_width_symmetrical()
self.update_margins()
if len(self.regions)==1: warnings.append("The symmetrical layout is intended for displaying more than one region.")

#for i in range(0,len(self.tracks_list)-1):
# if isinstance(self.tracks_list[i],sv_track) and isinstance(self.tracks_list[i+1],copynumber_track):
Expand Down
2 changes: 1 addition & 1 deletion figeno/gui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "figeno",
"version": "1.4.0",
"version": "1.4.1",
"private": true,
"homepage": "./",
"dependencies": {
Expand Down
1 change: 0 additions & 1 deletion figeno/track_copynumber.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def __init__(self,input_type=None,freec_ratios=None,freec_CNAs=None,CNAs=None,pu
self.color_gain=color_gain
self.color_cnloh=color_cnloh
self.genes = genes
if "," in self.genes: self.genes = self.genes.split(",")
self.reference=reference
self.genes_file=genes_file
self.chr_lengths=chr_lengths
Expand Down
9 changes: 9 additions & 0 deletions figeno/track_hic.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import cooler
import h5py
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
Expand Down Expand Up @@ -54,6 +55,14 @@ def draw(self, regions, box ,hmargin,warnings=[]):
if self.file=="" or self.file is None:
raise KnownException("Please provide a file for the hic track. This file must be in .cool format.")
try:
if self.file.endswith(".mcool"):
f=h5py.File(self.file,'r')
resolutions=list(f["resolutions"].keys())
selected_resolution=resolutions[0]
warnings.append("You used a .mcool file without specifying the resolution ("+self.file+"), so the resolution was automatically set to "+str(selected_resolution)+". This .mcool file contains the following resolutions: "+\
", ".join([str(x) for x in resolutions])+". You can select the resolution by adding ::resolutions//"+str(selected_resolution)+" to the filename.")
self.file+="::resolutions//"+str(selected_resolution)

c=cooler.Cooler(self.file)
except:
raise KnownException("Failed to open file for the hic track: "+self.file+".\nThis file must be in .cool format.\nIf you have data in .hic format,"\
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ packages = ["figeno", "figeno.data", "figeno.cli", "figeno.gui"]

[project]
name = 'figeno'
version = "1.4.0"
version = "1.4.1"
description = 'Package for generating genomics figures.'
readme = 'README.md'
authors = [
Expand Down

0 comments on commit 41f7dcb

Please sign in to comment.