Get the number of structurally equivalent residues

@return nr of EQR
179786
public int getNrEQR(){

		if (myResultsEQR < 0){
			if ( optLen == null) {
				myResultsEQR = 0;
				return 0;
			}

			int nrEqr = 0;
			for(int bk = 0; bk < blockNum; bk ++)       {

				for ( int i=0;i< optLen[bk];i++){
					nrEqr++;
				}
			}
			myResultsEQR = nrEqr;
		}
		return myResultsEQR;
	}
1301323
public double getSumOfSquare() {
    final double tmp = sumOfSquare + sumOfSquareCompensation;
    if (Double.isNaN(tmp) && Double.isInfinite(simpleSumOfSquare)) {
      return simpleSumOfSquare;
    }
    return tmp;
  }
337307
public static List<SecStrucElement> getSecStrucElements(Structure s) {

		List<SecStrucElement> listSSE = new ArrayList<SecStrucElement>();
		GroupIterator iter = new GroupIterator(s);

		// SecStruc information - initialize
		SecStrucType type = SecStrucType.coil;
		ResidueNumber previous = new ResidueNumber();
		ResidueNumber start = new ResidueNumber();
		String chainId = "";
		int count = 0; // counts the number of residues in SSE

		// Create a map for the IDs of the SSE in the structure
		Map<SecStrucType, Integer> ids = new TreeMap<SecStrucType, Integer>();
		for (SecStrucType t : SecStrucType.values())
			ids.put(t, 1);

		while (iter.hasNext()) {
			Group g = iter.next();

			if (g.hasAminoAtoms()) {
				Object p = g.getProperty(Group.SEC_STRUC);
				if (p == null)
					continue;
				SecStrucInfo ss = (SecStrucInfo) p;

				if (count > 0) {
					// If chain and type are equal increment counter
					if (ss.type == type && chainId == g.getChainId()) {
						previous = g.getResidueNumber();
						count++;
						continue;
					} else {
						// Save the current SSE if chain or type change
						SecStrucElement sse = new SecStrucElement(type, start,
								previous, count, ids.get(type), chainId);
						listSSE.add(sse);
						ids.put(type, ids.get(type) + 1);
						count = 0;

						// Initialize a new SSE one
						if (ss.type != SecStrucType.coil) {
							type = ss.type;
							start = g.getResidueNumber();
							previous = start;
							chainId = g.getChainId();
							count = 1;
						}
					}
				} else {
					// This is for the first residue only
					if (ss.type != SecStrucType.coil) {
						type = ss.type;
						start = g.getResidueNumber();
						previous = start;
						chainId = g.getChainId();
						count = 1;
					}
				}
			}
		}
		return listSSE;
	}
291663
private static int permParity(final ILigand[] ligands) {

        // count the number of swaps made by insertion sort - if duplicates
        // are fount the parity is 0
        int swaps = 0;

        for (int j = 1, hi = ligands.length; j < hi; j++) {
            ILigand ligand = ligands[j];
            int i = j - 1;
            int cmp = 0;
            while ((i >= 0) && (cmp = cipRule.compare(ligand, ligands[i])) > 0) {
                ligands[i + 1] = ligands[i--];
                swaps++;
            }
            if (cmp == 0) // identical entries
                return 0;
            ligands[i + 1] = ligand;
        }

        // odd (-1) or even (+1)
        return (swaps & 0x1) == 0x1 ? -1 : +1;
    }
1322607
def get_differing_atom_residue_ids(self, pdb_name, pdb_list = []):
        ''''''

        # partition_by_sequence is a map pdb_name -> Int where two pdb names in the same equivalence class map to the same integer (i.e. it is a partition)
        # representative_pdbs is a map Int -> pdb_object mapping the equivalence classes (represented by an integer) to a representative PDB file
        # self.pdb_name_to_structure_mapping : pdb_name -> pdb_object

        # Sanity checks
        assert(pdb_name in self.pdb_names)
        assert(set(pdb_list).intersection(set(self.pdb_names)) == set(pdb_list)) # the names in pdb_list must be in pdb_names

        # 1. Get the representative structure for pdb_name
        representative_pdb_id = self.partition_by_sequence[pdb_name]
        representative_pdb = self.representative_pdbs[representative_pdb_id]

        # 2. Get the other representative structures as dictated by pdb_list
        other_representative_pdbs = set()
        other_representative_pdb_ids = set()
        if not pdb_list:
            pdb_list = self.pdb_names
        for opdb_name in pdb_list:
            orepresentative_pdb_id = self.partition_by_sequence[opdb_name]
            other_representative_pdb_ids.add(orepresentative_pdb_id)
            other_representative_pdbs.add(self.representative_pdbs[orepresentative_pdb_id])
        other_representative_pdbs.discard(representative_pdb)
        other_representative_pdb_ids.discard(representative_pdb_id)

        # Early out if pdb_list was empty (or all pdbs were in the same equivalence class)
        if not other_representative_pdbs:
            return []

        # 3. Return all residues of pdb_name's representative which differ from all the other representatives
        differing_atom_residue_ids = set()
        for other_representative_pdb_id in other_representative_pdb_ids:
            differing_atom_residue_ids = differing_atom_residue_ids.union(set(self.differing_atom_residue_ids[(representative_pdb_id, other_representative_pdb_id)]))

        return sorted(differing_atom_residue_ids)
174292
def fix_residue_numbering(self):
        """"""

        resid_list = self.aa_resids()
        resid_set  = set(resid_list)
        resid_lst1 = list(resid_set)
        resid_lst1.sort()
        map_res_id = {}

        x = 1
        old_chain = resid_lst1[0][0]
        for resid in resid_lst1:
            map_res_id[resid] = resid[0] + '%4.i' % x
            if resid[0] == old_chain:
                x+=1
            else:
                x = 1
                old_chain = resid[0]

        atomlines = []
        for line in self.lines:
            if line[0:4] == "ATOM" and line[21:26] in resid_set and line[26] == ' ':
                lst = [char for char in line]
                #lst.remove('\n')
                lst[21:26] = map_res_id[line[21:26]]
                atomlines.append( string.join(lst,'') )
                #print string.join(lst,'')
            else:
                atomlines.append(line)

        self.lines = atomlines
        return map_res_id
884917
public int numKeys() {
        int result = basic.numKeys();
        if (chains != null)
            for (DeterministicKeyChain chain : chains)
                result += chain.numKeys();
        return result;
    }
1014950
public int getNumberOfParents() {
        BigInteger nrOfInlinks = new BigInteger("0");

        long id = this.__getId();
        Session session = this.wiki.__getHibernateSession();
        session.beginTransaction();
        Object returnValue = session.createNativeQuery("select count(inLinks) from category_inlinks where id = :id")
            .setParameter("id", id, LongType.INSTANCE)
            .uniqueResult();
        session.getTransaction().commit();

        if (returnValue != null) {
            nrOfInlinks = (BigInteger) returnValue;
        }
        return nrOfInlinks.intValue();
    }
564330
public final int getNumberOfPossibleAssignments() {
    int[] sizes = getVariableSizes();
    int numAssignments = 1;
    for (int i = 0; i < sizes.length; i++) {
      numAssignments *= sizes[i];
    }
    return numAssignments;
  }
101291
public double getLength() {
		double length = 0;
		if (!isEmpty()) {
			length = exteriorRing.getLength();
			if (interiorRings != null) {
				for (LinearRing interiorRing : interiorRings) {
					length += interiorRing.getLength();
				}
			}
		}
		return length;
	}
1318831
public long count() {
    if (SHOULD_CHECK) {
      checkNotClosed();
      txn.checkReady();
    }
    final NativeLongByReference longByReference = new NativeLongByReference();
    checkRc(LIB.mdb_cursor_count(ptrCursor, longByReference));
    return longByReference.longValue();
  }
1319384
public double getBondLength() {
        PharmacophoreAtom atom1 = PharmacophoreAtom.get(getAtom(0));
        PharmacophoreAtom atom2 = PharmacophoreAtom.get(getAtom(1));
        return atom1.getPoint3d().distance(atom2.getPoint3d());
    }
48759
private int getAromaticNitrogensCount(IAtomContainer ac, IAtom atom) {
        List<IAtom> neighbours = ac.getConnectedAtomsList(atom);
        int narocounter = 0;
        for (IAtom neighbour : neighbours) {
            if (neighbour.getSymbol().equals("N") && (Boolean) neighbour.getProperty("IS_IN_AROMATIC_RING")) {
                narocounter += 1;
            }
        }
        return narocounter;
    }
1255957
def get_number_of_atoms(self):
        
        strc = self.get_output_structure()
        if not strc:
            return None
        return Property(scalars=[Scalar(value=len(strc))], units="/unit cell")
1063068
public int equivalenceCode()
	{
		int result = 29 + SEQUENCE_POSITION;
		result = 29 * result +
			(POSITION_STATUS != null ? POSITION_STATUS.hashCode() : 0);
		return result;
	}
929157
public static int getTotalMonomerCount(PolymerNotation polymer) {
    int count = 0;
    for (MonomerNotation element : polymer.getPolymerElements().getListOfElements()) {
      count += getMonomerCountFromMonomerNotation(element);
    }
    return count;
  }
1077389
public List<Double> getRDBEValue(IMolecularFormula formula) {
        List<Double> RDBEList = new ArrayList<Double>();
        // The number of combinations with repetition
        // (v+n-1)!/[n!(v-1)!]
        int nE = 0; // number of elements to change
        List<Integer> nV = new ArrayList<Integer>(); // number of valence changing
        for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
            IIsotope isotope = it.next();
            int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
            if (valence.length != 1) {
                for (int i = 0; i < valence.length; i++) {
                    nV.add(valence[i]);
                }
                nE += MolecularFormulaManipulator.getElementCount(formula,
                        formula.getBuilder().newInstance(IElement.class, isotope.getSymbol()));
            }
        }

        double RDBE = 0;
        if (nE == 0) {
            for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
                IIsotope isotope = it.next();
                int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
                double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) / 2.0;
                RDBE += value;
            }
            RDBE += 1;
            RDBEList.add(RDBE);
        } else {
            double RDBE_1 = 0;
            for (Iterator<IIsotope> it = formula.isotopes().iterator(); it.hasNext();) {
                IIsotope isotope = it.next();
                int[] valence = getOxidationState(formula.getBuilder().newInstance(IAtom.class, isotope.getSymbol()));
                double value = (valence[0] - 2) * formula.getIsotopeCount(isotope) * 0.5;
                RDBE_1 += value;
            }
            String[] valences = new String[nV.size()];
            for (int i = 0; i < valences.length; i++)
                valences[i] = Integer.toString(nV.get(i));

            Combinations c = new Combinations(valences, nE);
            while (c.hasMoreElements()) {
                double RDBE_int = 0.0;
                Object[] combo = (Object[]) c.nextElement();
                for (int i = 0; i < combo.length; i++) {
                    int value = (Integer.parseInt((String) combo[i]) - 2) / 2;
                    RDBE_int += value;
                }
                RDBE = 1 + RDBE_1 + RDBE_int;
                RDBEList.add(RDBE);
            }
        }
        return RDBEList;
    }