-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from diskontinuum/colab_updates
Parquet_integration
- Loading branch information
Showing
34 changed files
with
1,712 additions
and
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ tests/__pycache__/ | |
.pytest_cache/ | ||
*.ipynb | ||
.DS_Store | ||
.vscode/ |
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 |
---|---|---|
|
@@ -12,7 +12,6 @@ install: | |
language: | ||
- python | ||
python: | ||
- 2.7 | ||
- 3.5 | ||
script: | ||
- pytest | ||
|
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
80 changes: 80 additions & 0 deletions
80
cytominer_database/commands/command_ingest_variable_engine.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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import click | ||
import configparser | ||
import os | ||
import pkg_resources | ||
|
||
import cytominer_database.ingest | ||
import cytominer_database.ingest_variable_engine | ||
import cytominer_database.munge | ||
|
||
""" | ||
Runs new code (ingest_variable_engine.py instead of ingest.py). | ||
Two backend engines are available: Sqlite and Parquet. | ||
In effect, these options are read from the config file. | ||
In terms of the command (and testing the command), | ||
the config file name needs to be specified | ||
(each backend choice has its own config file). | ||
""" | ||
|
||
|
||
@click.command( | ||
"ingest_new", | ||
help="""\ | ||
Import CSV files into a database. | ||
SOURCE is a directory containing subdirectories that contain CSV files. | ||
TARGET is a connection string for the database. | ||
""", | ||
) | ||
@click.argument("source", type=click.Path(exists=True)) | ||
@click.argument("target", type=click.Path(writable=True)) | ||
@click.option( | ||
"-c", | ||
"--config-file", | ||
default=pkg_resources.resource_filename( | ||
"cytominer_database", os.path.join("config", "config_cellpainting.ini") | ||
), | ||
help="Configuration file.", | ||
type=click.Path(exists=True), | ||
) | ||
@click.option( | ||
"--munge/--no-munge", | ||
default=True, | ||
help="""\ | ||
True if the CSV files for individual compartments \ | ||
have been merged into a single CSV file; \ | ||
the CSV will be split into one CSV per compartment \ | ||
(Default: true). | ||
""", | ||
) | ||
@click.option( | ||
"--skip-image-prefix/--no-skip-image-prefix", | ||
default=True, | ||
help="""\ | ||
True if the prefix of image table name should be \ | ||
excluded from the names of columns from per image \ | ||
table e.g. use `Metadata_Plate` instead of \ | ||
`Image_Metadata_Plate` (Default: true). | ||
""", | ||
) | ||
@click.option( | ||
"--variable-engine/--no-variable-engine", | ||
default=False, | ||
help="""\ | ||
True if multiple backend engines (SQLite or Parquet)\ | ||
can be selected. The config file then determines | ||
which backend engine is used (path of which is passed as a flag).\ | ||
Default: False (--no-variable-engine) | ||
""", | ||
) | ||
def command(source, target, config_file, munge, skip_image_prefix, variable_engine): | ||
if munge: | ||
cytominer_database.munge.munge(config_path=config_file, source=source) | ||
|
||
if variable_engine: | ||
cytominer_database.ingest_variable_engine.seed( | ||
source, target, config_file, skip_image_prefix | ||
) | ||
else: | ||
cytominer_database.ingest.seed(source, target, config_file, skip_image_prefix) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
[filenames] | ||
image = Image.csv | ||
experiment = Experiment.csv | ||
|
||
[database_engine] | ||
database = SQLite | ||
|
||
[schema] | ||
reference_option = sample | ||
ref_fraction = 1 | ||
type_conversion = int2float |
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.