How to select atom and edit sets in scripting?

I have a .xsd file, including methane molecules and kerogen structure, which was obtained from the Sorption Fixed pressure calculation. I am wondering how to select all the methane molecules and edit sets "methane" in scripting.

Thanks!