bigbio / sdrf-pipelines

A repository to convert SDRF proteomics files into pipelines config files
Apache License 2.0
16 stars 21 forks source link

Access to yml and xml files #124

Closed veitveit closed 2 years ago

veitveit commented 2 years ago

Until now, these files only seem accessible when in the same folder and thus one cannot use pkg_resources to access them when being somewhere else.

I suspect that this is due to a missing general setting of the main folder in the setup.py, but admit not knowing sufficient about python packaging.

fabianegli commented 2 years ago

I don't understand what xml/yaml files you want to access and from where. Maybe I can help if you describe the scenario a bit more.

veitveit commented 2 years ago

Thanks! The maxquant converter reads the modifications.xml which is located in the same path like the python file maxquant.py. It is read via pkg_resources.resource_filename(__name__, "modifications.xml").

I want to do also read the param2sdrf.ymlfile from the sdrf_merge folder. It is specified with the right path in the setup.py but access using pkg_resources.resource_filename(__name__, "")works only without specifying the path. Then, in some installations it fails to find the file as it looks in the folder where the maxquant.pyis located. The egg file sometimes contains it there and sometimes not.

My assumption is that there is no clear definition of the path, where the resource_filename function should look.

Does that make sense?

And on the long run, this file could be loaded as a resource from here: https://github.com/bigbio/proteomics-metadata-standard/blob/master/sdrf-proteomics/assets/param2sdrf.yml But this might not be the best way as any change in that repo could be fatal.

fabianegli commented 2 years ago

Currently there are three places that specify data files in the setup.py: data_files, package_data and include_package_data. The first two are explicit, the last refers the task of defining including data files to the MANIFEST.in file. I would remove the explicit mentions and only use the MANIFEST.in file for this purpose. I'll quickly assemble a PR.