Expression seems not to be raw count but count + 1
#2
by
RaphaelMourad
- opened
Hi @RaphaelMourad , thanks for checking out our dataset! We have provided the data as a paired list of gene-IDs and raw counts. For instance for the first record in the dataset, you have:
{'genes': [1, 5,19,21,31,56,68, ...],
'expressions': [-2.0,1.0,1.0,1.0,1.0,1.0,...],
'drug': '8-Hydroxyquinoline',
'sample': 'smp_1783',
'BARCODE_SUB_LIB_ID': '01_001_052-lib_1105',
}
The first entry in both genes
and expressions
is a special start of sequence token and can be ignored. This record should be read as: Genes with ID 5,19,21,31,56,68 have a count of 1. All of the genes not present in the genes
list have a count of zero. This representation is just another way to store sparse count data.
To get the full dense vector for this record you can do the following:
# Get the token-ID to gene-ID mapping table
gene_metadata = load_dataset("vevotx/Tahoe-100M", name="gene_metadata", split="train").to_pandas()
gene_id_mapping = dict(zip(gene_metadata["token_id"].values,gene_metadata.index.values))
# Create an array of zeros with all 62,710 genes
expressions = np.zeros(len(gene_id_mapping))
# Fill in the values for tokens 5,19,21,31.. with their corresponding expression value
expressions[list(map(gene_id_mapping.get, row["genes"][1:]))] = row["expressions"][1:]
The vector you'll get this way will be mostly zero as you expect:
array([0., 0., 1., ..., 0., 0., 0.])
Thanks that's very clear.