Skip to content

Commit

Permalink
Updated to 1.0.5
Browse files Browse the repository at this point in the history
- fixed issues where you couldn't load multiple manual CIU dataset simultaneously
- fixed some issues with paths
- fixed issues where you couldn't change the header/footnote information for individual plots in the interactive output panel
- added colorbar option to the interactive output panel
  • Loading branch information
lukasz-migas authored Nov 20, 2017
1 parent 6dc16da commit 3c82abc
Show file tree
Hide file tree
Showing 19 changed files with 839 additions and 128 deletions.
17 changes: 17 additions & 0 deletions ORIGAMI_ANALYSE/source/NoZoomSpan.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

from matplotlib.transforms import blended_transform_factory

from ZoomBox import *
Expand Down
51 changes: 46 additions & 5 deletions ORIGAMI_ANALYSE/source/ORIGAMI.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# -*- encoding: utf-8 -*-
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

# Import libraries
import wx.py as py
import wx
Expand Down Expand Up @@ -110,6 +126,7 @@ def init(self, *args, **kwargs):
# Load protein/CCS database
self.onImportCCSDatabase(evt=None, onStart=True)
self.onCheckVersion(evt=None)

# Log all events to
if self.logging == True:
sys.stdin = self.view.panelPlots.log
Expand Down Expand Up @@ -381,14 +398,19 @@ def onThreading(self, evt, args, action='loadOrigami'):
# Setup thread
if action == 'loadOrigami':
th = threading.Thread(target=self.onLoadOrigamiDataThreaded, args=(args,evt))

elif action == 'saveFigs':
target, path, kwargs = args
th = threading.Thread(target=target.saveFigure2, args=(path,), kwargs=kwargs)

elif action == 'extractIons':
th = threading.Thread(target=self.onExtract2DimsOverMZrangeMultipleThreaded, args=(evt,))

# Start thread
th.start()
try:
th.start()
except:
print('exception')

def onOrigamiRawDirectory(self, evt):
self.config.ciuMode = 'ORIGAMI'
Expand Down Expand Up @@ -798,9 +820,16 @@ def onExtract2DimsOverMZrangeMultipleThreaded(self, evt):
# Check if manual dataset
elif self.docs.dataType == 'Type: MANUAL':
# Shortcut to the file list
nameList = self.view.panelMML.topP.filelist # List with MassLynx file information
nameList = self.view.panelMML.topP.filelist # List with MassLynx file information
# Sort data regardless of what user did
self.view.panelMML.topP.OnSortByColumn(column=1, overrideReverse=True)
tempDict = {}
for item in xrange(nameList.GetItemCount()):
# Determine whether the title of the document matches the title of the item in the table
# if it does not, skip the row
docValue = nameList.GetItem(item,2).GetText()
if docValue != self.docs.title: continue

nameValue = nameList.GetItem(item,0).GetText()
pathValue = self.docs.multipleMassSpectrum[nameValue]['path']

Expand Down Expand Up @@ -834,8 +863,11 @@ def onExtract2DimsOverMZrangeMultipleThreaded(self, evt):
counter = 0 # needed to start off
xlabelsActual = []
for item in xrange(nameList.GetItemCount()):
# Determine whether the title of the document matches the title of the item in the table
# if it does not, skip the row
docValue = nameList.GetItem(item,2).GetText()
if docValue != self.docs.title: continue
key = nameList.GetItem(item,0).GetText()
# print(key, self.docs.multipleMassSpectrum[key]['trap'])
if counter == 0:
tempArray = tempDict[key][0]
xLabelLow = self.docs.multipleMassSpectrum[key]['trap'] # first iteration so first value
Expand Down Expand Up @@ -5154,7 +5186,8 @@ def onPlot2DIMS2(self, zvals, xvals, yvals, xlabel, ylabel,
xlabel=xlabel, labelsY=yvals,
interpolation=self.config.interpolation,
ylabel=ylabel, title="",
cmap=cmap, cmapNorm=cmapNorm,
cmap=cmap,
cmapNorm=cmapNorm,
colorbar=self.config.colorbar,
axesSize=self.config.plotSizes['2D'],
plotName='2D')
Expand Down Expand Up @@ -6333,6 +6366,14 @@ def onCheckVersion(self, evt):
except:
print('Could not check version number')

def onOpenUserGuide(self, evt):
"""
Opens PDF viewer
"""
try:
os.startfile('UserGuide_ANALYSE.pdf')
except:
return


if __name__ == '__main__':
Expand Down
17 changes: 17 additions & 0 deletions ORIGAMI_ANALYSE/source/ZoomBox.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

from matplotlib.patches import Rectangle
from wx.lib.pubsub import setupkwargs
from wx.lib.pubsub import pub
Expand Down
44 changes: 35 additions & 9 deletions ORIGAMI_ANALYSE/source/_compileScript.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

import sys
import zipfile
from distutils.core import setup
Expand All @@ -16,7 +33,7 @@
from shutil import copy

sys.setrecursionlimit(5000)
version = '1.0.4'
version = '1.0.5'

# Compile program using:
# python compileScript.py py2exe
Expand All @@ -35,7 +52,7 @@ def numpy_dll_paths_fix():
numpy_dll_paths_fix()

current_dir = os.path.dirname(os.path.realpath(__file__))
dist_dir = os.path.join(current_dir, "ORIGAMI_ANALYSE_v1.0.4")
dist_dir = os.path.join(current_dir, "ORIGAMI_ANALYSE_v1.0.5")


# py2exe options
Expand All @@ -45,13 +62,22 @@ def numpy_dll_paths_fix():
excludes = ["Tkconstants","Tkinter","tcl","Qt","PyQt4",
"pywin", "pywin.debugger", "pywin.debugger.dbgcon",
"pywin.dialogs", "pywin.dialogs.list","h5py","babel",
"pdb", '_ssl','Qt5','nbconvert','IPython'],
"pdb", '_ssl','Qt5','nbconvert','IPython',
#'scipy.sparse.linalg.eigen.arpack',
#'scipy.sparse.linalg.dsolve',
],
includes = ["matplotlib.backends.backend_qt5agg", "PyQt5",
"scipy.sparse.csgraph._validation", "scipy.linalg.cython_blas",
"scipy.linalg.*","scipy.integrate", "scipy.special", "scipy",
"scipy.special._ufuncs_cxx", "scipy.special.*",
"scipy.special._ufuncs","scipy.stats",
"email.mime.*", "jinja2",
"scipy.sparse.csgraph._validation",
"scipy.linalg.cython_blas",
"scipy.linalg.*","scipy.integrate",
"scipy.special",
"scipy",
"scipy.special._ufuncs_cxx",
"scipy.special.*",
"scipy.special._ufuncs",
"scipy.stats",
"email.mime.*",
"jinja2",
"bokeh.core", "bokeh.events"],
packages = ["wx.lib.pubsub", "pkg_resources"],
dll_excludes=['msvcr71.dll','hdf5.dll'],
Expand All @@ -62,7 +88,7 @@ def numpy_dll_paths_fix():

# main setup
setup(name = "ORIGAMI",
version = '1.0.4',
version = '1.0.5',
description = "ORIGAMI - A Software Suite for Activated Ion Mobility Mass Spectrometry ",
author = "Lukasz G. Migas",
url = 'https://www.click2go.umip.com/i/s_w/ORIGAMI.html',
Expand Down
17 changes: 17 additions & 0 deletions ORIGAMI_ANALYSE/source/analysisFcns.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

import os.path
from subprocess import call,Popen
import numpy as np
Expand Down
137 changes: 137 additions & 0 deletions ORIGAMI_ANALYSE/source/bokeh3D.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# -*- coding: utf-8 -*-

# -------------------------------------------------------------------------
# Copyright (C) 2017 Lukasz G. Migas <lukasz.migas@manchester.ac.uk>
#
# GitHub : https://github.com/lukasz-migas/ORIGAMI
# University of Manchester IP : https://www.click2go.umip.com/i/s_w/ORIGAMI.html
# Cite : 10.1016/j.ijms.2017.08.014
#
# This program is free software. Feel free to redistribute it and/or
# modify it under the condition you cite and credit the authors whenever
# appropriate.
# The program is distributed in the hope that it will be useful but is
# provided WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
# -------------------------------------------------------------------------

# -*- encoding: utf-8 -*-

JS_CODE = """
# This file contains the JavaScript (CoffeeScript) implementation
# for a Bokeh custom extension. The "surface3d.py" contains the
# python counterpart.
#
# This custom model wraps one part of the third-party vis.js library:
#
# http://visjs.org/index.html
#
# Making it easy to hook up python data analytics tools (NumPy, SciPy,
# Pandas, etc.) to web presentations using the Bokeh server.
# These "require" lines are similar to python "import" statements
import * as p from "core/properties"
import {LayoutDOM, LayoutDOMView} from "models/layouts/layout_dom"
# This defines some default options for the Graph3d feature of vis.js
# See: http://visjs.org/graph3d_examples.html for more details.
OPTIONS =
width: '800px'
height: '800px'
style: 'surface'
showPerspective: true
showGrid: true
keepAspectRatio: true
verticalRatio: 1.0
legendLabel: 'stuff'
cameraPosition:
horizontal: -0.35
vertical: 0.22
distance: 1.8
# To create custom model extensions that will render on to the HTML canvas
# or into the DOM, we must create a View subclass for the model. Currently
# Bokeh models and views are based on BackBone. More information about
# using Backbone can be found here:
#
# http://backbonejs.org/
#
# In this case we will subclass from the existing BokehJS ``LayoutDOMView``,
# corresponding to our
export class Surface3dView extends LayoutDOMView
initialize: (options) ->
super(options)
url = "https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.min.js"
script = document.createElement('script')
script.src = url
script.async = false
script.onreadystatechange = script.onload = () => @_init()
document.querySelector("head").appendChild(script)
_init: () ->
# Create a new Graph3s using the vis.js API. This assumes the vis.js has
# already been loaded (e.g. in a custom app template). In the future Bokeh
# models will be able to specify and load external scripts automatically.
#
# Backbone Views create <div> elements by default, accessible as @el. Many
# Bokeh views ignore this default <div>, and instead do things like draw
# to the HTML canvas. In this case though, we use the <div> to attach a
# Graph3d to the DOM.
@_graph = new vis.Graph3d(@el, @get_data(), OPTIONS)
# Set Backbone listener so that when the Bokeh data source has a change
# event, we can process the new data
@connect(@model.data_source.change, () =>
@_graph.setData(@get_data())
)
# This is the callback executed when the Bokeh data has an change. Its basic
# function is to adapt the Bokeh data source to the vis.js DataSet format.
get_data: () ->
data = new vis.DataSet()
source = @model.data_source
for i in [0...source.get_length()]
data.add({
x: source.get_column(@model.x)[i]
y: source.get_column(@model.y)[i]
z: source.get_column(@model.z)[i]
style: source.get_column(@model.color)[i]
})
return data
# We must also create a corresponding JavaScript Backbone model sublcass to
# correspond to the python Bokeh model subclass. In this case, since we want
# an element that can position itself in the DOM according to a Bokeh layout,
# we subclass from ``LayoutDOM``
export class Surface3d extends LayoutDOM
# This is usually boilerplate. In some cases there may not be a view.
default_view: Surface3dView
# The ``type`` class attribute should generally match exactly the name
# of the corresponding Python class.
type: "Surface3d"
# The @define block adds corresponding "properties" to the JS model. These
# should basically line up 1-1 with the Python model class. Most property
# types have counterparts, e.g. ``bokeh.core.properties.String`` will be
# ``p.String`` in the JS implementatin. Where the JS type system is not yet
# as rich, you can use ``p.Any`` as a "wildcard" property type.
@define {
x: [ p.String ]
y: [ p.String ]
z: [ p.String ]
color: [ p.String ]
data_source: [ p.Instance ]
}
"""

def prepJSCODE(self, parameters):
"""
This function produces a specific JS file for generation of 3D files
"""
print()

2 changes: 2 additions & 0 deletions ORIGAMI_ANALYSE/source/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
ID_about = ID_ABOUT
ID_quickDisplayDocument = NewId()

ID_helpGuideLocal = NewId()

ID_saveAllDocuments = NewId()
ID_selectCalibrant = NewId()
ID_selectProtein = NewId()
Expand Down
Loading

0 comments on commit 3c82abc

Please sign in to comment.