Finds two Protein that appear together in a Complex.
@return the pattern
436652
public static Pattern bindsTo()
	{
		Pattern p = new Pattern(ProteinReference.class, "first PR");
		p.add(erToPE(), "first PR", "first simple PE");
		p.add(linkToComplex(), "first simple PE", "Complex");
		p.add(new Type(Complex.class), "Complex");
		p.add(linkToSpecific(), "Complex", "second simple PE");
		p.add(peToER(), "second simple PE", "second PR");
		p.add(equal(false), "first PR", "second PR");
		return p;
	}
978250
public static Collection<BioEntityMention> getProteins(
            Collection<BioEntityMention> mentions) {
        ArrayList<BioEntityMention> ret = new ArrayList<BioEntityMention>();
        for (BioEntityMention mention : mentions) {
            if (mention.getSpecificType() != null
                    && mention.getSpecificType().startsWith("G#protein"))
                ret.add(mention);
        }
        return ret;
    }
1276655
public Pair<String> getCrystalIds() {
		return new Pair<>(
			moleculeIds.getFirst()+transforms.getFirst().getTransformId()+transforms.getFirst().getCrystalTranslation(),
			moleculeIds.getSecond()+transforms.getSecond().getTransformId()+transforms.getSecond().getCrystalTranslation());
	}
990486
public Stream<HString> findAllPatterns(@NonNull Pattern regex) {
      return Streams.asStream(new Iterator<HString>() {
         Matcher m = regex.matcher(HString.this);
         int start = -1;
         int end = -1;

         private boolean advance() {
            if (start == -1) {
               if (m.find()) {
                  start = m.start();
                  end = m.end();
               }
            }
            return start != -1;
         }

         @Override
         public boolean hasNext() {
            return advance();
         }

         @Override
         public HString next() {
            if (!advance()) {
               throw new NoSuchElementException();
            }
            HString sub = substring(start, end);
            start = -1;
            end = -1;
            //If we have tokens expand the match to the overlaping tokens.
            if (document() != null && document().isCompleted(Types.TOKEN)) {
               return union(sub.tokens());
            }
            return sub;
         }
      });
   }
501899
public double[] findGridBoundaries() {
        IAtom[] atoms = AtomContainerManipulator.getAtomArray(protein);
        double[] minMax = new double[6];
        minMax[0] = atoms[0].getPoint3d().x;
        minMax[1] = atoms[0].getPoint3d().x;
        minMax[2] = atoms[0].getPoint3d().y;
        minMax[3] = atoms[0].getPoint3d().y;
        minMax[4] = atoms[0].getPoint3d().z;
        minMax[5] = atoms[0].getPoint3d().z;
        for (int i = 0; i < atoms.length; i++) {
            if (atoms[i].getPoint3d().x > minMax[1]) {
                minMax[1] = atoms[i].getPoint3d().x;
            } else if (atoms[i].getPoint3d().y > minMax[3]) {
                minMax[3] = atoms[i].getPoint3d().y;
            } else if (atoms[i].getPoint3d().z > minMax[5]) {
                minMax[5] = atoms[i].getPoint3d().z;
            } else if (atoms[i].getPoint3d().x < minMax[0]) {
                minMax[0] = atoms[i].getPoint3d().x;
            } else if (atoms[i].getPoint3d().y < minMax[2]) {
                minMax[2] = atoms[i].getPoint3d().y;
            } else if (atoms[i].getPoint3d().z < minMax[4]) {
                minMax[4] = atoms[i].getPoint3d().z;
            }
        }
        return minMax;
    }
1238867
def getpeptides(self, chain):
        
        all_from_chain = [o for o in pybel.ob.OBResidueIter(
            self.proteincomplex.OBMol) if o.GetChain() == chain]  # All residues from chain
        if len(all_from_chain) == 0:
            return None
        else:
            non_water = [o for o in all_from_chain if not o.GetResidueProperty(9)]
            ligand = self.extract_ligand(non_water)
            return ligand
916476
public static Map<BioPAXElement, List<Match>> search(Model model, Pattern pattern)
	{
		return search(model, pattern, null);
	}
417707
public function getPattern()
    {
        if ($this->_pattern === null) {
            $this->_pattern = $this->extractTag('pattern');
        }

        return $this->_pattern;
    }
518898
public static Pattern chemicalAffectsProteinThroughBinding(Blacklist blacklist)
	{
		Pattern p = new Pattern(SmallMoleculeReference.class, "SMR");
		p.add(erToPE(), "SMR", "SPE1");
		p.add(notGeneric(), "SPE1");
		if (blacklist != null) p.add(new NonUbique(blacklist), "SPE1");
		p.add(linkToComplex(), "SPE1", "PE1");
		p.add(new PathConstraint("PhysicalEntity/componentOf"), "PE1", "Complex");
		p.add(new PathConstraint("Complex/component"), "Complex", "PE2");
		p.add(equal(false), "PE1", "PE2");
		p.add(linkToSpecific(), "PE2", "SPE2");
		p.add(new Type(SequenceEntity.class), "SPE2");
		p.add(peToER(), "SPE2", "generic ER");
		p.add(linkedER(false), "generic ER", "ER");
		return p;
	}
114632
public static <T extends Tree> Matcher<T> packageMatches(Pattern pattern) {
    return (tree, state) -> pattern.matcher(getPackageFullName(state)).matches();
  }
1093886
public R getMatch() {
    for (Pattern<T, R> pattern : patterns) {
      if (pattern.matches(value)) {
        return pattern.apply(value);
      }
    }

    throw new MatchException("No match found for " + value);
  }
250662
private List<List<Atom[]>> getMatchedAtomsOfLinkages(
			ModificationCondition condition, Map<Component, Set<Group>> mapCompGroups) {
		List<ModificationLinkage> linkages = condition.getLinkages();
		int nLink = linkages.size();

		List<List<Atom[]>> matchedAtomsOfLinkages =
				new ArrayList<List<Atom[]>>(nLink);

		for (int iLink=0; iLink<nLink; iLink++) {
			ModificationLinkage linkage = linkages.get(iLink);
			Component comp1 = linkage.getComponent1();
			Component comp2 = linkage.getComponent2();

//			boolean isAA1 = comp1.;
//			boolean isAA2 = comp2.getType()==true;

			Set<Group> groups1 = mapCompGroups.get(comp1);
			Set<Group> groups2 = mapCompGroups.get(comp2);

			List<Atom[]> list = new ArrayList<Atom[]>();

			List<String> potentialNamesOfAtomOnGroup1 = linkage.getPDBNameOfPotentialAtomsOnComponent1();
			for (String name : potentialNamesOfAtomOnGroup1) {
				if (name.equals("*")) {
					// wildcard
					potentialNamesOfAtomOnGroup1 = null; // search all atoms
					break;
				}
			}

			List<String> potentialNamesOfAtomOnGroup2 = linkage.getPDBNameOfPotentialAtomsOnComponent2();
			for (String name : potentialNamesOfAtomOnGroup2) {
				if (name.equals("*")) {
					// wildcard
					potentialNamesOfAtomOnGroup2 = null; // search all atoms
					break;
				}
			}

			for (Group g1 : groups1) {
				for (Group g2 : groups2) {
					if (g1.equals(g2)) {
						continue;
					}

					// only for wildcard match of two residues
					boolean ignoreNCLinkage =
						potentialNamesOfAtomOnGroup1 == null &&
						potentialNamesOfAtomOnGroup2 == null &&
						residues.contains(g1) &&
						residues.contains(g2);

					Atom[] atoms = StructureUtil.findNearestAtomLinkage(
							g1, g2,
							potentialNamesOfAtomOnGroup1,
							potentialNamesOfAtomOnGroup2,
							ignoreNCLinkage,
							bondLengthTolerance);
					if (atoms!=null) {
						list.add(atoms);
					}
				}
			}

			if (list.isEmpty()) {
				// broken linkage
				break;
			}

			matchedAtomsOfLinkages.add(list);
		}

		return matchedAtomsOfLinkages;
	}
18271
public static Pattern inSameActiveComplex()
	{
		Pattern p = inSameComplex();
		p.add(new ActivityConstraint(true), "Complex");
		return p;
	}
302214
public static AFPChain fastaToAfpChain(String sequence1, String sequence2, Structure structure1,
			Structure structure2) throws StructureException, CompoundNotFoundException {
		ProteinSequence s1 = new ProteinSequence(sequence1);
		s1.setUserCollection(getAlignedUserCollection(sequence1));
		ProteinSequence s2 = new ProteinSequence(sequence2);
		s2.setUserCollection(getAlignedUserCollection(sequence2));
		return fastaToAfpChain(s1, s2, structure1, structure2);
	}
1369515
@Override
	public Pattern constructPattern()
	{
		Pattern p = PatternBox.controlsStateChangeButIsParticipant();
		p.add(new Type(ProteinReference.class), "controller ER");
		p.add(new Type(ProteinReference.class), "changed ER");
		return p;
	}
930542
public String getProteinSequenceString() {

		if (sequence != null)
			return sequence.toString();

		StringBuilder builder = new StringBuilder();
		for (Atom a : reprAtoms)
			// This method preferred over getChemComp.getOneLetterCode because
			// it returns always X for Unknown residues
			builder.append(StructureTools.get1LetterCode(a.getGroup()
					.getPDBName()));

		return builder.toString();
	}
1035210
protected String getGeneSymbol(Match m, String label)
	{
		ProteinReference pr = (ProteinReference) m.get(label, getPattern());
		return getGeneSymbol(pr);
	}