Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ini format #132

Merged
merged 31 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c9b3a84
generating empty regions when the regions are not available on the gi…
Oct 29, 2019
2c28261
Merge branch 'develop' of https://github.com/deeptools/pyGenomeTracks…
Oct 31, 2019
ea0f227
removed a print from bedTrack.py
Oct 31, 2019
feafb35
Narrow peak (#123)
lldelisle Oct 31, 2019
4048bd6
solved issue with log (#125)
lldelisle Oct 31, 2019
7d24a1b
fixed the issue with data type in narrowPeaks
Oct 31, 2019
0fdbf55
put the warning for tbx
lldelisle Nov 1, 2019
5869983
changed the default of get_scores
lldelisle Nov 1, 2019
69bcdf9
deal with vlines not in the good chr
lldelisle Nov 1, 2019
2e72c2b
check the output of get_score is not empty before plotting
lldelisle Nov 1, 2019
40de299
added tests
lldelisle Nov 1, 2019
64a665a
linting
lldelisle Nov 1, 2019
b69df43
Merge pull request #128 from lldelisle/narrowPeak_debug_LD
bgruening Nov 1, 2019
9e74c5d
merged origin/narrowPeak_debug
Nov 4, 2019
713700d
replaced spaces by _
Nov 5, 2019
86c2c4d
many more changes from space to _
Nov 7, 2019
ebd5c3a
fix tests for the current changes
Nov 7, 2019
0d8d5e0
changed more tests to match the new new nameing format
Nov 7, 2019
df66a51
more changes in tests
Nov 8, 2019
4030f96
fixed hic tests
Nov 8, 2019
866794c
more fix on hic test
Nov 8, 2019
3659e66
fixed master_tracks.ini
Nov 15, 2019
8107c8f
changed master_plot.png
Nov 15, 2019
bb80616
fixed the changes in test_plot_tracks.py
Nov 18, 2019
30ad933
ran generateAllOutput for global changes
Nov 18, 2019
d8ac50e
updated narrow peak tests
Nov 18, 2019
def24a8
fixed the matplotlin version
Nov 25, 2019
39a47ce
test-hic-img
Nov 25, 2019
b123037
hopefully solved all travis incompatibilities between images
Nov 25, 2019
8e152b3
Merge branch 'develop' of https://github.com/deeptools/pyGenomeTracks…
Nov 25, 2019
0cf2bcb
fixed redefinition of functions caused by merging develop
Nov 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:
- conda-forge
dependencies:
- numpy >=1.16
- matplotlib >=3.0
- matplotlib =3.1.1
- intervaltree >=2.1.0
- pybigwig >=0.3.4
- future >=0.17.0
Expand Down
6 changes: 3 additions & 3 deletions pygenometracks/makeTracksFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def main(args=None):
args.out.write("""
[x-axis]
#optional
#fontsize=20
#fontsize = 20
# default is bottom meaning below the axis line
# where=top
# where = top

[spacer]
# height of space in cm (optional)
Expand All @@ -58,7 +58,7 @@ def main(args=None):
if file_h.name.endswith(ending):
default_values = track_class.OPTIONS_TXT
default_values = default_values.replace("title =", "title = {}".format(label))
args.out.write("\n[{label}]\nfile={file}\n{default_values}".
args.out.write("\n[{label}]\nfile = {file}\n{default_values}".
format(label=label, file=file_h.name, default_values=default_values))

sys.stdout.write("Adding {} file: {}\n".format(track_type, file_h.name))
Expand Down
12 changes: 6 additions & 6 deletions pygenometracks/plotTracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
min_value = 0
#max_value = auto
height = 1.5
number of bins = 500
nans to zeros = True
number_of_bins = 500
nans_to_zeros = True
# options are: line, points, fill. Default is fill
# to add the preferred line width or point size use:
# type = line:lw where lw (linewidth) is float
Expand Down Expand Up @@ -79,13 +79,13 @@
# to be printed over many rows. When several images want
# to be combined this must be set to get equal size
# genes in all images
#gene rows = 10
#gene_rows = 10
# by default the ymax is the number of
# rows occupied by the genes in the region plotted. However,
# by setting this option, the global maximum is used instead.
# This is useful to combine images that are all consistent and
# have the same number of rows.
#global max row = yes
#global_max_row = yes


[chrom states]
Expand Down Expand Up @@ -123,8 +123,8 @@
title = arcs
color = red
# orientation = inverted
# if line width is not given, the score is used to set the line width
#line width = 0.5
# if line_width is not given, the score is used to set the line width
#line_width = 0.5
file = arcs.txt

[vlines]
Expand Down
6 changes: 3 additions & 3 deletions pygenometracks/readGtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ def __next__(self):
return bed

def get_bed_interval(self):
r"""
Processes a transcript from the database,
retrieve all the values and returns
"""
Process a transcript from the database,
retrieve all the values and return
a namedtuple object
"""
tr = next(self.all_transcripts)
Expand Down
34 changes: 17 additions & 17 deletions pygenometracks/tests/test_bedGraphMatrixTrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
ROOT = os.path.dirname(os.path.abspath(__file__)) + "/test_data/"

tracks = """

[test bedgraph tabix]
file = bedgraph_chrx_2e6_5e6.bg.bgz
color = blue
height = 2
title = tabix color=blue; type=fill
title = tabix color = blue; type = fill
min_value = -5
type = fill

Expand All @@ -25,8 +24,8 @@
file = bedgraph_chrx_2e6_5e6_2.bg.bgz
color = brown
height = 2
title = tabix color=brown; type=line:0.5;nans to zeros=True; orientation=inverted
nans to zeros = True
title = tabix color = brown; type = line:0.5; nans_to_zeros = True; orientation = inverted
nans_to_zeros = True
min_value = -5
max_value = 50
type = line:0.5
Expand All @@ -39,7 +38,7 @@
file = bedgraph_chrx_2e6_5e6.bg
color = red
height = 2
title = color=red;type=points:0.5
title = color = red; type = points:0.5
min_value = 0
max_value = 50
type = points:0.5
Expand All @@ -50,8 +49,8 @@
file = bedgraph_chrx_2e6_5e6.bg
color = red
height = 2
title = color=red;type=points:0.5;summary method = max
summary method = max
title = color = red; type = points:0.5; summary_method = max
summary_method = max
min_value = 0
max_value = 50
type = points:0.5
Expand All @@ -62,9 +61,9 @@
file = bedgraph_chrx_2e6_5e6.bg
color = red
height = 2
title = color=red;type=points:0.5;summary method = max;nbins=3000
summary method = max
number of bins = 3000
title = color = red; type = points:0.5; summary_method = max; nbins = 3000
summary_method = max
number_of_bins = 3000
min_value = 0
max_value = 50
type = points:0.5
Expand All @@ -81,31 +80,32 @@

[test bedgraph matrix lines]
file = tad_separation_score.bm.gz
title = type=lines
title = type = lines
height = 5
file_type = bedgraph_matrix
type = lines
pos score in bin = block
pos_score_in_bin = block

[spacer]
width = 0.01

[test bedgraph matrix lines]
file = tad_separation_score_with_gap.bm.bgz
title = type=lines; show data range=no (file type is tabix with a gap)
title = type = lines; show_data_range = no (file type is tabix with a gap)
height = 5
file_type = bedgraph_matrix
type = lines
pos score in bin = center
show data range = no
pos_score_in_bin = center
show_data_range = no

[test bedgraph matrix lines tabix]
file = tad_separation_score.bm.gz
title = type=lines;plot horizontal lines=yes
title = type = lines; plot_horizontal_lines = yes
height = 6
file_type = bedgraph_matrix
type = lines
plot horizontal lines=yes
plot_horizontal_lines = yes

[spacer]

[x-axis]
Expand Down
12 changes: 7 additions & 5 deletions pygenometracks/tests/test_bedGraphTrack.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
height = 5
title = bedgraph with use middle = yes
max_value = 10
use middle = yes
use_middle = yes

[genes]
file = HoxD_cluster_regulatory_regions_mm10.bed
Expand All @@ -54,8 +54,9 @@
def test_plot_bedgraph_tracks():

outfile = NamedTemporaryFile(suffix='.png', prefix='pyGenomeTracks_test_', delete=False)
args = "--tracks {0}/bedgraph_useMid.ini --region chr2:73,800,000-75,744,000 --trackLabelFraction 0.2 --width 38 " \
"--dpi 130 --outFileName {1}".format(ROOT, outfile.name).split()
args = "--tracks {0}/bedgraph_useMid.ini --region chr2:73,800,000-75,744,000 "\
"--trackLabelFraction 0.2 --width 38 --dpi 130 " \
"--outFileName {1}".format(ROOT, outfile.name).split()
pygenometracks.plotTracks.main(args)
print("saving test to {}".format(outfile.name))
res = compare_images(ROOT + '/master_bedgraph_useMid.png', outfile.name, tolerance)
Expand All @@ -67,8 +68,9 @@ def test_plot_bedgraph_tracks():
def test_plot_bedgraph_tracks_rasterize():

outfile = NamedTemporaryFile(suffix='.pdf', prefix='pyGenomeTracks_test_', delete=False)
args = "--tracks {0}/bedgraph_useMid.ini --region chr2:73,800,000-75,744,000 --trackLabelFraction 0.2 --width 38 " \
"--dpi 130 --outFileName {1}".format(ROOT, outfile.name).split()
args = "--tracks {0}/bedgraph_useMid.ini --region chr2:73,800,000-75,744,000 "\
"--trackLabelFraction 0.2 --width 38 --dpi 130 " \
"--outFileName {1}".format(ROOT, outfile.name).split()
pygenometracks.plotTracks.main(args)
print("saving test to {}".format(outfile.name))
res = compare_images(ROOT + '/master_bedgraph_useMid.pdf', outfile.name, tolerance)
Expand Down
58 changes: 31 additions & 27 deletions pygenometracks/tests/test_bed_and_gtf_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
browser_tracks = """
[x-axis]
where = top
title = where=top
title = where =top

[spacer]
height = 0.05

[genes 2]
file = dm3_genes.bed.gz
height = 7
title = genes (bed12) style=flybase;fontsize=10
style=UCSC
title = genes (bed12) style = flybase; fontsize = 10
style = UCSC
fontsize = 10

[spacer]
Expand All @@ -29,26 +29,29 @@
[test bed6]
file = dm3_genes.bed6.gz
height = 7
title = bed6 border color=black; gene rows=10; fontsize=8; color=Reds (when a color map is used for the color (e.g. coolwarm, Reds) the bed score column mapped to a color)
title = bed6 border color = black; gene_rows=10; fontsize=8; color=Reds
(when a color map is used for the color (e.g. coolwarm, Reds) the bed
score column mapped to a color)
fontsize = 7
file_type = bed
color = Reds
border color = black
gene rows = 10
border_color = black
gene_rows = 10

[spacer]
height = 1

[test bed4]
file = dm3_genes.bed4.gz
height = 10
title = bed4 fontsize=10; line width=1.5; global max row=yes (global max row sets the number of genes per row as the maximum found anywhere in the genome, hence the white space at the bottom)
title = bed4 fontsize = 10; line_width = 1.5; global_max_row = yes
(global max row sets the number of genes per row as the maximum found
anywhere in the genome, hence the white space at the bottom)
fontsize = 10
file_type = bed
global max row = yes
global_max_row = yes
interval_height = 200
line width = 1.5

line_width = 1.5

[spacer]
height = 1
Expand All @@ -60,7 +63,6 @@
fontsize = 12
file_type = bed


[spacer]
height = 1

Expand All @@ -71,25 +73,24 @@
fontsize = 12
file_type = bed


[spacer]
height = 1

[test gtf collapsed]
file = dm3_subset_BDGP5.78.gtf.gz
height = 10
title = gtf from ensembl one entry per gene
merge transcripts = on
prefered name = gene_name
merge_transcripts = on
prefered_name = gene_name
fontsize = 12
file_type = bed

[spacer]
height = 1

[x-axis]
fontsize=30
title = fontsize=30
fontsize = 30
title = fontsize = 30

"""
with open(ROOT + "bed_and_gtf_tracks.ini", 'w') as fh:
Expand All @@ -105,8 +106,8 @@
[genes 1]
file = dm3_genes.bed.gz
height = 7
title = genes (bed12) style=flybase;fontsize=10
style=UCSC
title = genes (bed12) style = flybase; fontsize = 10
style = UCSC
fontsize = 10

[spacer]
Expand All @@ -115,12 +116,11 @@
[genes 2]
file = dm3_genes.bed.gz
height = 7
title = genes (bed12) style=flybase;fontsize=10;max_labels = 600
style=UCSC
title = genes (bed12) style = flybase; fontsize = 10; max_labels = 600
style = UCSC
fontsize = 10
max_labels = 600


"""
with open(ROOT + "bed_maxLab_tracks.ini", 'w') as fh:
fh.write(browser_tracks)
Expand All @@ -131,9 +131,11 @@

def test_plot_tracks_bed_and_gtf():

outfile = NamedTemporaryFile(suffix='.png', prefix='pyGenomeTracks_test_', delete=False)
args = "--tracks {0}/bed_and_gtf_tracks.ini --region X:3000000-3300000 --trackLabelFraction 0.2 --width 38 " \
"--dpi 130 --outFileName {1}".format(ROOT, outfile.name).split()
outfile = NamedTemporaryFile(suffix='.png', prefix='pyGenomeTracks_test_',
delete=False)
args = "--tracks {0}/bed_and_gtf_tracks.ini --region X:3000000-3300000 "\
"--trackLabelFraction 0.2 --width 38 --dpi 130 "\
"--outFileName {1}".format(ROOT, outfile.name).split()
pygenometracks.plotTracks.main(args)
res = compare_images(ROOT + '/master_bed_and_gtf.png', outfile.name, tolerance)
assert res is None, res
Expand All @@ -143,9 +145,11 @@ def test_plot_tracks_bed_and_gtf():

def test_plot_tracks_bed_with_maxLab():

outfile = NamedTemporaryFile(suffix='.png', prefix='pyGenomeTracks_test_', delete=False)
args = "--tracks {0}/bed_maxLab_tracks.ini --region X:2000000-3500000 --trackLabelFraction 0.2 --width 38 " \
"--dpi 130 --outFileName {1}".format(ROOT, outfile.name).split()
outfile = NamedTemporaryFile(suffix='.png', prefix='pyGenomeTracks_test_',
delete=False)
args = "--tracks {0}/bed_maxLab_tracks.ini --region X:2000000-3500000 "\
"--trackLabelFraction 0.2 --width 38 --dpi 130 " \
"--outFileName {1}".format(ROOT, outfile.name).split()
pygenometracks.plotTracks.main(args)
res = compare_images(ROOT + '/master_maxLab.png', outfile.name, tolerance)
assert res is None, res
Expand Down
Loading