Skip to content

Commit 67a6194

Browse files
Add optional parameter to validate against metadata convention
1 parent 105131f commit 67a6194

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

ingest/ingest_pipeline.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
# Ingest Cell Metadata file
1919
python ingest_pipeline.py --study-accession SCP1 --file-id 123abc ingest_cell_metadata --cell-metadata-file ../tests/data/metadata_valid.tsv --ingest-cell-metadata
2020
21+
# Ingest Cell Metadata file against convention
22+
python ingest_pipeline.py --study-accession SCP1 --file-id 123abc ingest_cell_metadata --cell-metadata-file ../tests/data/metadata_valid.tsv --ingest-cell-metadata --validate-convention
23+
2124
# Ingest dense file
2225
python ingest_pipeline.py --study-accession SCP1 --file-id 123abc ingest_expression --taxon-name 'Homo sapiens' --taxon-common-name human --ncbi-taxid 9606 --matrix-file ../tests/data/dense_matrix_19_genes_100k_cells.txt --matrix-file-type dense
2326
@@ -58,7 +61,7 @@
5861

5962
class IngestPipeline(object):
6063
# File location for metadata json convention
61-
JSON_CONVENTION = 'DoNotTouch/AMC_v1.1.1.json'
64+
JSON_CONVENTION = 'DoNotTouch/AMC_v0.8.json'
6265

6366
def __init__(
6467
self,
@@ -244,7 +247,14 @@ def ingest_expression(self) -> None:
244247
def ingest_cell_metadata(self):
245248
"""Ingests cell metadata files into Firestore."""
246249
# TODO: Add self.has_valid_metadata_convention() to if statement
247-
if self.cell_metadata.is_valid_file and self.has_valid_metadata_convention():
250+
if self.cell_metadata.is_valid_file:
251+
# Check to see file needs to be check against metadata convention
252+
if self.kwargs['validate_convention'] is not None:
253+
if self.kwargs['validate_convention']:
254+
if self.has_valid_metadata_convention():
255+
pass
256+
else:
257+
return 1
248258
self.cell_metadata.reset_file(2, open_as="dataframe")
249259
self.cell_metadata.preproccess()
250260
for metadataModel in self.cell_metadata.transform():
@@ -386,7 +396,12 @@ def create_parser():
386396
"--ingest-cell-metadata",
387397
required=True,
388398
action="store_true",
389-
help="Indicates that subsampliing functionality should be invoked",
399+
help="Indicates that ingest of cell metadata should be invoked",
400+
)
401+
parser_cell_metadata.add_argument(
402+
"--validate-convention",
403+
action="store_true",
404+
help="Indicates that metadata file should be validated against convention",
390405
)
391406

392407
# Parser ingesting cluster files

0 commit comments

Comments
 (0)