📄 alogp.java
字号:
}
if (hybrid.equals("sp3") && OxNum == 1) {
frags[86]++;
alogpfrag[i] = 86;
} else if (hybrid.equals("sp3") && OxNum == 2) {
frags[87]++;
alogpfrag[i] = 87;
} else if (hybrid.equals("sp3") && OxNum == 3) {
frags[88]++;
alogpfrag[i] = 88;
} else if (hybrid.equals("sp2") && OxNum == 1) {
frags[89]++;
alogpfrag[i] = 89;
} else if ((hybrid.equals("sp2") && OxNum > 1)
|| (hybrid.equals("sp") && OxNum >= 1)
|| (hybrid.equals("sp3") && OxNum == 4)
|| !ca0.getSymbol().equals("C")) {
frags[90]++;
alogpfrag[i] = 90;
}
}
private void calcGroup091_to_095(int i) {
if (!fragment[i].equals("SsBr"))
return;
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ca0 = (IAtom)ca.get(0);
java.util.List bonds = atomContainer.getConnectedBondsList(ca0);
int doublebondcount = 0;
int triplebondcount = 0;
String hybrid = "";
for (int j = 0; j <= bonds.size() - 1; j++) {
IBond bj = (IBond)bonds.get(j);
if (bj.getOrder() == 2) {
doublebondcount++;
}
if (bj.getOrder() == 3) {
triplebondcount++;
}
}
if (doublebondcount == 0 && triplebondcount == 0) {
hybrid = "sp3";
} else if (doublebondcount == 1) {
hybrid = "sp2";
} else if (doublebondcount == 2 || triplebondcount == 1) {
hybrid = "sp";
}
java.util.List ca2 = atomContainer.getConnectedAtomsList(ca0);
int OxNum = 0;
for (int j = 0; j <= ca2.size() - 1; j++) {
IAtom ca2j = (IAtom)ca2.get(j);
String s = ca2j.getSymbol();
// // F,O,Cl,Br,N
// if (s.equals("F") || s.equals("O") || s.equals("Cl")
// || s.equals("Br") || s.equals("N") || s.equals("S"))
if (ap.getNormalizedElectronegativity(ca2j.getSymbol()) > 1) {
OxNum += atomContainer.getBond(ca0, ca2j).getOrder();
}
}
if (hybrid.equals("sp3") && OxNum == 1) {
frags[91]++;
alogpfrag[i] = 91;
} else if (hybrid.equals("sp3") && OxNum == 2) {
frags[92]++;
alogpfrag[i] = 92;
} else if (hybrid.equals("sp3") && OxNum == 3) {
frags[93]++;
alogpfrag[i] = 93;
} else if (hybrid.equals("sp2") && OxNum == 1) {
frags[94]++;
alogpfrag[i] = 94;
} else if ((hybrid.equals("sp2") && OxNum > 1)
|| (hybrid.equals("sp") && OxNum >= 1)
|| (hybrid.equals("sp3") && OxNum == 4)
|| !ca0.getSymbol().equals("C")) {
frags[95]++;
alogpfrag[i] = 95;
}
}
private void calcGroup096_to_100(int i) {
if (!fragment[i].equals("SsI"))
return;
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ca0 = (IAtom)ca.get(0);
java.util.List bonds = atomContainer.getConnectedBondsList(ca0);
int doublebondcount = 0;
int triplebondcount = 0;
String hybrid = "";
for (int j = 0; j <= bonds.size() - 1; j++) {
IBond bj = (IBond)bonds.get(j);
if (bj.getOrder() == 2) {
doublebondcount++;
}
else if (bj.getOrder() == 3) {
triplebondcount++;
}
}
if (doublebondcount == 0 && triplebondcount == 0) {
hybrid = "sp3";
} else if (doublebondcount == 1) {
hybrid = "sp2";
} else if (doublebondcount == 2 || triplebondcount == 1) {
hybrid = "sp";
}
java.util.List ca2 = atomContainer.getConnectedAtomsList(ca0);
int OxNum = 0;
for (int j = 0; j <= ca2.size() - 1; j++) {
IAtom ca2j = (IAtom)ca2.get(j);
String s = ca2j.getSymbol();
// // F,O,Cl,Br,N
// if (s.equals("F") || s.equals("O") || s.equals("Cl")
// || s.equals("Br") || s.equals("N") || s.equals("S"))
if (ap.getNormalizedElectronegativity(ca2j.getSymbol()) > 1) {
OxNum += atomContainer.getBond(ca0, ca2j).getOrder();
}
}
if (hybrid.equals("sp3") && OxNum == 1) {
frags[96]++;
alogpfrag[i] = 96;
} else if (hybrid.equals("sp3") && OxNum == 2) {
frags[97]++;
alogpfrag[i] = 97;
} else if (hybrid.equals("sp3") && OxNum == 3) {
frags[98]++;
alogpfrag[i] = 98;
} else if (hybrid.equals("sp2") && OxNum == 1) {
frags[99]++;
alogpfrag[i] = 99;
} else if ((hybrid.equals("sp2") && OxNum > 1)
|| (hybrid.equals("sp") && OxNum >= 1)
|| (hybrid.equals("sp3") && OxNum == 4)
|| !ca0.getSymbol().equals("C")) {
frags[100]++;
alogpfrag[i] = 100;
}
}
private void calcGroup101_to_104(int i) {
IAtom ai = atomContainer.getAtom(i);
String s = ai.getSymbol();
if (ai.getFormalCharge() == -1) {
if (s.equals("F")) {
frags[101]++;
alogpfrag[i] = 101;
} else if (s.equals("Cl")) {
frags[102]++;
alogpfrag[i] = 102;
} else if (s.equals("Br")) {
frags[103]++;
alogpfrag[i] = 103;
} else if (s.equals("I")) {
frags[104]++;
alogpfrag[i] = 104;
}
}
}
private void calcGroup106(int i) {
// S in SH
if (fragment[i].equals("SsSH")) {
frags[106]++;
alogpfrag[i] = 106;
}
}
private void calcGroup107(int i) {
// S in R2S, RS-SR
// R = any group linked through C
// if (!Fragment[i].equals("SssS")) return;
// In ALOGP, for malathion PSC is consider to have group 107 (even
// though has P instead of R)
// for lack of fragment, use this fragment for SaaS
if (fragment[i].equals("SssS") || fragment[i].equals("SaaS")) {
frags[107]++;
alogpfrag[i] = 107;
}
// IAtom [] ca=atomContainer.getConnectedAtoms(atomContainer.getAtomAt(i));
//
// if ((ca[0].getSymbol().equals("C") && ca[1].getSymbol().equals("C"))
// ||
// (ca[0].getSymbol().equals("C") && ca[1].getSymbol().equals("S")) ||
// (ca[0].getSymbol().equals("S") && ca[1].getSymbol().equals("C"))) {
// frags[107]++;
// alogpfrag[i]=107;
// }
}
private void calcGroup108(int i) {
// S in R=S
// In ALOGP, for malathion P=S is consider to have group 108 (even
// though has P instead of R)
if (fragment[i].equals("SdS")) {
frags[108]++;
alogpfrag[i] = 108;
}
}
private void calcGroup109(int i) {
// for now S in O-S(=O)-O is assigned to this group
// (it doesn't check which atoms are singly bonded to S
if (!fragment[i].equals("SdssS")) return;
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ai = atomContainer.getAtom(i);
int SdOCount=0;
int SsCCount=0;
for (int j = 0; j <= ca.size() - 1; j++) {
if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 1) {
if (((IAtom)ca.get(j)).getSymbol().equals("C")) {
SsCCount++;
}
} else if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 2) {
if (((IAtom)ca.get(j)).getSymbol().equals("O")) {
SdOCount++;
}
}
}
if (SdOCount==1) { // for now dont check if SsCCount==2
frags[109]++;
alogpfrag[i] = 109;
}
}
private void calcGroup110(int i) {
if (!fragment[i].equals("SddssS"))
return;
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ai = atomContainer.getAtom(i);
int SdOCount=0;
int SsCCount=0;
for (int j = 0; j <= ca.size() - 1; j++) {
if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 1) {
if (((IAtom)ca.get(j)).getSymbol().equals("C")) {
SsCCount++;
}
} else if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 2) {
if (((IAtom)ca.get(j)).getSymbol().equals("O")) {
SdOCount++;
}
}
}
if (SdOCount==2) { // for now dont check if SsCCount==2
frags[110]++;
alogpfrag[i] = 110;
}
}
private void calcGroup111(int i) {
if (fragment[i].equals("SssssSi")) {
frags[111]++;
alogpfrag[i] = 111;
}
}
private void calcGroup116_117_120(int i) {
// S in R=S
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ai = atomContainer.getAtom(i);
int XCount=0;
int RCount=0;
boolean PdX=false;
if (!fragment[i].equals("SdsssP")) return;
for (int j = 0; j <= ca.size() - 1; j++) {
if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 1) {
if (((IAtom)ca.get(j)).getSymbol().equals("C")) {
RCount++;
} else {
XCount++;
}
} else if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 2) {
if (!((IAtom)ca.get(j)).getSymbol().equals("C")) {
PdX=true;
}
}
}
if (PdX) {
if (RCount == 3) {
frags[116]++;
alogpfrag[i] = 116;
} else if (XCount == 3) {
frags[117]++;
alogpfrag[i] = 117;
} else if (XCount == 2 && RCount == 1) {
frags[120]++;
alogpfrag[i] = 120;
}
}
}
private void calcGroup118_119(int i) {
if (!fragment[i].equals("SsssP")) return;
java.util.List ca = atomContainer.getConnectedAtomsList(atomContainer.getAtom(i));
IAtom ai = atomContainer.getAtom(i);
int XCount=0;
int RCount=0;
for (int j = 0; j <= ca.size() - 1; j++) {
if (atomContainer.getBond(ai, ((IAtom)ca.get(j))).getOrder() == 1) {
if (((IAtom)ca.get(j)).getSymbol().equals("C")) {
RCount++;
} else {
XCount++;
}
}
}
if (XCount==3) {
frags[118]++;
alogpfrag[i] = 118;
} else if (RCount==3) {
frags[119]++;
alogpfrag[i] = 119;
}
}
public boolean inSameAromaticRing(IAtomContainer atomContainer, IAtom atom1,
IAtom atom2, IRingSet rs) {
boolean SameRing = false;
for (int i = 0; i <= rs.getAtomContainerCount() - 1; i++) {
IRing r = (IRing)rs.getAtomContainer(i);
if (!r.getFlag(CDKConstants.ISAROMATIC))
continue;
// ArrayList al=new ArrayList();
boolean HaveOne = false;
boolean HaveTwo = false;
for (int j = 0; j <= r.getAtomCount() - 1; j++) {
if (atomContainer.getAtomNumber(r.getAtom(j)) == atomContainer.getAtomNumber(atom1))
HaveOne = true;
if (atomContainer.getAtomNumber(r.getAtom(j)) == atomContainer.getAtomNumber(atom2))
HaveTwo = true;
}
if (HaveOne && HaveTwo) {
SameRing = true;
return SameRing;
}
} // end ring for loop
return SameRing;
}
public DescriptorValue calculate(IAtomContainer container) throws CDKException {
rs = null;
try {
AllRingsFinder arf = new AllRingsFinder();
rs = arf.findAllRings(container);
} catch (Exception e) {
throw new CDKException("Could not find all rings: " + e.getMessage(), e);
}
fragment = new String[container.getAtomCount()];
IAtomTypeMatcher eStateMatcher = new EStateAtomTypeMatcher();
for (int i=0; i<container.getAtomCount(); i++) {
IAtomType atomType = eStateMatcher.findMatchingAtomType(container, container.getAtom(i));
if (atomType == null) {
fragment[i] = null;
} else {
fragment[i] = atomType.getAtomTypeName();
}
}
calculate(container, fragment, rs);
DoubleArrayResult results = new DoubleArrayResult();
results.add(ALOGP);
results.add(ALOGP2);
results.add(AMR);
return new DescriptorValue(getSpecification(), getParameterNames(),
getParameters(), results, new String[] {"ALogP", "ALogP2", "AMR"} );
}
/**
* Returns the specific type of the DescriptorResult object.
* <p/>
* The return value from this method really indicates what type of result will
* be obtained from the {@link org.openscience.cdk.qsar.DescriptorValue} object. Note that the same result
* can be achieved by interrogating the {@link org.openscience.cdk.qsar.DescriptorValue} object; this method
* allows you to do the same thing, without actually calculating the descriptor.
*
* @return an object that implements the {@link org.openscience.cdk.qsar.result.IDescriptorResult} interface indicating
* the actual type of values returned by the descriptor in the {@link org.openscience.cdk.qsar.DescriptorValue} object
*/
public IDescriptorResult getDescriptorResultType() {
return new DoubleArrayResult();
}
public DescriptorSpecification getSpecification() {
return new DescriptorSpecification(
"http://www.epa.gov/toddmartin/#ALOGP",
this.getClass().getName(),
"$Id: AminoAcidCountDescriptor.java 6171 2006-05-04 19:29:58 +0000 (Thu, 04 May 2006) egonw $",
"The Chemistry Development Kit");
}
public String[] getParameterNames() {
return new String[0];
}
public Object getParameterType(String name) {
return null;
}
public void setParameters(Object[] params) throws CDKException {
return; // nothing to set
}
public Object[] getParameters() {
return null;
}
}// end class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -