Skip to content

Commit

Permalink
fixed nb and entry int conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
farchaab committed Nov 6, 2023
1 parent 04f418c commit 800f44b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions assembly_finder/bin/find_assemblies.smk
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,10 @@ for key, val in zip(param_keys, param_values):

# Check if input is file
if os.path.isfile(inp):
entry_dic = pd.read_csv(inp, sep="\t").to_dict()
entry_dt = pd.read_csv(inp, sep="\t").to_dict()
# replace empty values with default ones or first entry for the param
entry_dic = empty_to_val | entry_dic
entry_df = pd.DataFrame.from_dict(entry_dic).dropna(subset="entry")
entry_df["entry"] = [int(entry) for entry in entry_df["entry"]]
entry_df["nb"] = [int(nb) for nb in entry_df["nb"]]
entry_dt = empty_to_val | entry_dt
entry_df = pd.DataFrame.from_dict(entry_dt).dropna(subset="entry")


# If not create the dataframe
Expand All @@ -81,7 +79,10 @@ else:
entry_df = entry_df.replace(
empty_to_val,
).dropna()

entry_df["nb"] = [int(nb) if isinstance(nb, int) else nb for nb in entry_df["nb"]]
entry_df["entry"] = [
int(entry) if isinstance(entry, float) else entry for entry in entry_df["entry"]
]
# entry_df.to_csv("entry.tsv", sep="\t")
# Set entry as index
entry_df = entry_df.astype({"entry": str}).set_index("entry")
Expand Down

0 comments on commit 800f44b

Please sign in to comment.