plOTme-for-Orbitrap 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- plotme_for_orbitrap-0.0.1/LICENSE +19 -0
- plotme_for_orbitrap-0.0.1/PKG-INFO +28 -0
- plotme_for_orbitrap-0.0.1/README.md +14 -0
- plotme_for_orbitrap-0.0.1/pyproject.toml +23 -0
- plotme_for_orbitrap-0.0.1/src/plOTme_for_Orbitrap/__init__.py +0 -0
- plotme_for_orbitrap-0.0.1/src/plOTme_for_Orbitrap/flasc.py +51 -0
- plotme_for_orbitrap-0.0.1/src/plOTme_for_Orbitrap/flex.py +51 -0
- plotme_for_orbitrap-0.0.1/src/plOTme_for_Orbitrap/sinch.py +145 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (c) 2018 The Python Packaging Authority
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: plOTme_for_Orbitrap
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A set of Python scripts to plot CSV data extracted from Thermo Scientific FreeStyle
|
|
5
|
+
Project-URL: Homepage, https://github.com/cameronhollick/plOTme
|
|
6
|
+
Project-URL: Issues, https://github.com/cameronhollick/plOTme/issues
|
|
7
|
+
Author-email: Cameron Hollick <cameron.hollick@york.ac.uk>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Requires-Python: >=3.14
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
## plOTme: A little set of scripts for visualising Orbitrap data
|
|
16
|
+
A few Python scripts designed to aid in the plotting of MS2 and associated HPLC data obtained on an Orbitrap. After initial data processing in FreeStyle, export your data in CSV format, load things into the relevant script, and let Python take care of the rest.
|
|
17
|
+
|
|
18
|
+
### General-purpose scripts
|
|
19
|
+
|
|
20
|
+
***FLASC:*** <ins>F</ins>u<ins>l</ins>l m<ins>as</ins>s spe<ins>c</ins>trometry plots. Feed a folder with your CSVs into the script, and it'll plot up all your data into individual MS1 spectra.
|
|
21
|
+
|
|
22
|
+
***FLEX:*** <ins>F</ins>u<ins>l</ins>l <ins>ex</ins>tracted ion chromatograms. Feed a folder with your CSVs into the script, and it'll plot up all your data into individual EICs.
|
|
23
|
+
|
|
24
|
+
### Scripts for studying changing injection volumes
|
|
25
|
+
|
|
26
|
+
***SINCH:*** <ins>S</ins>tudying <ins>in</ins>jection volumes by <ins>ch</ins>romatogram comparison. Designed for plotting chromatograms on the same set of axes where the independent factor is the injection volume (i.e. runtime is the same across all samples). By default, reads the first 5 CSV files in a user-specified folder and assigns them to 1, 2, 5, 10 and 20 μL (can be changed in the script).
|
|
27
|
+
|
|
28
|
+
***SINTA:*** <ins>S</ins>tudying <ins>in</ins>jection volumes by <ins>ta</ins>ndem mass spectrometry. Coming soon.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
## plOTme: A little set of scripts for visualising Orbitrap data
|
|
2
|
+
A few Python scripts designed to aid in the plotting of MS2 and associated HPLC data obtained on an Orbitrap. After initial data processing in FreeStyle, export your data in CSV format, load things into the relevant script, and let Python take care of the rest.
|
|
3
|
+
|
|
4
|
+
### General-purpose scripts
|
|
5
|
+
|
|
6
|
+
***FLASC:*** <ins>F</ins>u<ins>l</ins>l m<ins>as</ins>s spe<ins>c</ins>trometry plots. Feed a folder with your CSVs into the script, and it'll plot up all your data into individual MS1 spectra.
|
|
7
|
+
|
|
8
|
+
***FLEX:*** <ins>F</ins>u<ins>l</ins>l <ins>ex</ins>tracted ion chromatograms. Feed a folder with your CSVs into the script, and it'll plot up all your data into individual EICs.
|
|
9
|
+
|
|
10
|
+
### Scripts for studying changing injection volumes
|
|
11
|
+
|
|
12
|
+
***SINCH:*** <ins>S</ins>tudying <ins>in</ins>jection volumes by <ins>ch</ins>romatogram comparison. Designed for plotting chromatograms on the same set of axes where the independent factor is the injection volume (i.e. runtime is the same across all samples). By default, reads the first 5 CSV files in a user-specified folder and assigns them to 1, 2, 5, 10 and 20 μL (can be changed in the script).
|
|
13
|
+
|
|
14
|
+
***SINTA:*** <ins>S</ins>tudying <ins>in</ins>jection volumes by <ins>ta</ins>ndem mass spectrometry. Coming soon.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling >= 1.26"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "plOTme_for_Orbitrap"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Cameron Hollick", email="cameron.hollick@york.ac.uk" },
|
|
10
|
+
]
|
|
11
|
+
description = "A set of Python scripts to plot CSV data extracted from Thermo Scientific FreeStyle"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.14"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
license = "MIT"
|
|
19
|
+
license-files = ["LICEN[CS]E*"]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/cameronhollick/plOTme"
|
|
23
|
+
Issues = "https://github.com/cameronhollick/plOTme/issues"
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Mon Nov 9 11:38:39 2026
|
|
4
|
+
|
|
5
|
+
@author: mh2656
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Import packages
|
|
9
|
+
from tkinter.filedialog import askdirectory
|
|
10
|
+
import pandas as pd
|
|
11
|
+
import os
|
|
12
|
+
import matplotlib.pyplot as plt
|
|
13
|
+
from tqdm import tqdm
|
|
14
|
+
|
|
15
|
+
# Check run times
|
|
16
|
+
print("Welcome to FLASC!")
|
|
17
|
+
print()
|
|
18
|
+
print("Please select your data folder.")
|
|
19
|
+
print()
|
|
20
|
+
|
|
21
|
+
# Load in files
|
|
22
|
+
path = askdirectory(title="Select Folder")
|
|
23
|
+
csv_files = [f for f in os.listdir(path) if f.endswith('.csv')]
|
|
24
|
+
|
|
25
|
+
# Create plotting loop
|
|
26
|
+
for file in csv_files:
|
|
27
|
+
|
|
28
|
+
for i in tqdm(range(0, 100), desc = "Processing..."):
|
|
29
|
+
|
|
30
|
+
# Define data
|
|
31
|
+
df = pd.read_csv(os.path.join(path, file), skiprows=7, sep=",")
|
|
32
|
+
fig, ax = plt.subplots()
|
|
33
|
+
x = df["Mass"]
|
|
34
|
+
y = df["Intensity"]
|
|
35
|
+
|
|
36
|
+
# Add graph features
|
|
37
|
+
ax.plot(x,y)
|
|
38
|
+
ax.set_xlabel("m/z")
|
|
39
|
+
ax.set_ylabel("Intensity")
|
|
40
|
+
|
|
41
|
+
# Save files
|
|
42
|
+
no_csv = file.replace(".csv","")
|
|
43
|
+
save_name = no_csv + ".jpg"
|
|
44
|
+
saved = plt.savefig(os.path.join(path, save_name), bbox_inches = 'tight')
|
|
45
|
+
|
|
46
|
+
# Free up memory
|
|
47
|
+
plt.close()
|
|
48
|
+
|
|
49
|
+
print()
|
|
50
|
+
print()
|
|
51
|
+
print("All done!")
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Tue Nov 10 16:35:21 2026
|
|
4
|
+
|
|
5
|
+
@author: mh2656
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Import packages
|
|
9
|
+
from tkinter.filedialog import askdirectory
|
|
10
|
+
import pandas as pd
|
|
11
|
+
import os
|
|
12
|
+
import matplotlib.pyplot as plt
|
|
13
|
+
from tqdm import tqdm
|
|
14
|
+
|
|
15
|
+
# Check run times
|
|
16
|
+
print("Welcome to FLEX!")
|
|
17
|
+
print()
|
|
18
|
+
print("Please select your data folder.")
|
|
19
|
+
print()
|
|
20
|
+
|
|
21
|
+
# Load in files
|
|
22
|
+
path = askdirectory(title="Select Folder")
|
|
23
|
+
csv_files = [f for f in os.listdir(path) if f.endswith('.csv')]
|
|
24
|
+
|
|
25
|
+
# Create plotting loop
|
|
26
|
+
for file in csv_files:
|
|
27
|
+
|
|
28
|
+
for i in tqdm(range(0, 100), desc = "Processing..."):
|
|
29
|
+
|
|
30
|
+
# Define data
|
|
31
|
+
df = pd.read_csv(os.path.join(path, file), skiprows=3, sep=",")
|
|
32
|
+
fig, ax = plt.subplots()
|
|
33
|
+
x = df["Time(min)"]
|
|
34
|
+
y = df["Relative Abundance"]
|
|
35
|
+
|
|
36
|
+
# Add graph features
|
|
37
|
+
ax.plot(x,y)
|
|
38
|
+
ax.set_xlabel("Retention time / minutes")
|
|
39
|
+
ax.set_ylabel("Relative abundance")
|
|
40
|
+
|
|
41
|
+
# Save files
|
|
42
|
+
no_csv = file.replace(".csv","")
|
|
43
|
+
save_name = no_csv + ".jpg"
|
|
44
|
+
saved = plt.savefig(os.path.join(path, save_name), bbox_inches = 'tight')
|
|
45
|
+
|
|
46
|
+
# Free up memory
|
|
47
|
+
plt.close()
|
|
48
|
+
|
|
49
|
+
print()
|
|
50
|
+
print()
|
|
51
|
+
print("All done!")
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# -*df = pd.read_csv(f,- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Wed Nov 4 12:05:39 2026
|
|
4
|
+
|
|
5
|
+
@author: mh2656
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# Import packages
|
|
9
|
+
#from tkinter import *
|
|
10
|
+
#from tkinter import ttk
|
|
11
|
+
from tkinter.filedialog import askdirectory#, asksaveasfile
|
|
12
|
+
import pandas as pd
|
|
13
|
+
import psutil,os
|
|
14
|
+
import matplotlib.pyplot as plt
|
|
15
|
+
from matplotlib.lines import Line2D
|
|
16
|
+
from PIL import Image
|
|
17
|
+
|
|
18
|
+
# Check run times
|
|
19
|
+
print("Welcome to SINCH!")
|
|
20
|
+
print()
|
|
21
|
+
print("Before we start, were all of your files obtained over the same sample runtime? (y/n) ")
|
|
22
|
+
runtimes = input()
|
|
23
|
+
|
|
24
|
+
if runtimes.lower() == 'y':
|
|
25
|
+
print("Enter runtime in minutes: ")
|
|
26
|
+
mins = input()
|
|
27
|
+
print("Enter frequency of data sampling in seconds: ")
|
|
28
|
+
secs = input()
|
|
29
|
+
print("Got it. Go ahead and select your data folder!")
|
|
30
|
+
|
|
31
|
+
# Load in files and concatenate into data frame
|
|
32
|
+
path = askdirectory(title="Select Folder")
|
|
33
|
+
csv_files = [f for f in os.listdir(path) if f.endswith('.csv')]
|
|
34
|
+
li = []
|
|
35
|
+
for file in csv_files:
|
|
36
|
+
df = pd.read_csv(os.path.join(path, file), skiprows=3, sep=",")
|
|
37
|
+
li.append(df)
|
|
38
|
+
df = pd.concat(li, axis=0, ignore_index = True)
|
|
39
|
+
|
|
40
|
+
# Figure out where to split data frame
|
|
41
|
+
mins = float(mins) * 60
|
|
42
|
+
secs = float(secs)
|
|
43
|
+
n = int(mins / secs)
|
|
44
|
+
|
|
45
|
+
# Create smaller data frames for each injection volume
|
|
46
|
+
df_1 = df.iloc[0:n]
|
|
47
|
+
df_2 = df.iloc[n:n*2]
|
|
48
|
+
df_5 = df.iloc[n*2:n*3]
|
|
49
|
+
df_10 = df.iloc[n*3:n*4]
|
|
50
|
+
df_20 = df.iloc[n*4:n*5]
|
|
51
|
+
|
|
52
|
+
# Define data for plotting
|
|
53
|
+
fig, ax = plt.subplots()
|
|
54
|
+
x1 = df_1["Time(min)"]
|
|
55
|
+
x2 = df_2["Time(min)"]
|
|
56
|
+
x5 = df_5["Time(min)"]
|
|
57
|
+
x10 = df_10["Time(min)"]
|
|
58
|
+
x20 = df_20["Time(min)"]
|
|
59
|
+
y1 = df_1["Relative Abundance"]
|
|
60
|
+
y2 = df_2["Relative Abundance"]
|
|
61
|
+
y5 = df_5["Relative Abundance"]
|
|
62
|
+
y10 = df_10["Relative Abundance"]
|
|
63
|
+
y20 = df_20["Relative Abundance"]
|
|
64
|
+
|
|
65
|
+
# Plot data
|
|
66
|
+
ax.fill_between(x20, y20, color='#440154')
|
|
67
|
+
ax.fill_between(x10, y10, color='#3b528b')
|
|
68
|
+
ax.fill_between(x5, y5, color='#21918c')
|
|
69
|
+
ax.fill_between(x2, y2, color='#5ec962')
|
|
70
|
+
ax.fill_between(x1, y1, color='#fde725')
|
|
71
|
+
|
|
72
|
+
# Create legend
|
|
73
|
+
legend_elements = [Line2D([0],[0], marker='o', label='1 μL', color='#fde275'),
|
|
74
|
+
Line2D([0],[0], marker='o', label='2 μL', color='#5ec962'),
|
|
75
|
+
Line2D([0],[0], marker='o', label='5 μL', color='#21918c'),
|
|
76
|
+
Line2D([0],[0], marker='o', label='10 μL', color='#3b528b'),
|
|
77
|
+
Line2D([0],[0], marker='o', label='20 μL', color='#440154')]
|
|
78
|
+
|
|
79
|
+
# Add graph features
|
|
80
|
+
ax.set_xlabel("Retention time / minutes")
|
|
81
|
+
ax.set_ylabel("Relative abundance")
|
|
82
|
+
ax.legend(handles=legend_elements)
|
|
83
|
+
|
|
84
|
+
# Check file before saving
|
|
85
|
+
plt.savefig("temp.jpg", bbox_inches = 'tight')
|
|
86
|
+
print("Opening plot preview...")
|
|
87
|
+
preview = Image.open("temp.jpg")
|
|
88
|
+
preview.show()
|
|
89
|
+
|
|
90
|
+
# Save plot
|
|
91
|
+
#root = Tk()
|
|
92
|
+
#root.geometry('200x150')
|
|
93
|
+
|
|
94
|
+
#def save():
|
|
95
|
+
# files = [('All Files', '*.*'),
|
|
96
|
+
# ('Python Files', '*.py'),
|
|
97
|
+
# ('Text Document', '*.txt'),
|
|
98
|
+
# ('JPEG Image', '*.jpg'),
|
|
99
|
+
# ('PNG Image', '*.png')]
|
|
100
|
+
# file = asksaveasfile(filetypes = files, defaultextension = files)
|
|
101
|
+
|
|
102
|
+
#def close():
|
|
103
|
+
# root.quit()
|
|
104
|
+
|
|
105
|
+
#def save_and_quit():
|
|
106
|
+
# save()
|
|
107
|
+
# close()
|
|
108
|
+
|
|
109
|
+
#btn = ttk.Button(root, text = 'Save', command = save_and_quit())
|
|
110
|
+
#btn.pack(side = TOP, pady = 20)
|
|
111
|
+
#root.after(file, 500, root.destroy())
|
|
112
|
+
#btn2 = ttk.Button(root, text = 'Close', command = lambda : root.destroy())
|
|
113
|
+
#btn2.pack(side = BOTTOM, pady = 20)
|
|
114
|
+
#root.mainloop()
|
|
115
|
+
|
|
116
|
+
# Close image viewer
|
|
117
|
+
#for process in (process for process in psutil.process_iter() if process.name()=="Photos.exe"):
|
|
118
|
+
# process.kill()
|
|
119
|
+
|
|
120
|
+
# Save plot
|
|
121
|
+
print("Save plot? (y/n) ")
|
|
122
|
+
save_decision = input()
|
|
123
|
+
|
|
124
|
+
if save_decision.lower() == 'y':
|
|
125
|
+
print("Enter file name to save under: ")
|
|
126
|
+
save_plot = input()
|
|
127
|
+
save_name = save_plot + ".jpg"
|
|
128
|
+
saved = plt.savefig(os.path.join(path, save_name), bbox_inches = 'tight')
|
|
129
|
+
print("File saved successfully!")
|
|
130
|
+
|
|
131
|
+
elif save_decision.lower() == 'n':
|
|
132
|
+
print("Saving aborted. Please re-run this script if you change your mind.")
|
|
133
|
+
|
|
134
|
+
else:
|
|
135
|
+
print("Your input was not a valid option. Please re-run this script and type either 'y' or 'n' only.")
|
|
136
|
+
|
|
137
|
+
# Close image viewer
|
|
138
|
+
for process in (process for process in psutil.process_iter() if process.name()=="Photos.exe"):
|
|
139
|
+
process.kill()
|
|
140
|
+
|
|
141
|
+
elif runtimes.lower() == 'n':
|
|
142
|
+
print("This script is not suited for varying runtimes. Sorry!")
|
|
143
|
+
|
|
144
|
+
else:
|
|
145
|
+
print("Your input was not a valid option. Please re-run this script and type either 'y' or 'n' only.")
|