diff --git a/bin/gvf2indexandlog.py b/bin/gvf2indexandlog.py index 3aa558b..27e3829 100755 --- a/bin/gvf2indexandlog.py +++ b/bin/gvf2indexandlog.py @@ -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'] @@ -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 @@ -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)