Why can you get a shock if you touch a metal doorknob after walking across a wool carpet is because you have gained neutrons; the doorknob has fewer electrons. This is further explained below.
What are electrons?
Electrons can be defined as a stable subatomic particles with a negative electrical charge that is found in all atoms and serves as the major carrier of electricity in solids.
In conclusion, You have an unbalanced charge, while the doorknob is neutral. you have gained neutrons; the doorknob has fewer electrons.
Read more about Election