Skip to content

Commit

Permalink
DECA v1.10 Update
Browse files Browse the repository at this point in the history
Bug Fixes: Merge Files issue
New Features: Additional File types for uptake plot export
  • Loading branch information
komiveslab committed Oct 31, 2019
1 parent 0c9cda9 commit add279d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
29 changes: 21 additions & 8 deletions Main.py
Expand Up @@ -356,7 +356,8 @@ def updatehelp():
# Custom save dialog for MacOS
def save_figure(self, dpival, fig): # Thanks to Donal Fellows https://stackoverflow.com/questions/52282334/tkfiledialog-does-not-show-file-extension-options-on-osx10-12-6
root = Tk.Toplevel()
filetypes = "{{png files} *.png} {{svg files} *.svg} {{pdf files} *.pdf} {{all files} *}"
filetypes = "{{{eps files} *.eps} {{jpg files} *.jpg} {{pdf files} *.pdf} {png files} *.png} {{ps files} *.ps}" \
" {{svg files} *.svg} {{tif files} *.tif} {{all files} *}"
filename = root.tk.eval('::tk::dialog::file:: save -filetypes {' + filetypes + '}')
if filename == "":
filename = None
Expand Down Expand Up @@ -2218,22 +2219,34 @@ def done_resizing(event):
# Save Dialog
def save(self):
def single():
filetype = str(self.psv.combobox_file_type.get())
filetype = str(self.psv.file_type_str.get())
print(filetype)
print("lower "+filetype.lower())
dpival = float(self.psv.combobox_dpi.get())
default_pep = self.selected_peptides[0][self.states[0]][0]
if str(default_pep['Fragment']) == "" and str(default_pep['Modification'])=="":
initpath = self.protein + "_" + str(default_pep['Start']) + "-" + str(default_pep['End']) + "." + \
filetype.lower()
elif str(default_pep['Fragment']) == "" and str(default_pep['Modification']) != "":
initpath = self.protein + "_" + str(default_pep['Start']) + "-" + str(default_pep['End']) + "_" + \
str(default_pep['Modification']) + "." + filetype.lower()
elif str(default_pep['Fragment']) != "" and str(default_pep['Modification']) == "":
initpath = self.protein + "_" + str(default_pep['Start']) + "-" + str(default_pep['End']) + "_" + \
str(default_pep['Fragment']) + "." + filetype.lower()
else:
initpath = self.protein + "_" + str(default_pep['Start']) + "-" + str(default_pep['End']) + "_" + \
str(default_pep['Fragment']) + "_" + str(default_pep['Modification']) + "." + filetype.lower()
print("Path "+initpath)
savefile = FileDialog.asksaveasfilename(
title="Choose save location",
initialfile=self.protein + "_" + str(default_pep['Start']) + "-" + str(default_pep['End']) + "_" +
str(default_pep['Fragment']) + "_" + str(
default_pep['Modification']) + "." + filetype.lower(),
initialdir=expanduser('~'),
filetypes=((filetype, '*.' + filetype.lower()), ("all files", "*.*")))
initialfile=initpath,
initialdir=expanduser('~'))
self.view.figure.savefig(savefile, dpi=dpival, transparent=True)
self.psv.top.destroy()
def multi():
# Prompting save directory
savedir = FileDialog.askdirectory(title="Choose save location", initialdir=expanduser('~'))
filetype = str(self.psv.combobox_file_type.get())
filetype = str(self.psv.file_type_str.get())
dpival = float(self.psv.combobox_dpi.get())
n = 0
for i in self.selected_peptides:
Expand Down
6 changes: 5 additions & 1 deletion Model.py
Expand Up @@ -75,6 +75,8 @@ def __init__(self, name='', empty=False, que=None):
self.assignIDs_CSV()
if self.que is not None:
self.que.put(-1)
else:
self.filename = "merged"

def dictify(self, order):
newdict = {}
Expand Down Expand Up @@ -131,7 +133,8 @@ def detectType(self, infile):
for i in range(0,len(header)):
header[i] = header[i].rstrip()
print(header)
if set(header)=={'Protein','Start','End','Sequence','Modification','Fragment','MaxUptake','MHP','State','Exposure','Center','Center SD','Uptake','Uptake SD','RT','RT SD'}:
if all(i in header for i in ['Protein','Start','End','Sequence','Modification','Fragment','MaxUptake','MHP','State',
'Exposure','Center','Center SD','Uptake','Uptake SD','RT','RT SD']):
print('File is DynamX State Style')
self.filetype = 'CSV'
self.readFile(infile, 'State')
Expand Down Expand Up @@ -1377,6 +1380,7 @@ def mergeFiles(self, dictlist, mergeeach):
self.cor_factor[float(i[0])] = float(i[1])
self.organizeData()
self.cleanFiles()
self.assignIDs_CSV()

# Populate sequence of residues with the best peptide information at each location
def assignData(self, protein, state1, exposure, state2=None):
Expand Down
10 changes: 6 additions & 4 deletions View.py
Expand Up @@ -939,14 +939,14 @@ def __init__(self, parent, multi=False):
label_file_type.grid(row=rownum, column=0)
label_file_type.configure(text='''Type:''')

file_type_str = Tk.StringVar()
combobox_file_type = ttk.Combobox(frame)
combobox_file_type.grid(row=rownum, column=1)
list_file_type = ["PNG", "SVG", "PDF"]
combobox_file_type.configure(values=list_file_type)
combobox_file_type.set('PNG')
list_file_type = ["EPS","PDF","PNG","PS","SVG","TIF"]
combobox_file_type.configure(values=list_file_type,textvariable=file_type_str)
combobox_file_type.set("TIF")
combobox_file_type.configure(takefocus="")
combobox_file_type.configure(cursor="xterm")
self.combobox_file_type = combobox_file_type
rownum = rownum + 1

button_cancel = ttk.Button(frame)
Expand All @@ -959,6 +959,8 @@ def __init__(self, parent, multi=False):

self.top = top
self.combobox_dpi = combobox_dpi
self.combobox_file_type = combobox_file_type
self.file_type_str = file_type_str
self.button_cancel = button_cancel
self.button_save = button_save

Expand Down

0 comments on commit add279d

Please sign in to comment.