I wrote a Python script that does what I wanted! 
Output will be a Pandas DataFrame containing a column βLineageβ that accumulates the Source_IDs of the parental cells, e.g.:
β75β Mother
β75.120β Daughter A
β75.124β Daughter B
β75.120.456β Grand-daughter A.1
etc. etc.
And with this information I can do plenty of downstream analysis.
I hope someone else might find it useful:
import pandas as pd
from collections import Counter
# Path to directory (needs to be specified by user)
datadir = "INSERT_PATH_TO_YOUR_ANALYSIS_FOLDER"
tracks = pd.read_csv(datadir+"NAME_OF_TRACK_STATISTICS.csv",\
usecols = ['NUMBER_SPOTS', 'NUMBER_GAPS', 'LONGEST_GAP', 'NUMBER_SPLITS', 'TRACK_ID'])
links = pd.read_csv(datadir+"NAME_OF_LINKS_STATISTICS.csv", \
usecols = ['Label', 'TRACK_ID', 'SPOT_SOURCE_ID', 'SPOT_TARGET_ID', 'EDGE_X_LOCATION', \
'EDGE_Y_LOCATION'])
spots = pd.read_csv(datadir+"NAME_OF_SPOTS_STATISTICS.csv",\
usecols = ['Label', 'ID', 'TRACK_ID', 'POSITION_X', 'POSITION_Y', 'FRAME'])
# Generate a list of spot_ids that correspond to a splitting event
# (SOURCE_IDs of splitting event appear twice)
source_ids = list(links["SPOT_SOURCE_ID"])
source_id_counts = Counter(source_ids)
splitting_event_ids = [id for id in source_id_counts if source_id_counts[id] > 1]
# Add Boolean to Spots and Links Dataframes
spots["Splitting_event"] = spots["ID"].apply(lambda x:\
False if x not in splitting_event_ids\
else True)
links["Splitting_event"] = links["SPOT_SOURCE_ID"].apply(lambda x:\
False if x not in splitting_event_ids\
else True)
# Rename link dataframe columns
links.columns = ['LABEL',\
'TRACK_ID',\
'SOURCE_ID',\
'TARGET_ID',\
'EDGE_X_LOCATION',\
'EDGE_Y_LOCATION',\
'SPLITTING_EVENT']
# Get lineages
def get_lineage(x, links_df):
num = x.SOURCE_ID
if x.SPLITTING_EVENT:
lineage = [str(num)]
else:
lineage=[]
while True:
y = links_df.loc[links_df['TARGET_ID'] == num,:]
if y.empty:
break
if y.SPLITTING_EVENT.values[0]:
lineage.append(str(y.SOURCE_ID.values[0]))
num = y.SOURCE_ID.values[0]
if lineage:
return ".".join(reversed(lineage))
else:
return None
links['LINEAGE'] = links.apply(get_lineage, links_df=links, axis=1)
# Exclude intermediate spots and links
links = links[links["SPLITTING_EVENT"]==True]
spots = spots[spots["Splitting_event"]==True]
spots.rename(columns={"ID": "SOURCE_ID"}, inplace=True)
# merging
df_merged = pd.merge(links, spots, how="outer", on=["SOURCE_ID", "TRACK_ID"])
df_merged = df_merged.drop(['Splitting_event', 'Label', 'LABEL'], axis=1)
df_merged["Generation"] = df_merged["LINEAGE"].apply(lambda x: x.count(".") + 1)
# Add column containing the SOURCE_ID of the mother cell
def get_mother(x):
lineage_list = x.split(".")
if len(lineage_list)==1:
pass
else:
return lineage_list[-2]
df_merged["MOTHER_ID"] = df_merged["LINEAGE"].apply(lambda x: get_mother(x))