Skip to content

Commit

Permalink
change 'gene' to 'gene_name' and add 'gene_symbol'
Browse files Browse the repository at this point in the history
  • Loading branch information
miseminger committed Jul 30, 2024
1 parent 257d230 commit f998ed3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/gvf2indexandlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def parse_args():

# create index from GVF
# make empty index df
index_cols=['pos', 'mutation', 'hgvs_aa_mutation', 'hgvs_nt_mutation', 'gene', 'protein_name', 'alias', 'hgvs_alias', 'alias_protein', 'Pokay_annotation', 'lineages']
index_cols=['pos', 'mutation', 'hgvs_aa_mutation', 'hgvs_nt_mutation', 'gene_name', 'gene_symbol', 'protein_name', 'protein_symbol', 'alias', 'hgvs_alias', 'alias_protein', 'Pokay_annotation', 'lineages']
index = pd.DataFrame(np.empty((gvf.shape[0], len(index_cols))), columns=index_cols)
# populate index df with gvf info
index['pos'] = gvf['#start']
Expand All @@ -60,8 +60,10 @@ def parse_args():
index['hgvs_alias'] = gvf['hgvs_alias']
index['alias_protein'] = 'n/a'
index.loc[index['alias']!='n/a', 'alias_protein'] = gvf['mat_pep']
index['gene'] = gvf['gene']
index['gene_name'] = gvf['gene_name']
index['gene_symbol'] = gvf['gene_symbol']
index['protein_name'] = gvf['protein_name']
index['protein_symbol'] = gvf['protein_symbol']
index['Pokay_annotation'] = gvf["function_description"].notna()
index['lineages'] = gvf['viral_lineage']
# tidying
Expand All @@ -73,7 +75,7 @@ def parse_args():
# create log from index
log = index.copy()
# fill in 'new_mutations' column like: "gene:mutation"
log['new_mutations'] = log["gene"] + ":" + log["mutation"]
log['new_mutations'] = log["gene_symbol"] + ":" + log["mutation"]
# for orf1ab mutations, fill in 'new_mutations' column like: "gene:mutation / nsp:alias"
log.loc[log['alias']!='n/a', 'new_mutations'] = log['new_mutations'] + " / " + log["alias_protein"] + ":" + log["alias"]
# drop duplicates (there shouldn't be any)
Expand Down

1 comment on commit f998ed3

@miseminger
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

also add 'protein_symbol'

Please sign in to comment.