-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
196 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 5 additions & 18 deletions
23
python/quantmsio/quantms_io/commands/convert_tsv_to_json_command.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,14 @@ | ||
from quantms_io.core.tools import convert_to_json | ||
from quantms_io.core.json import JsonConverter | ||
import click | ||
import os | ||
|
||
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"]) | ||
|
||
|
||
@click.group(context_settings=CONTEXT_SETTINGS) | ||
def cli(): | ||
""" | ||
This is the main tool that gives access to all commands. | ||
""" | ||
|
||
|
||
@click.command("convert-csv-json", short_help="Convert AE or DE file to JSON format", ) | ||
@click.command("convert-tsv-to-json", short_help="Convert AE or DE file to JSON format", ) | ||
@click.option("--file", help="AE or DE file", required=True) | ||
@click.pass_context | ||
def convert_tsv_to_json(ctx, file: str): | ||
def convert_tsv_to_json(file: str): | ||
if not os.path.exists(file): | ||
raise click.UsageError("The file does not exist.") | ||
|
||
convert_to_json(file) | ||
converter = JsonConverter() | ||
converter.convert_tsv_to_json(file) | ||
|
||
|
||
cli.add_command(convert_tsv_to_json) | ||
if __name__ == '__main__': | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.