Skip to content

Commit

Permalink
feature improved.
Browse files Browse the repository at this point in the history
  • Loading branch information
ypriverol committed Aug 25, 2023
1 parent 7af1f00 commit 8ebb780
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
26 changes: 17 additions & 9 deletions python/quantmsio/quantms_io/commands/feature_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,40 @@
@click.option("--sdrf_file", help="the SDRF file needed to extract some of the metadata", required=True)
@click.option("--msstats_file", help="the MSstats input file, this will be considered the main format to convert", required=True)
@click.option("--mztab_file", help="the mzTab file, this will be used to extract the protein information", required=True)
@click.option("--consensusxml_file", help="the consensusXML file used to retrieve the mz/rt", required=False)
@click.option("--output_folder", help="Folder where the Json file will be generated", required=True)
@click.option("--output_file", help="Prefix of parquet file", required=False)
@click.option("--delete_existing", help="Delete existing files in the output folder", is_flag=True)
def convert_feature_file(sdrf_file: str, msstats_file: str, mztab_file: str, output_folder: str,
output_file: str, delete_existing: bool):
@click.option("--output_file", help="Parquet file name", required=False)
def convert_feature_file(sdrf_file: str, msstats_file: str, mztab_file: str, consensusxml_file: str, output_folder: str,
output_file: str):
"""
Convert a msstats/mztab file to a parquet file. The parquet file will contain the features and the metadata.
:param sdrf_file: the SDRF file needed to extract some of the metadata
:param msstats_file: the MSstats input file, this will be considered the main format to convert
:param mztab_file: the mzTab file, this will be used to extract the protein information
:param consensusxml_file: the consensusXML file used to retrieve the mz/rt
:param output_folder: Folder where the Json file will be generated
:param output_file: Prefix of the Json file needed to generate the file name
:param delete_existing: Delete existing files in the output folder
:return: none
"""

if sdrf_file is None or msstats_file is None or mztab_file is None or output_folder is None:
raise click.UsageError("Please provide all the required parameters")

feature_manager = FeatureHandler()
feature_manager.parquet_path = output_folder + "/" + output_file + ".parquet"
feature_manager.convert_mztab_msstats_to_feature(
feature_manager.parquet_path = output_folder + "/" + output_file
if consensusxml_file is not None:
feature_manager.convert_mztab_msstats_to_feature(
mztab_file=mztab_file,
msstats_file=msstats_file,
sdrf_file=sdrf_file,
consesusxml_file=consensusxml_file,
use_cache=True
)
else:
feature_manager.convert_mztab_msstats_to_feature(
mztab_file=mztab_file,
msstats_file=msstats_file,
sdrf_file=sdrf_file, use_cache=True
)
sdrf_file=sdrf_file, use_cache=True)



Expand Down
1 change: 0 additions & 1 deletion python/quantmsio/quantms_io/core/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,6 @@ def convert_mztab_msstats_to_feature(self, msstats_file: str, sdrf_file: str, mz
feature_table = self.create_feature_table(feature_list)
# Write the feature table to a parquet file

self.parquet_path = "feature.parquet"
self.write_single_file_parquet(feature_table, write_metadata=True)
mztab_handler.close()

Expand Down
1 change: 1 addition & 0 deletions python/quantmsio/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ requests
numpy
pyarrow
diskcache
pyopenms
2 changes: 1 addition & 1 deletion python/quantmsio/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_version(rel_path):
package_data={"": ["*.xml"],},
url="https://github.com/bigbio/quantms.io",
packages=find_packages(),
install_requires=["click", "pandas", "pandas_schema", "requests", "pytest", "pyyaml", "pyarrow", "diskcache"],
install_requires=["click", "pandas", "pandas_schema", "requests", "pytest", "pyyaml", "pyarrow", "diskcache", "pyopenms"],
entry_points={"console_scripts": ["quantmsio_cli = quantms_io.quantmsio_cli:quantms_io_main"]},
platforms=["any"],
classifiers=[
Expand Down

0 comments on commit 8ebb780

Please sign in to comment.