Skip to content

Commit

Permalink
Added a new base.cfg option maxl for manual adjustment of the maxim…
Browse files Browse the repository at this point in the history
…um x coordinate on the plot (#69)
  • Loading branch information
mnshgl0110 committed May 22, 2024
1 parent e80c52f commit 97899b7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 5 additions & 3 deletions config/base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ chrmar:0.1 ## Adjusts the gap between chromosomes and tracks. Highe
exmar:0.1 ## Extra margin at the top and bottom of plot area
marginchr:0.1 ## Margin between adjacent chromosomes when using --itx

## LEGEND
## Legend
legend:T ## To plot legend use T, use F to not plot legend
genlegcol:-1 ## Number of columns for genome legend, set -1 for automatic setup
bbox:0,1.01,0.5,0.3 ## [Left edge, bottom edge, width, height]
bbox_v:0,1.1,0.5,0.3 ## For vertical chromosomes (using -v option)
bboxmar:0.5 ## Margin between genome and annotation legends

## Tracks
norm:T ## For each chromosome, independently normalise the y-axis of tracks. Use T for normalising independently, and F to normalise based on max value across all chromosomes

## Tracks:
norm:T ## For each chromosome, independently normalise the y-axis of tracks. Use T for normalising independently, and F to normalise based on max value across all chromosomes
## Axis
maxl:-1 ## Manually set maximum chromosome position. Use `-1` for automatic selection. Does not work with --itx
8 changes: 5 additions & 3 deletions example/base.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ chrmar:0.1 ## Adjusts the gap between chromosomes and tracks. Highe
exmar:0.1 ## Extra margin at the top and bottom of plot area
marginchr:0.1 ## Margin between adjacent chromosomes when using --itx

## LEGEND
## Legend
legend:T ## To plot legend use T, use F to not plot legend
genlegcol:-1 ## Number of columns for genome legend, set -1 for automatic setup
bbox:0,1.01,0.5,0.3 ## [Left edge, bottom edge, width, height]
bbox_v:0,1.1,0.5,0.3 ## For vertical chromosomes (using -v option)
bboxmar:0.5 ## Margin between genome and annotation legends

## Tracks
norm:T ## For each chromosome, independently normalise the y-axis of tracks. Use T for normalising independently, and F to normalise based on max value across all chromosomes

## Tracks:
norm:T ## For each chromosome, independently normalise the y-axis of tracks. Use T for normalising independently, and F to normalise based on max value across all chromosomes
## Axis
maxl:-1 ## Manually set maximum chromosome position. Use `-1` for automatic selection. Does not work with --itx
5 changes: 4 additions & 1 deletion plotsr/scripts/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ def readbasecfg(f, v):
# track properties
cfg['norm'] = 'T'

# axis properties
cfg['maxl'] = -1


if f == '':
return cfg
Expand All @@ -238,7 +241,7 @@ def readbasecfg(f, v):
logger.error("Error in using colour: {} for {}. Use correct hexadecimal colours or named colours defined in matplotlib (https://matplotlib.org/stable/gallery/color/named_colors.html). Using default value.".format(line[1], line[0]))
continue
cfg[line[0]] = line[1]
elif line[0] in ['synlwd', 'invlwd', 'tralwd', 'duplwd', 'alpha', 'chrmar', 'exmar', 'bboxmar', 'genlegcol', 'marginchr']:
elif line[0] in ['synlwd', 'invlwd', 'tralwd', 'duplwd', 'alpha', 'chrmar', 'exmar', 'bboxmar', 'genlegcol', 'marginchr', 'maxl']:
try:
float(line[1])
except ValueError:
Expand Down
2 changes: 2 additions & 0 deletions plotsr/scripts/plotsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def plotsr(args):
MCHR = 0.01 # TODO : read spacing between neighbouring chromosome from config file
maxchr = max([sum(chrlengths[i][1].values()) for i in range(len(chrlengths))])
maxl = int(maxchr/(MCHR + 1 - (MCHR*len(chrgrps))))
elif cfg['maxl'] != -1:
minl, maxl = 0, cfg['maxl']
elif REG is None:
minl, maxl = 0, -1
else:
Expand Down

0 comments on commit 97899b7

Please sign in to comment.