Commit 57f4081b authored by Francisco Arcila Salamanca's avatar Francisco Arcila Salamanca
Browse files

add provisional 10X expression parser with pandas

parent 427a7c4b
......@@ -31,7 +31,8 @@ from argparse import RawTextHelpFormatter
from scirexport.logger import logger
import scirexport.sr_tools as sr
from scirexport.importools import (
import_expression,
import_FACS_expression,
import_10X_expression,
import_repertoires,
import_rearrangements,
import_receptors,
......@@ -91,7 +92,7 @@ def main():
if DB_ARGS["ssh_group"] and "test" not in DB_ARGS["ssh_group"]:
try:
# first toplevel connection for shh tunneling
# first top-level connection for shh tunneling
server, db = sr.connect(conf_db=config_db, ssh_group=DB_ARGS["ssh_group"])
safe_create_schema(db, project_name)
server.stop()
......@@ -105,6 +106,7 @@ def main():
except Exception as error:
logger.error(f"MariaDB ERROR {error}")
raise (error)
elif DB_ARGS["ssh_group"] and "test" in DB_ARGS["ssh_group"]:
mode = "test"
......@@ -126,6 +128,7 @@ def main():
# Create database tables from templates/igdb_project.sql
c = db.cursor()
c.execute(sr.mysql_as_string(mysql_file))
db.commit()
# @@@@ get files @@@@@ #
# 1 rearrangements DF
......@@ -137,15 +140,18 @@ def main():
receptors_json = json.load(json_file)
import_receptors(receptors_json, db, mode=mode)
else:
logger.warning("receptors file was not provided no receptors will be imported")
logger.warning("No receptors file was provided. No receptors will be imported")
# 5 expression DF/s
if "expression" in files_dictionary:
expression_hdf = pd.read_csv(files_dictionary["expression"], sep="\t")
import_expression(expression_hdf, project_name, db)
if "facs" in files_dictionary["expression"].lower():
# expression_hdf = pd.read_csv(files_dictionary["expression"], sep="\t")
import_FACS_expression(files_dictionary["expression"], project_name, db)
elif "10x" in files_dictionary["expression"].lower():
import_10X_expression(files_dictionary["expression"], project_name, db)
else:
logger.warning(
"expression file was not provided no expression data will be imported"
"No expression file was provided. No expression data will be imported"
)
# 3 cells DF
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment