Skip to content

Commit

Permalink
Merge pull request #14 from Farseer-NMR/master
Browse files Browse the repository at this point in the history
Updates fork to v1.3.1
  • Loading branch information
joaomcteixeira committed Dec 13, 2018
2 parents 99606b7 + e1a093f commit d60fa4d
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 63 deletions.
92 changes: 64 additions & 28 deletions core/fslibs/FarseerSeries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,17 +1291,25 @@ def plot_bar_horizontal(
# ticks positions:
# this is used to fit both applyFASTA=True or False
# reduces xticks to 100 as maximum to avoid ticklabel overlap
if self.shape[1] > 100:
xtick_spacing = self.shape[1]//100

else:
xtick_spacing = 1

## quick patch introduced in 1.3.1 to solve x axis issue
## before release of version 1.4.0
# Define tick spacing
for j in range(101,10000,100):
if j>len(bars):
mod_ = j//100
break
self.logger.debug("Tick spacing set to: {}".format(mod_))

# set xticks and xticks_labels to be represented
xticks = np.arange(len(bars))[0::mod_]

ticklabels = \
self.loc[experiment,0::xtick_spacing,['ResNo','1-letter']].\
self.loc[experiment,0::mod_,['ResNo','1-letter']].\
apply(lambda x: ''.join(x), axis=1)
# Configure XX ticks and Label
axs[i].set_xticks(self.major_axis)
axs[i].set_xticks(xticks)
## https://github.com/matplotlib/matplotlib/issues/6266
axs[i].set_xticklabels(
ticklabels,
Expand All @@ -1315,7 +1323,7 @@ def plot_bar_horizontal(
if x_ticks_color_flag:
self._set_item_colors(
axs[i].get_xticklabels(),
self.loc[experiment,0::xtick_spacing,'Peak Status'],
self.loc[experiment,0::mod_,'Peak Status'],
{
'measured':measured_color,
'missing':missing_color,
Expand Down Expand Up @@ -1361,7 +1369,7 @@ def plot_bar_horizontal(

elif plot_style == 'bar_compacted':
bars = axs[i].bar(
self.loc[experiment,:,'ResNo'].astype(float),
self.major_axis,
self.loc[experiment,:,calccol].fillna(0),
width=bar_width,
align='center',
Expand All @@ -1370,19 +1378,37 @@ def plot_bar_horizontal(
zorder=4
)

initialresidue = int(self.ix[0, 0, 'ResNo'])
finalresidue = int(self.loc[experiment,:,'ResNo'].tail(1))
## quick patch introduced in 1.3.1 to solve x axis issue
## before release of version 1.4.0
num_of_bars = len(bars)
number_of_ticks = num_of_bars
mod_ = 10
sanity_counter = 0

if self.shape[1] > 100:
xtick_spacing = self.shape[1]//100*10
tmp_xticks = self.loc[experiment,:,'ResNo'].astype(float)

else:
xtick_spacing = 10
while number_of_ticks > 10 and sanity_counter < 100000:

mask = np.where(tmp_xticks % mod_ == 0)[0]

xticks = self.major_axis[mask] #np.arange(num_of_bars)[mask]
xticks_labels = self.loc[experiment,mask,'ResNo']
number_of_ticks = len(xticks)

mod_ *= 10
sanity_counter += 1

first_tick = ceil(initialresidue/10)*xtick_spacing
xtickarange = np.arange(first_tick, finalresidue+1, xtick_spacing)
axs[i].set_xticks(xtickarange)
# https://github.com/matplotlib/matplotlib/issues/6266
self.logger.debug("sanity_counter: {}".format(sanity_counter))

# set xticks and xticks_labels to be represented
self.logger.debug("xticks represented: {}".format(xticks))
self.logger.debug("xticks labels represented: {}".format(xticks_labels))

# Set X ticks
axs[i].set_xticks(xticks)
xtickarange = xticks_labels

# # https://github.com/matplotlib/matplotlib/issues/6266
axs[i].set_xticklabels(
xtickarange,
fontname=x_ticks_fn,
Expand All @@ -1396,7 +1422,7 @@ def plot_bar_horizontal(
self.loc[experiment, :, 'Peak Status'] == 'unassigned'

for residue in self.loc[experiment, unassignedmask, 'ResNo']:
residue = int(residue) - 0.5
residue = int(residue) - 1.5
axs[i].axvspan(
residue,
residue+1,
Expand Down Expand Up @@ -1637,16 +1663,26 @@ def plot_bar_vertical(
## Configure XX ticks and Label
axs[i].margins(y=0.01)

if self.shape[1] > 100:
xtick_spacing = self.shape[1]//100

else:
xtick_spacing = 1

axs[i].set_yticks(self.major_axis)
## quick patch introduced in 1.3.1 to solve x axis issue
## before release of version 1.4.0
# Define tick spacing
for j in range(101,10000,100):
if j>len(bars):
mod_ = j//100
break
self.logger.debug("Tick spacing set to: {}".format(mod_))

# set xticks and xticks_labels to be represented
xticks = np.arange(len(bars))[0::mod_]

ticklabels = \
self.loc[experiment,0::mod_,['ResNo','1-letter']].\
apply(lambda x: ''.join(x), axis=1)
# Configure XX ticks and Label
axs[i].set_yticks(xticks)
# https://github.com/matplotlib/matplotlib/issues/6266
axs[i].set_yticklabels(
self.loc[experiment,0::xtick_spacing,['ResNo','1-letter']].\
self.loc[experiment,0::mod_,['ResNo','1-letter']].\
apply(lambda x: ''.join(x), axis=1),
fontname=x_ticks_fn,
fontsize=x_ticks_fs-2,
Expand All @@ -1667,7 +1703,7 @@ def plot_bar_vertical(
if x_ticks_color_flag:
self._set_item_colors(
axs[i].get_yticklabels(),
self.loc[experiment,0::xtick_spacing,'Peak Status'],
self.loc[experiment,0::mod_,'Peak Status'],
{
'measured':measured_color,
'missing':missing_color,
Expand Down
67 changes: 33 additions & 34 deletions install/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,40 +302,39 @@ def _formats_short_title(s):
"""

# http://patorjk.com/software/taag/#p=display&h=1&f=Doom&t=---------%0AFarSeer-NMR%0Av1.3.0%0A---------
banner = \
"""
______ ______ ______ ______ ______ ______ ______ ______ ______
|______||______||______||______||______||______||______||______||______|
______ _____ _ _ ___ _________
| ___| / ___| | \ | || \/ || ___ \
| |_ __ _ _ __\ `--. ___ ___ _ __ ______ | \| || . . || |_/ /
| _|/ _` || '__|`--. \ / _ \ / _ \| '__||______|| . ` || |\/| || /
| | | (_| || | /\__/ /| __/| __/| | | |\ || | | || |\ \
\_| \__,_||_| \____/ \___| \___||_| \_| \_/\_| |_/\_| \_|
__ _____ _____
/ | |____ | | _ |
__ __`| | / / | |/' |
\ \ / / | | \ \ | /| |
\ V / _| |_ _ .___/ /_\ |_/ /
\_/ \___/(_)\____/(_)\___/
______ ______ ______ ______ ______ ______ ______ ______ ______
|______||______||______||______||______||______||______||______||______|
banner = r"""
______ ______ ______ ______ ______ ______ ______ ______ ______
|______||______||______||______||______||______||______||______||______|
______ _____ _ _ ___ _________
| ___| / ___| | \ | || \/ || ___ \
| |_ __ _ _ __\ `--. ___ ___ _ __ ______ | \| || . . || |_/ /
| _|/ _` || '__|`--. \ / _ \ / _ \| '__||______|| . ` || |\/| || /
| | | (_| || | /\__/ /| __/| __/| | | |\ || | | || |\ \
\_| \__,_||_| \____/ \___| \___||_| \_| \_/\_| |_/\_| \_|
__ _____ __
/ | |____ | / |
__ __`| | / / `| |
\ \ / / | | \ \ | |
\ V / _| |_ _ .___/ /_ _| |_
\_/ \___/(_)\____/(_)\___/
______ ______ ______ ______ ______ ______ ______ ______ ______
|______||______||______||______||______||______||______||______||______|
"""

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion install/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import platform as pltfrm
import os

farseer_version = (1, 3, 0) # v1.3.0
farseer_version = (1, 3, 1) # v1.3.0

min_space_allowed = 3 # GB

Expand Down

0 comments on commit d60fa4d

Please sign in to comment.