Actually both roasted and un-roasted coffee beans contain many of the same proteins and acids. The actual chemical reaction taking place during roasting is called a Maillard reaction. This is a browning reaction that is usually caused by heat. The actual browning is taking place because of reactions between amino acids and reducing sugars, fructose, glucose, lactose, etc., in the coffee bean. As a result is these reactions the bean changes pigment or melanoidins. Something that can also change the color of the bean, but is a totally different chemical reaction is caramelization. That happens when primarily sucrose, which is not a reducing sugar, is heated and as a result oxidizes.
Caramelization has a huge impact on the end flavors of your coffee, and if you want to be have better control over the flavors in your coffee this is an area to dive into head first. Different compounds are released at different stages in the caramelization process, which starts at 320 degrees F for sucrose. Diacetyl is the first, and it has a buttery / butterscotch flavor. Esters and lactones are next, and present with a sweet rummy flavor. Furans follow and show a nutty flavor. Maltol is next with a Toasty flavor. The process goes on and on, but if continue for too long the original food product gradually becomes less and less sweet and more and more bitter.
These two processes are totally different with one being a reaction between amino acids and reducing sugars and the other being a reaction involving just the breakdown of sugar with heat.
Sorry for the rant. I have an Organic Chemistry Final on Monday and need to utilize the information I learned wherever I can
! You really do not get to many opportunities to use it in daily life. Quite frankly, one of the only things that kept me interested / studying in that class was my ability to apply what I learned to roasting itself.
Anyway, structurally a bean should be identifiable with a DNA sequencer until you reduce it to ash / carbon and it is completely burned.
You make a good point though. . . . If I roasted the beans I should probably know what is in the portafilter. Why do I need a machine to tell me . . . . Very good point. . . . That is a very expensive way to convey this information from an uninformed barista to an inquisitive customer. Also what happens if a blend in introduced into the portafilter. . . does it think it is a new DNA strain or can it ID all of them individually?!?