def calculate_start_time(df):
if "<STR_LIT:time>" in df:<EOL><INDENT>df["<STR_LIT>"] = pd.Series(df["<STR_LIT:time>"], dtype='<STR_LIT>')<EOL><DEDENT>elif "<STR_LIT>" in df:<EOL><INDENT>df["<STR_LIT>"] = pd.Series(df["<STR_LIT>"], dtype="<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return df<EOL><DEDENT>if "<STR_LIT>" in df:<EOL><INDENT>for dset in df["<STR_LIT>"].unique():<EOL><INDENT>time_zero = df.loc[df["<STR_LIT>"] == dset, "<STR_LIT>"].min()<EOL>df.loc[df["<STR_LIT>"] == dset, "<STR_LIT>"] =df.loc[df["<STR_LIT>"] == dset, "<STR_LIT>"] - time_zero<EOL><DEDENT><DEDENT>else:<EOL><INDENT>df["<STR_LIT>"] = df["<STR_LIT>"] - df["<STR_LIT>"].min()<EOL><DEDENT>return df.drop(["<STR_LIT:time>", "<STR_LIT>", "<STR_LIT>"], axis=<NUM_LIT:1>, errors="<STR_LIT:ignore>")<EOL>
Calculate the star_time per read.

    Time data is either
    a "time" (in seconds, derived from summary files) or
    a "timestamp" (in UTC, derived from fastq_rich format)
    and has to be converted appropriately in a datetime format time_arr

    For both the time_zero is the minimal value of the time_arr,
    which is then used to subtract from all other times

    In the case of method=track (and dataset is a column in the df) then this
    subtraction is done per dataset