Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Zelenka
prasopes
Commits
6287aa50
Commit
6287aa50
authored
Feb 21, 2021
by
Yan
Browse files
Fixing copying as texts
parent
a3983aab
Changes
5
Hide whitespace changes
Inline
Side-by-side
prasopes/__main__.py
View file @
6287aa50
...
...
@@ -210,7 +210,7 @@ def paint_override(self, augCanvas):
self
.
plot
.
set_ylim
(
augCanvas
.
spectplot
.
get_ylim
())
data
=
[
line
.
get_data
()
for
line
in
augCanvas
.
spectplot
.
lines
]
texts
=
copy
.
copy
(
augCanvas
.
ms
)
if
augCanvas
.
ds
.
headers
!=
[]:
if
augCanvas
.
ds
and
augCanvas
.
ds
.
headers
!=
[]:
legend
=
augCanvas
.
spectplot
.
get_legend
().
get_texts
()
[
gt
.
pop_plot
(
*
line
,
self
.
plot
,
texts
,
i
,
legend
[
i
].
get_text
(),
not
(
cf
.
settings
().
value
(
...
...
prasopes/datasets.py
View file @
6287aa50
...
...
@@ -22,13 +22,13 @@ class Dataset():
self
.
dataset
=
[]
self
.
headers
=
[]
self
.
params
=
[]
self
.
time
min
=
-
np
.
inf
self
.
time
max
=
np
.
inf
self
.
min
time
=
-
np
.
inf
self
.
max
time
=
np
.
inf
def
get_chromargs
(
self
):
times
=
dt
.
argsubselect
(
np
.
concatenate
(
[
subset
[
0
]
for
subset
in
self
.
chromatograms
]),
self
.
time
min
,
self
.
time
max
)
self
.
min
time
,
self
.
max
time
)
args
=
[]
for
subset
in
self
.
chromatograms
:
goodtimes
=
np
.
where
((
times
<
len
(
subset
[
0
]))
&
~
(
times
<
0
))[
0
]
...
...
@@ -56,10 +56,10 @@ class ThermoRawDataset(Dataset):
self
.
refresh
()
def
refresh
(
self
):
self
.
dataset
=
load_raw
(
self
.
filename
,
self
.
dataset
=
load_raw
(
self
.
filename
,
cf
.
settings
().
value
(
"tmp_location"
))
self
.
chromatograms
=
self
.
get_chromatograms
()
self
.
time
min
,
self
.
time
max
=
[
self
.
chromatograms
[
i
][
0
][
i
]
self
.
min
time
,
self
.
max
time
=
[
self
.
chromatograms
[
i
][
0
][
i
]
for
i
in
(
0
,
-
1
)]
if
autoparams
:
try
:
...
...
@@ -112,7 +112,7 @@ class BrukerTimsDataset(Dataset):
else
:
self
.
dataset
=
OpenTIMS
(
pathlib
.
Path
(
os
.
path
.
dirname
(
self
.
filename
)))
self
.
chromatograms
=
self
.
get_chromatograms
()
self
.
time
min
,
self
.
time
max
=
[
self
.
chromatograms
[
i
][
0
][
i
]
self
.
min
time
,
self
.
max
time
=
[
self
.
chromatograms
[
i
][
0
][
i
]
for
i
in
(
0
,
-
1
)]
def
get_chromatograms
(
self
):
...
...
@@ -124,7 +124,7 @@ class BrukerTimsDataset(Dataset):
return
[[
times
,
intensities
]]
def
get_spectra
(
self
):
massints
=
self
.
dataset
.
rt_query
(
self
.
time
min
*
60
,
self
.
time
max
*
60
,
massints
=
self
.
dataset
.
rt_query
(
self
.
min
time
*
60
,
self
.
max
time
*
60
,
columns
=
(
'mz'
,
'intensity'
))
sortmasses
=
np
.
sort
(
massints
[
'mz'
])
masssteps
=
sortmasses
[
1
:]
-
sortmasses
[:
-
1
]
...
...
prasopes/datatools.py
View file @
6287aa50
...
...
@@ -17,9 +17,8 @@ def argsubselect(array, minimum, maximum):
def
specttostr
(
augCanvas
,
delim
=
" "
,
names
=
[
"mass"
,
"ion_count"
],
units
=
[
"m/z"
,
""
],
description
=
""
):
lines
=
augCanvas
.
get_lines
()
setnum
=
len
(
lines
)
formnames
=
delim
.
join
([
delim
.
join
(
names
)
for
i
in
range
(
setnum
)])
formunits
=
(
delim
).
join
([
delim
.
join
(
units
)
for
i
in
range
(
setnum
)])
formnames
=
delim
.
join
([
delim
.
join
(
names
)
for
i
in
range
(
len
(
lines
))])
formunits
=
(
delim
).
join
([
delim
.
join
(
units
)
for
i
in
range
(
len
(
lines
))])
header
=
"
\n
"
.
join
([
formnames
,
formunits
,
description
])
+
"
\n
"
strdata
=
[]
...
...
@@ -37,7 +36,7 @@ def specttostr(augCanvas, delim=" ", names=["mass","ion_count"], units=["m/z",""
def
clip_spectstr
(
augCanvas
):
description
=
(
"{}_{:.4}-{:.4}_minutes_of_the_aquisition"
.
format
(
os
.
path
.
basename
(
augCanvas
.
ds
.
filename
),
augCanvas
.
chrom
[
't_start'
],
augCanvas
.
chrom
[
't_end'
]
))
augCanvas
.
ds
.
mintime
,
augCanvas
.
ds
.
maxtime
))
string
=
specttostr
(
augCanvas
.
spectplot
,
delim
=
"
\t
"
,
description
=
description
)
QtWidgets
.
QApplication
.
clipboard
().
clear
()
[
QtWidgets
.
QApplication
.
clipboard
().
setText
(
string
,
i
)
for
i
in
range
(
2
)]
...
...
prasopes/graphtools.py
View file @
6287aa50
...
...
@@ -267,8 +267,8 @@ def plot_subtime(augCanvas):
def
pick_times
(
x_min
,
x_max
,
augCanvas
):
"""subselect part of the chromatogram and plot it"""
augCanvas
.
ds
.
time
min
=
x_min
augCanvas
.
ds
.
time
max
=
x_max
augCanvas
.
ds
.
min
time
=
x_min
augCanvas
.
ds
.
max
time
=
x_max
plot_subtime
(
augCanvas
)
...
...
@@ -424,7 +424,7 @@ def legendize(rawlegend, augCanvas):
np
.
unique
(
np
.
array
(
rawlegend
),
axis
=
0
,
return_index
=
True
)
strdata
=
[
translate
(
i
)
for
i
in
rawlegend
[
np
.
sort
(
uniqindexs
[
1
])]]
strtext
=
" and
\n
"
.
join
(
strdata
)
+
"; t = {:.2f}-{:.2f} min"
.
format
(
augCanvas
.
ds
.
time
min
,
augCanvas
.
ds
.
time
max
)
augCanvas
.
ds
.
min
time
,
augCanvas
.
ds
.
max
time
)
return
strtext
...
...
@@ -488,8 +488,8 @@ def update_paramstable(augCanvas):
augCanvas
.
paramstable
.
cellWidget
(
row
,
0
).
setCheckState
(
states
[
row
])
augCanvas
.
paramstable
.
item
(
row
,
1
).
setText
(
paramname
)
vals
=
[
param
[
row
]
for
param
in
augCanvas
.
ds
.
params
[
1
]
if
(
param
[
0
]
>=
augCanvas
.
ds
.
time
min
and
param
[
0
]
<=
augCanvas
.
ds
.
time
max
)]
if
(
param
[
0
]
>=
augCanvas
.
ds
.
min
time
and
param
[
0
]
<=
augCanvas
.
ds
.
max
time
)]
if
len
(
vals
)
==
0
:
text
=
""
elif
all
([
type
(
val
)
in
[
np
.
float32
,
np
.
float64
]
for
val
in
vals
]):
...
...
prasopes/zcetools.py
View file @
6287aa50
...
...
@@ -126,7 +126,6 @@ def print_graph(ds, coff, coffgrad):
def
key_pressed
(
event
,
ds
,
coff
,
coffgrad
):
print
(
"trigged"
)
if
event
.
key
()
==
QtCore
.
Qt
.
Key_C
:
if
event
.
modifiers
().
__int__
()
==
QtCore
.
Qt
.
ControlModifier
:
painter
=
imgt
.
ImagePainter
(
"zcespec"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment