Skip to content

Commit

Permalink
Merge pull request #51 from brain-bican/bug_fix
Browse files Browse the repository at this point in the history
load from cas json
  • Loading branch information
hkir-dev authored Dec 12, 2023
2 parents 045629b + c4029e0 commit f3be1bc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
id: CCN202204130
id: CS202210140
title: Human M1 taxonomy
description: Atlas of human primary motor cortex (M1), developed in collaboration with the BRAIN Initiative Cell Census Network (BICCN).
matrix_file_id: CellXGene_dataset:Siletti_all_non_neuronal_cells_v2
github_org: hkir-dev
repo: human_m1
author: https://orcid.org/0000-0002-7073-9172
accession_id_prefix: CS202210140_
citation: ''
creators:
- https://orcid.org/0000-0001-7258-9596
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ openpyxl
# git+https://github.com/ontodev/axle.git
urlp
mkdocs
cas-tools==0.0.1.dev11
cas-tools==0.0.1.dev14
pandas
tdta==0.1.0.dev2
24 changes: 15 additions & 9 deletions scripts/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from cas.ingest.ingest_user_table import ingest_user_data
from cas.flatten_data_to_tables import serialize_to_tables
from cas.file_utils import read_cas_json_file
from pathlib import Path
from ruamel.yaml import YAML

Expand Down Expand Up @@ -48,17 +49,22 @@ def import_data(input, schema, curation_tables):
user_cas_path = f
new_files.append(user_cas_path)

if user_data_path:
user_data_ct_path = add_user_table_to_nanobot(user_data_path, schema, curation_tables)
new_files.append(user_data_ct_path)
# provide either json or tsv + yaml
if user_cas_path:
user_file_name = os.path.splitext(os.path.basename(user_cas_path))[0]
std_data = read_cas_json_file(user_cas_path)
else:
raise Exception("Couldn't find the cell type annotation config file (with yaml or yml extension) in folder: " + input)
if user_data_path:
user_data_ct_path = add_user_table_to_nanobot(user_data_path, schema, curation_tables)
new_files.append(user_data_ct_path)
else:
raise Exception("Couldn't find the cell type annotation config file (with yaml or yml extension) in folder: " + input)

if user_config_path:
user_file_name = os.path.splitext(os.path.basename(user_data_path))[0]
std_data = ingest_user_data(user_data_path, user_config_path)
else:
raise Exception("Couldn't find the config data files (with yaml or yml extension) in folder: " + input)
if user_config_path:
user_file_name = os.path.splitext(os.path.basename(user_data_path))[0]
std_data = ingest_user_data(user_data_path, user_config_path)
else:
raise Exception("Couldn't find the config data files (with yaml or yml extension) in folder: " + input)

accession_prefix = retrieve_accession_prefix(Path(input).parent.absolute())
std_tables = serialize_to_tables(std_data, user_file_name, input, accession_prefix)
Expand Down

0 comments on commit f3be1bc

Please sign in to comment.