Check if a string is ensembl gene id or not in python I have many scRNAseq datasets saved as hdf5 files (hierarchical data format*), and when I open them keys sometimes are confused, so I need a way of determining from string values themselves whether the array contains gene symbols or ensembl ids. What would be a regular expression in python to check for it?
*, A database format for quickly accessing large amounts of data, which is accessed using keys. The format is quicker than pickle/unpickle and can be viewed via a hdf5 viewer, a bit of info is here
Fixed it myself actually, not that hard. I found regular expression for ensembl ids here:

https://www.biostars.org/p/99142/

And used the re package in python:

import re

ensembl_regexp = 'ENS[A-Z]+[0-9]{11}'

is_ensembl = np.all([bool(re.match(ensembl_regexp, gene)) for gene in gene_symbols])
    if is_ensembl:
        gene_symbols = list(f['ensembl_ids']) 


Where gene_symbols is a numpy array that I need to check whether it has ensembl ids, and if yes, switch to using gene symbols which are going to be under ensembl_ids key due to a mistake of someone who made the hdf5 dataset.