Skip to content

Commit

Permalink
Columns outputted in order of input
Browse files Browse the repository at this point in the history
  • Loading branch information
iquasere committed Jun 22, 2023
1 parent 76decf6 commit 7914b30
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions upimapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from functools import partial
import re

__version__ = '1.11.1'
__version__ = '1.11.2'


def get_arguments():
Expand Down Expand Up @@ -469,12 +469,13 @@ def uniprot_information_workflow(
if len(taxids_cols) > 0:
tax_df = pd.concat([tax_df, make_taxonomic_lineage_df(
uniprotinfo['Taxonomic lineage (Ids)'], prefix='Taxonomic lineage IDs')], axis=1)
# remove taxonomic lineage and taxonomic lineage (ids) columns if they were not supposed to be added
for col in all_tax_cols:
if col not in tax_df.columns:
tax_df[col] = np.nan
del tax_df[col]
uniprotinfo = pd.concat([uniprotinfo, tax_df[all_tax_cols]], axis=1).rename(columns={
'Organism': 'Taxonomic lineage (SPECIES)'})
cols = list(set(result.columns.tolist() + uniprotinfo.columns.tolist()))
cols = uniprotinfo.columns.tolist() + [col for col in result.columns.tolist() if col not in uniprotinfo.columns]
if 'Taxonomic lineage (SPECIES)' in cols:
cols.remove('Taxonomic lineage (SPECIES)')
cols.append('Taxonomic lineage (SPECIES)')
Expand Down

0 comments on commit 7914b30

Please sign in to comment.