def add_sample_presence_count(feature_data, table_sdf):
    """Adds a "qurro_spc" column to a DataFrame of feature information.

       The value in this column corresponds to the number of samples a given
       feature is present in, as determined by the count data given in the
       table_sdf argument.

       Parameters
       ----------

       feature_data: pd.DataFrame
            A DataFrame containing some sort of feature information. At the
            point in Qurro this is called, this will likely include both
            feature ranking information and feature metadata information.

       table_sdf: pd.SparseDataFrame
            Representation of a BIOM table containing count data. The index
            contains feature IDs, and the columns contain sample IDs.
            This table should only contain samples that will be used in the
            Qurro visualization (i.e. this table should be the output of all
            the matching, filtering, removing empty, etc. steps), since the
            presence of irrelevant samples will result in inaccurate SPC values
            being computed.

       Returns
       -------

       output_feature_data: pd.DataFrame
            feature_data, with a qurro_spc column added.

       Raises
       ------

       ValueError: if feature_data already contains a column named "qurro_spc".
                   (Assuming you've already called check_column_names() on this
                   data this shouldn't be a problem, but this checks anyway.)
    """
    table_pa = table_sdf.mask(table_sdf > 0, 1)
    spc_series = table_pa.sum(axis='columns')
    spc_series.name = 'qurro_spc'
    return feature_data.merge(spc_series, how='left', left_index=True,
        right_index=True, suffixes=(False, False))
