Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around the missing source name in partial SDRF file #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ParsingModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,9 @@ def convert_df(df):
factor_value_cols = sorted([i for i in cols if i.startswith("factor")])
#get all columns that don't start with "characteristic" or "comment"
other_cols = [i for i in cols if i not in characteristic_cols and i not in comment_cols and i not in factor_value_cols and i not in ["source name"]]
#reorder the columns
#reorder the columns, add "source name" if it is missing
if "source name" not in df:
df["source name"] = ""
new_cols = ["source name"] + characteristic_cols + other_cols + comment_cols + factor_value_cols
df = df[new_cols]
#if a column name contains _ followed by a number, remove the underscore and the number
Expand Down