-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python bindings don't work correctly in latest version of RStudio without altering Python settings (ModuleNotFoundError) #13
Comments
Hi Ethan, I'm trying to use the rainbow parser in RStudio for Chemstation data file with an ".MS" extension. dat <- chromConverter::read_chroms(path_to_files, format_in = "chemstation", parser = "rainbow") Still after unchecking the box in the above post, I'm getting the following error: Warning in chromConverter::read_chroms(path_to_files, format_in = "chemstation", : I'm pretty sure I've got the right package for Python installed (rainbow-api), and I've told reticulate to use the latest version of Python. (also sorry if this isn't the correct place to ask this question, feel free to move this query somewhere else) Nathan |
Hi Nathan, |
Hi Ethan, No I didn't have miniconda installed, but I do now. I ran the line that you provided, and it gave me the option to install it then, so I did. Output was very long, so I won't post it here. I just ran your line again, here is the ouput: chromConverter::configure_python_environment("rainbow") C:\Users\20373478\OneDrive - Curtin\All R Projects\py-GC-MS Library Searches\py_GC_MS_reports>CALL "C:\Users\20373478\AppData\Local\r-miniconda\condabin\activate.bat" "chromConverter" C:\Users\20373478\OneDrive - Curtin\All R Projects\py-GC-MS Library Searches\py_GC_MS_reports>conda.bat activate "chromConverter" Thank you for your assistance :) |
This seems to be a reticulate configuration issue, since you have rainbow installed in the chromConverter environment, but reticulate isn't finding it. I'm not sure exactly what the issue might be though. Did you restart your R session after installing miniconda and all that? It could be that reticulate has already loaded a different python environment in your R session and can't switch to the chromConverter environment. |
Oh yep okay. Thanks, that is sorted now, I realised I had a line instructing what version of python to use [ reticulate::use_python() ] , so I've commented that out and the script runs.
C:\Users\20373478\OneDrive - Curtin\All R Projects\py-GC-MS Library Searches\py_GC_MS_reports>CALL "C:\Users\20373478\AppData\Local\r-miniconda\condabin\activate.bat" "C:\Users\20373478\AppData\Local\r-miniconda\envs\r-reticulate" C:\Users\20373478\OneDrive - Curtin\All R Projects\py-GC-MS Library Searches\py_GC_MS_reports>conda.bat activate "C:\Users\20373478\AppData\Local\r-miniconda\envs\r-reticulate" The following chromatograms could not be interpreted: 1 Thanks again!! |
Ah, i see. That would do it. Can you send a copy of the file? Could be a format that isn't yet supported by rainbow? (There are multiple .MS formats produced by different versions of chemstation and openlab). Also do you happen to know what version of chemstation the file came from? |
GitHub doesn't like the .MS file type being attached in a comment. What would be your preferred way for me to send it to you? Unfortunately I don't know what version of the software it has come from. I suspect it's pretty old as the GC-MS that we used is fairly old. If it's important to know, I can find out next week what version the computer attached to the GC-MS uses. Thank you Ethan! |
if you want you could email it to me at ***@***.***
…On Fri, Jul 12, 2024 at 12:03 AM nathan-loves-soil ***@***.***> wrote:
GitHub doesn't like the .MS file type being attached in a comment. What
would be your preferred way for me to send it to you?
Unfortunately I don't know what version of the software it has come from.
I suspect it's pretty old as the GC-MS that we used is fairly old. If it's
important to know, I can find out next week what version the computer
attached to the GC-MS uses.
The version that I have on my PC which can read the file is MSD
ChemStation F.01.03.2357.
Thank you Ethan!
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZEBOZ65R22SSSFL6VHXRDZL5ISPAVCNFSM6AAAAABKMX67M6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGQ2DMMRUG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi Nathan, Ethan |
Hi Ethan, I will give that a go this week! I'll let you know how I go with using the entab parser. |
Hey Ethan, just letting you know that the entab parser worked for me! I really appreciated your willingness to help with troubleshooting this with me. Thanks again, Nathan |
Wonderful. Glad to hear it!!
Ethan
…On Tue, Jul 16, 2024 at 4:11 AM nathan-loves-soil ***@***.***> wrote:
Hey Ethan, just letting you know that the entab parser worked for me! I
really appreciated your willingness to help with troubleshooting this with
me. Thanks again, Nathan
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZEBO3OGMOO42FO4PP4S63ZMTIRVAVCNFSM6AAAAABKMX67M6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZQGI4DMNRVGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi Ethan,
Me again, sorry. I had a look around the internet for a solution first but
I couldn't find one.
I was just wondering if you have any advice about the GC-MS file once it's
parsed. I think I am missing something.
Here is the structure of the file:
str(dat)
List of 1
$ C:\gcms\1\data\py_GC_MS\B121468\DATA.MS:'data.frame': 1271906 obs. of 3
variables:
..$ rt : num [1:1271906] 0.0969 0.0969 0.0969 0.0969 0.0969 0.0969
0.0969 0.0969 0.0969 0.0969 ...
..$ mz : num [1:1271906] 490 475 417 360 356 ...
..$ intensity: num [1:1271906] 280 204 309 208 227 448 417 222 295 326 ...
..- attr(*, "sample_name")= chr "Nathan yellow soil trial"
..- attr(*, "sample_id")= num 75
..- attr(*, "detector")= chr "GC/MS Ins"
..- attr(*, "detector_range")= chr ""
..- attr(*, "method")= chr "PE4SC40S"
..- attr(*, "operator")= chr ""
..- attr(*, "run_datetime")= POSIXct[1:1], format: "2024-03-24 10:15:00"
..- attr(*, "time_interval")= logi NA
..- attr(*, "time_unit")= chr "Minutes"
..- attr(*, "source_file")= chr "C:\\gcms\\1\\data\\py_GC_MS\\B121468.D\\
DATA.MS"
..- attr(*, "data_format")= chr "wide"
..- attr(*, "parser")= chr "entab"
..- attr(*, "format_out")= chr "matrix"
The $intensity part seems to show intensity for the total ion chromatogram,
as when it is plotted against $rt (retention time), the plot matches the
chromatogram that I see in the Chemstation software.
However, I seem to be missing another 'intensity' part of the file, which
gives the intensities (abundance) for the mass spectra; the mass to charge
ratio seems to be stored in the $mz part of the file.
I'm just wondering what I might be doing wrong or what I'm missing. I was
hoping to get R to do compound library searches and some multivariate
statistics.
Any advice would be much appreciated. Thanks again for your help so far.
Kind regards,
Nathan
…On Wed, 17 Jul 2024 at 00:06, Ethan Bass ***@***.***> wrote:
Wonderful. Glad to hear it!!
Ethan
On Tue, Jul 16, 2024 at 4:11 AM nathan-loves-soil ***@***.***>
wrote:
> Hey Ethan, just letting you know that the entab parser worked for me! I
> really appreciated your willingness to help with troubleshooting this
with
> me. Thanks again, Nathan
>
> —
> Reply to this email directly, view it on GitHub
> <
#13 (comment)>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ADZEBO3OGMOO42FO4PP4S63ZMTIRVAVCNFSM6AAAAABKMX67M6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZQGI4DMNRVGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZEVNRT26A3XE5A4YDXEOBDZMVAJFAVCNFSM6AAAAABKMX67M6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRGMYTENZXGA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi Nathan, The intensity should be the intensity at each mass fragment as specified by the
You should be able to extract the mass spectrum for whichever retention time by filtering on time, e.g., to get the mass spectrum of the first scan, you could do:
Here is a simple plot function you could use to plot the mass spectrum in base R:
So you should be able to do : Hopefully that helps? Ethan Also, I'm not sure what you were thinking of doing for database search? I have some functions in my |
Recent versions of RStudio made some strange changes to the way reticulate functions, as discussed in this thread, which interfere with chromConverter's python bindings. chromConverter will still load but python-based parsers will likely not be available if a project is loaded. When trying to access python parsers, a
module not found
error will be generated. As far as I can tell, this is a bug with RStudio rather than chromConverter (though RStudio developers seem to think this is the expected behavior).This issue can apparently be resolved by unchecking a box in the RStudio settings. To do this, open RStudio settings and navigate to the Python pane (
Tools:Global Options:Python
). Then uncheck the box that says "Automatically activate project-local Python environments" and clickApply
. RStudio must then be restarted for the settings to take effect.The text was updated successfully, but these errors were encountered: