Skip to content

Commit

Permalink
removed warning from gget cbio; updated output csv name for gget cosm…
Browse files Browse the repository at this point in the history
…ic for gget mutate
  • Loading branch information
josephrich98 committed Oct 13, 2024
1 parent 71878a4 commit 7326da0
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 245 deletions.
6 changes: 3 additions & 3 deletions gget/gget_cbio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@


if not hasattr(pd.DataFrame, "map"):
logger.info(
"Old pandas version detected. Patching DataFrame.map to DataFrame.applymap"
)
# logger.warning(
# "Old pandas version detected. Patching DataFrame.map to DataFrame.applymap"
# )
pd.DataFrame.map = pd.DataFrame.applymap


Expand Down
36 changes: 21 additions & 15 deletions gget/gget_cosmic.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,16 @@ def select_reference(

overwrite = True
if os.path.exists(file_path):
proceed = (
input(
"The requested COSMIC database already exists at the destination. Would you like to overwrite the existing files (y/n)? "
if not email and not password:
proceed = (
input(
"The requested COSMIC database already exists at the destination. Would you like to overwrite the existing files (y/n)? "
)
.strip()
.lower()
)
.strip()
.lower()
)
else:
proceed = "yes"
if proceed in ["yes", "y"]:
overwrite = True
else:
Expand All @@ -178,13 +181,16 @@ def select_reference(

# Download full databases
else:
proceed = (
input(
"Downloading complete databases from COSMIC requires an account (https://cancer.sanger.ac.uk/cosmic/register; free for academic use, license for commercial use).\nWould you like to proceed (y/n)? "
if email and password:
proceed = "yes"
else:
proceed = (
input(
"Downloading complete databases from COSMIC requires an account (https://cancer.sanger.ac.uk/cosmic/register; free for academic use, license for commercial use).\nWould you like to proceed (y/n)? "
)
.strip()
.lower()
)
.strip()
.lower()
)
if proceed in ["yes", "y"]:
download_reference(download_link, tar_folder_path, file_path, verbose, email = email, password = password)
else:
Expand Down Expand Up @@ -293,8 +299,8 @@ def cosmic(
f"Parameter 'mutation_class' must be one of the following: {', '.join(mut_class_allowed)}.\n"
)

grch_allowed = [37, 38]
if grch_version not in grch_allowed:
grch_allowed = ['37', '38']
if str(grch_version) not in grch_allowed:
raise ValueError(
f"Parameter 'grch_version' must be one of the following: {', '.join(grch_allowed)}.\n"
)
Expand Down Expand Up @@ -530,7 +536,7 @@ def cosmic(
df = df.drop_duplicates(subset=["seq_ID", "mutation"], keep="first")
df = df.drop(columns=["non_na_count"])

mutate_csv_out = mutation_tsv_file.replace(".tsv", "_gget_mutate.csv")
mutate_csv_out = mutation_tsv_file.replace(".tsv", "_mutation_workflow.csv")
df.to_csv(mutate_csv_out, index=False)

if verbose:
Expand Down
Loading

0 comments on commit 7326da0

Please sign in to comment.