tlubitz / SBtab

SBtab - Table format for Systems Biology:
www.sbtab.net
MIT License
6 stars 8 forks source link

SBtab header is printed incorrectly #81

Closed eladnoor closed 4 years ago

eladnoor commented 4 years ago

When creating a new SBtab (e.g. from a dataframe), the header row prints empty strings incorrectly (only a single quote, instead of a pair of single quotes). In addition, when changing the "Unit" attribute, the "SBtabVersion" is somehow overridden and the "1.0" appears right after the unit.

To recreate the bug:

from sbtab import SBtab
import pandas as pd

df = pd.DataFrame([["glucose", 121.4], ["galactose", 141.7]],
                  columns=["compound_name", "dG0_prime"])

sbtab = SBtab.SBtabTable.from_data_frame(
    df, table_id="Compound",
    table_type="Compound")

sbtab.change_attribute("Unit", "kJ/mol")
print(sbtab.to_str())

the result is:

!!SBtab TableID='Compound' TableType='Compound' TableName='Compound' DocumentName=' Document=' Unit='kJ/mol'1.0' Date='2019-11-27'
!compound_name  !dG0_prime
glucose 121.4
galactose   141.7
eladnoor commented 4 years ago

Thanks. Would you mind making a new pypi version with this patched?

tlubitz commented 4 years ago

I'll do that! But only next week, as I am close to being out of office today. Have a nice weekend, Timo

tlubitz commented 4 years ago

Okay, I updated the installer. Closing this for now...