Skip to content

Commit

Permalink
reformated ingest.
Browse files Browse the repository at this point in the history
  • Loading branch information
SanjeevLakhwani committed Oct 24, 2024
1 parent dc4896f commit 805ae24
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions transcriptomics_data_service/routers/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ async def ingest(
gene_code=gene_code,
sample_id=sample_id,
experiment_result_id=experiment_result_id,
raw_count=raw_count
raw_count=raw_count,
)
gene_expressions.append(gene_expression)
await db.create_gene_expressions(gene_expressions, transaction_con)
return


def _load_csv(file_bytes: bytes) -> pd.DataFrame:
buffer = StringIO(file_bytes.decode("utf-8"))
buffer.seek(0)
Expand All @@ -58,13 +59,11 @@ def _load_csv(file_bytes: bytes) -> pd.DataFrame:
# Check for duplicate values in index column or header
if df.index.duplicated().any():
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Duplicate values found in the Gene ID column."
status_code=status.HTTP_400_BAD_REQUEST, detail="Duplicate values found in the Gene ID column."
)
if df.columns.duplicated().any():
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="Duplicate values found in the Sample ID row."
status_code=status.HTTP_400_BAD_REQUEST, detail="Duplicate values found in the Sample ID row."
)

try:
Expand Down

0 comments on commit 805ae24

Please sign in to comment.