no edit summary
Finally, streams of patterns can be combined. For example, let’s say we want to find all pairs of calcium atoms that are no further than 4A apart. This can be achieved using the query <code>Near(4, Atoms('Ca'), Atoms('Ca'))</code>. So this query takes as the input two identical streams of calcium atoms and for each pair of them determines if the atoms are closer than 4A to each other. For each pair that satisfies this condition, a new pattern from the 2 atoms is created. Therefore, the result of the above <code>[[PatternQuery:Language_Reference#Near | Near()]]</code> query is a stream of sets of atoms (patterns) that each contain two calcium atoms that are no further than 4A from each other:
With these basic types of queries outlined in the previous paragraphs, the sky's the limit. Due to the composable nature of the language if a new type of
motif emerges, only a single function needs to be added to the language for it to work with all its other parts. As an example, assume we didn’t know that proteins had secondary structure called “sheet” and we just discovered it and a fancy algorithm to identify these "sheets". Now we would be interested in how this new type of protein substructure interacts with other parts of the molecule. All that would be needed is to add a function called <code>[[PatternQuery:Language_Reference#Sheets | Sheets()]]</code> to the language and immediately we would be able to analyze and filter it’s neighborhood using the functions <code>[[PatternQuery:Language_Reference#AmbientAtoms | AmbientAtoms()]]</code> and <code>[[PatternQuery:Language_Reference#Filter | Filter()]]</code>.
===A More Formal Description===