pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/biojava/biojava/commit/8b085847536b361e3677d27ce56b430f69c4afbd

esheet" href="https://github.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> merging in latest ptm modifications from master branch · biojava/biojava@8b08584 · GitHub
Skip to content

Commit 8b08584

Browse files
committed
merging in latest ptm modifications from master branch
2 parents 3fa10a9 + fbca778 commit 8b08584

16 files changed

Lines changed: 1035 additions & 699 deletions

File tree

biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/ProteinModificationIdentifier.java

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void setbondLengthTolerance(final double bondLengthTolerance) {
9595

9696
/**
9797
*
98-
* @param recordUnidentifiableAtomLinkages true if choosing to record unidentifiable
98+
* @param recordUnidentifiableModifiedCompounds true if choosing to record unidentifiable
9999
* atoms; false, otherwise.
100100
* @see #getRecordUnidentifiableCompounds
101101
* @see #getUnidentifiableModifiedResidues
@@ -276,7 +276,6 @@ public void identify(final List<Chain> chains,
276276

277277
List<Group> ress = StructureUtil.getAminoAcids(chain);
278278

279-
280279
//List<Group> ligs = chain.getAtomLigands();
281280
List<Group> ligs = StructureTools.filterLigands(chain.getAtomGroups());
282281
residues.addAll(ress);
@@ -378,9 +377,10 @@ private void processCrosslink1(Map<Component, Set<Group>> mapCompGroups,
378377

379378
/**
380379
* identify additional groups that are not directly attached to amino acids.
381-
* @param mc {@link ModifiedCompound}.
382-
* @param chain a {@link Chain}.
383-
* @return a list of added groups.
380+
* @param mc {@link ModifiedCompound}
381+
* @param ligands {@link Group}
382+
* @param chains List of {@link Chain}s
383+
* @return a list of added groups
384384
*/
385385
private void identifyAdditionalAttachments(ModifiedCompound mc,
386386
List<Group> ligands, Map<String, Chain> mapChainIdChain) {
@@ -406,7 +406,9 @@ private void identifyAdditionalAttachments(ModifiedCompound mc,
406406
resNum.setSeqNum(num.getResidueNumber());
407407
resNum.setInsCode(num.getInsCode());
408408
//group = chain.getGroupByPDB(numIns);
409+
409410
group = mapChainIdChain.get(num.getChainId()).getGroupByPDB(resNum);
411+
//group = mapChainIdChain.get(num.getChainId()).getGroupByPDB(resNum);
410412
} catch (StructureException e) {
411413
logger.error("Exception: ", e);
412414
// should not happen
@@ -442,6 +444,23 @@ private void identifyAdditionalAttachments(ModifiedCompound mc,
442444
}
443445
}
444446

447+
private Group getGroup(StructureGroup num, List<Chain> chains) throws StructureException {
448+
for (Chain c : chains){
449+
if ( c.getId().equals(num.getChainId())){
450+
451+
ResidueNumber resNum = new ResidueNumber();
452+
453+
resNum.setSeqNum(num.getResidueNumber());
454+
resNum.setInsCode(num.getInsCode());
455+
456+
457+
return c.getGroupByPDB(resNum);
458+
}
459+
}
460+
461+
throw new StructureException("Could not find residue " + num);
462+
}
463+
445464
/**
446465
* Merge identified modified compounds if linked.
447466
*/
@@ -547,6 +566,8 @@ private void recordUnidentifiableModifiedResidues(List<ModifiedCompound> modComp
547566
if (group.getType().equals(GroupType.HETATM)) {
548567
StructureGroup strucGroup = StructureUtil.getStructureGroup(
549568
group, true);
569+
//strucGroup.setChainId(group.getChainId());
570+
550571
if (!identifiedComps.contains(strucGroup)) {
551572
unidentifiableModifiedResidues.add(strucGroup);
552573
}
@@ -777,13 +798,12 @@ private List<List<Atom[]>> getMatchedAtomsOfLinkages(
777798
return matchedAtomsOfLinkages;
778799
}
779800

780-
/**
781-
* Assembly the matched linkages.
801+
/** Assembly the matched linkages
802+
*
782803
* @param matchedAtomsOfLinkages
783804
* @param mod
784-
* @param condition
785-
* @param ret ModifiedCompound will be stored here.
786-
*/
805+
* @param ret ModifiedCompound will be stored here
806+
*/
787807
private void assembleLinkages(List<List<Atom[]>> matchedAtomsOfLinkages,
788808
ProteinModification mod, List<ModifiedCompound> ret) {
789809
ModificationCondition condition = mod.getCondition();

biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
package org.biojava.nbio.protmod.structure;
2626

2727
import org.biojava.nbio.structure.*;
28+
import org.biojava.nbio.structure.io.mmcif.MetalBondParser;
29+
import org.biojava.nbio.structure.io.mmcif.chem.MetalBondDistance;
2830

2931
import java.util.ArrayList;
3032
import java.util.Collections;
3133
import java.util.List;
34+
import java.util.Map;
3235

3336
public final class StructureUtil {
3437
private StructureUtil() {
@@ -53,7 +56,11 @@ public static StructureGroup getStructureGroup(Group group, boolean isAminoAcid)
5356
* @return the {@link StructureAtom} of the atom.
5457
*/
5558
public static StructureAtom getStructureAtom(Atom atom, boolean isParentAminoAcid) {
56-
StructureGroup strucGroup = getStructureGroup(atom.getGroup(), isParentAminoAcid);
59+
60+
Group g = atom.getGroup();
61+
String chainId = g.getChainId();
62+
StructureGroup strucGroup = getStructureGroup(g, isParentAminoAcid);
63+
strucGroup.setChainId(chainId);
5764
return new StructureAtom(strucGroup, atom.getName());
5865
}
5966

@@ -104,6 +111,8 @@ public static double getAtomDistance(Atom atom1, Atom atom2) {
104111
public static Atom[] findNearestAtomLinkage(final Group group1, final Group group2,
105112
List<String> potentialNamesOfAtomOnGroup1, List<String> potentialNamesOfAtomOnGroup2,
106113
final boolean ignoreNCLinkage, double bondLengthTolerance) {
114+
115+
107116
List<Atom[]> linkages = findAtomLinkages(group1, group2,
108117
potentialNamesOfAtomOnGroup1, potentialNamesOfAtomOnGroup2,
109118
ignoreNCLinkage, bondLengthTolerance);
@@ -216,31 +225,96 @@ public static List<Atom[]> findAtomLinkages(final Group group1,
216225
public static Atom[] findLinkage(final Group group1, final Group group2,
217226
String nameOfAtomOnGroup1, String nameOfAtomOnGroup2,
218227
double bondLengthTolerance) {
219-
Atom[] ret = new Atom[2];
220-
double distance;
221228

229+
Atom[] ret = new Atom[2];
222230

223231
ret[0] = group1.getAtom(nameOfAtomOnGroup1);
224232
ret[1] = group2.getAtom(nameOfAtomOnGroup2);
233+
225234
if (ret[0]==null || ret[1]==null) {
226235
return null;
227236
}
228237

229-
distance = Calc.getDistance(ret[0], ret[1]);
230238

239+
Atom a1 = ret[0];
240+
Atom a2 = ret[1];
231241

242+
boolean hasBond = a1.hasBond(a2);
232243

233-
float radiusOfAtom1 = ret[0].getElement().getCovalentRadius();
234-
float radiusOfAtom2 = ret[1].getElement().getCovalentRadius();
244+
if ( hasBond ) {
245+
246+
return ret;
247+
}
248+
249+
// is it a metal ?
250+
251+
if ( a1.getElement().isMetal() || a2.getElement().isMetal()){
252+
253+
MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name());
254+
255+
if ( defined != null) {
256+
257+
if (hasMetalBond(a1, a2, defined))
258+
return ret;
259+
else
260+
return null;
261+
}
235262

236-
if (Math.abs(distance-radiusOfAtom1 -radiusOfAtom2)
237-
> bondLengthTolerance) {
238-
return null;
239263
}
240264

265+
// not a metal
266+
267+
double distance = Calc.getDistance(a1, a2);
268+
269+
float radiusOfAtom1 = ret[0].getElement().getCovalentRadius();
270+
float radiusOfAtom2 = ret[1].getElement().getCovalentRadius();
271+
272+
if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2)
273+
> bondLengthTolerance) {
274+
return null;
275+
}
276+
277+
241278
return ret;
242279
}
243280

281+
private static boolean hasMetalBond(Atom a1, Atom a2, MetalBondDistance definition) {
282+
283+
double distance = Calc.getDistance(a1,a2);
284+
285+
Float min = definition.getLowerLimit();
286+
Float max = definition.getUpperLimit();
287+
288+
return ( min < distance && max > distance);
289+
290+
}
291+
292+
private static MetalBondDistance getMetalDistanceCutoff(String name1, String name2) {
293+
Map<String,List<MetalBondDistance>> defs= MetalBondParser.getMetalBondDefinitions();
294+
295+
List<MetalBondDistance> distances = defs.get(name1);
296+
297+
if ( distances == null){
298+
299+
distances = defs.get(name2);
300+
String tmp = name1;
301+
name2 = name1;
302+
name1 = tmp;
303+
}
304+
if ( distances == null){
305+
return null;
306+
}
307+
308+
for ( MetalBondDistance d : distances){
309+
if ( name1.equalsIgnoreCase(d.getAtomType1()) && name2.equalsIgnoreCase(d.getAtomType2()) )
310+
return d;
311+
}
312+
313+
// no matching atom definitions found
314+
return null;
315+
316+
}
317+
244318
/**
245319
*
246320
* @param group a {@link Group}.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy