Skip to content

Commit

Permalink
add check for single sample input with no db provided
Browse files Browse the repository at this point in the history
  • Loading branch information
j-andrews7 committed Nov 16, 2024
1 parent 92ded6d commit 49e12b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion strprofiler/strprofiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,17 @@ def strprofiler(

samps = df.to_dict(orient="index")
summaries = []

# If fewer than 2 samples and no database provided, exit.
if len(samps) < 2 and database is None:
print("Only 1 sample provided and no database for comparison, exiting.")
print("Only 1 sample provided and no database for comparison, exiting.", file=log_file)
log_file.close()
return

# Database ingress, if present
# Set 'reference' for subsequent query to either database or inputs all to all
if database is not None:
# load_database(database)
df_db = utils.str_ingress(
paths=[database],
sample_col=sample_col,
Expand Down
2 changes: 2 additions & 0 deletions tests/ExampleSTR_long_1samp.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sample Name,marker1,marker2,marker4,Penta D,Penta E,AMEL
SampleA,"12, 14",12,"13,13","9,10","12,14",X

0 comments on commit 49e12b7

Please sign in to comment.