Skip to content

Conversation

@rnmitchell
Copy link
Contributor

Creating empty plots for samples with no reads above the detection threshold at any marker. This is to be able to evaluate negative samples (negative controls, RBs, etc.).

Comment on lines 77 to 94
system = os.name
if system == "nt":
shell("md logs\\{dt}\\Input\\")
shell('copy "{log}" logs\\{dt}\\')
shell("copy config.yaml logs\\{dt}\\")
new_file = input_name.replace("/", "\\")
if os.path.isdir(input_name):
shell('xcopy "{new_file}" logs\\{dt}\\Input')
else:
shell('copy "{new_file}" logs\\{dt}\\Input\\')
else:
shell("cp '{input_name}' logs/{dt}/input/")
shell("cp config.yaml logs/{dt}/")
shell("mkdir -p logs/{dt}/input/")
shell("cp '{log}' logs/{dt}/")
if os.path.isdir(input_name):
shell("cp '{input_name}'/*.* logs/{dt}/input/")
else:
shell("cp '{input_name}' logs/{dt}/input/")
shell("cp config.yaml logs/{dt}/")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@standage I've added this to account for the different code required for a Mac/linux vs. windows os... is this kosher or not a good strategy to deal with it? This is the only difference between the Mac and windows version.

Copy link
Member

@standage standage Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these shell commands has equivalents in pathlib. Let me see if I can replicate it...

from shutil import copy


input_name = Path(input_name)
dtdir = Path("logs") / dt
logdir = dtdir / "input"
logdir.mkdir(parents=True, exist_ok=True)
copy(log, logdir / log)
if input_name.is_dir():
    for path in input_name.glob("*.*"):
        copy(path, logdir / path.name)
else:
    copy(input_name, logdir / input_name.name
copy("config.yaml", dtdir / "config.yaml")

That should work cross-platform.

Comment on lines -129 to 143

selected = option_menu(
menu_title=None,
options=["Home", "STRs", "SNPs", "How to Use", "Contact"],
icons=["house", "gear", "gear-fill", "book", "envelope"],
menu_icon="cast",
default_index=0,
orientation="horizontal",
)
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Home", "STRs", "SNPs", "How To Use", "Contact"])

if selected == "Home":
with tab1:
show_home_page()

elif selected == "STRs":
with tab2:
show_STR_page()

elif selected == "SNPs":
with tab3:
show_SNP_page()

elif selected == "How to Use":
with tab4:
show_how_to_use_page()

elif selected == "Contact":
with tab5:
show_contact_page()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More changes to account for compatibility with Windows (the streamlit_option_menu package didn't work on Windows).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, more concise.

@rnmitchell rnmitchell marked this pull request as ready for review July 18, 2025 18:07
Copy link
Member

@standage standage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok overall, but I suggested a pure Python solution for copying the logs that should work across platforms.

Comment on lines -129 to 143

selected = option_menu(
menu_title=None,
options=["Home", "STRs", "SNPs", "How to Use", "Contact"],
icons=["house", "gear", "gear-fill", "book", "envelope"],
menu_icon="cast",
default_index=0,
orientation="horizontal",
)
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Home", "STRs", "SNPs", "How To Use", "Contact"])

if selected == "Home":
with tab1:
show_home_page()

elif selected == "STRs":
with tab2:
show_STR_page()

elif selected == "SNPs":
with tab3:
show_SNP_page()

elif selected == "How to Use":
with tab4:
show_how_to_use_page()

elif selected == "Contact":
with tab5:
show_contact_page()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, more concise.

Comment on lines 219 to 218
sample_df = np.where(
sample_df["Locus"] == "AMELOGENIN",
np.where(sample_df["CE_Allele"] == "X", 0, 1),
sample_df["CE_Allele"],
)
#sample_df = np.where(
# sample_df["Locus"] == "AMELOGENIN",
# np.where(sample_df["CE_Allele"] == "X", "0.0", "1.0"),
# sample_df["CE_Allele"],
#)
for i, row in sample_df.iterrows():
if row["Locus"] == "AMELOGENIN":
sample_df.loc[i, "CE_Allele"] = 0 if row.CE_Allele == "X" else 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's figure out what to do with the commented out code before we merge.

Comment on lines 77 to 94
system = os.name
if system == "nt":
shell("md logs\\{dt}\\Input\\")
shell('copy "{log}" logs\\{dt}\\')
shell("copy config.yaml logs\\{dt}\\")
new_file = input_name.replace("/", "\\")
if os.path.isdir(input_name):
shell('xcopy "{new_file}" logs\\{dt}\\Input')
else:
shell('copy "{new_file}" logs\\{dt}\\Input\\')
else:
shell("cp '{input_name}' logs/{dt}/input/")
shell("cp config.yaml logs/{dt}/")
shell("mkdir -p logs/{dt}/input/")
shell("cp '{log}' logs/{dt}/")
if os.path.isdir(input_name):
shell("cp '{input_name}'/*.* logs/{dt}/input/")
else:
shell("cp '{input_name}' logs/{dt}/input/")
shell("cp config.yaml logs/{dt}/")
Copy link
Member

@standage standage Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of these shell commands has equivalents in pathlib. Let me see if I can replicate it...

from shutil import copy


input_name = Path(input_name)
dtdir = Path("logs") / dt
logdir = dtdir / "input"
logdir.mkdir(parents=True, exist_ok=True)
copy(log, logdir / log)
if input_name.is_dir():
    for path in input_name.glob("*.*"):
        copy(path, logdir / path.name)
else:
    copy(input_name, logdir / input_name.name
copy("config.yaml", dtdir / "config.yaml")

That should work cross-platform.

Comment on lines 320 to 322
# if df[df["SampleID"] == sample_id].empty:
# print(f"{sample_id} does not have any reads passing filter. Skipping to next sample.")
# else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here.

@standage standage merged commit f40d3d5 into master Jul 21, 2025
2 checks passed
@standage standage deleted the empty_markerplots branch July 21, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants