public void identify ( final List < Chain > chains , final Set < ProteinModification > potentialModifications ) { if ( chains == null ) { throw new IllegalArgumentException ( "Null structure." ) ; } if ( potentialModifications == null ) { throw new IllegalArgumentException ( "Null potentialModifications." ) ; } reset ( ) ; if ( potentialModifications . isEmpty ( ) ) { return ; } residues = new ArrayList < Group > ( ) ; List < Group > ligands = new ArrayList < Group > ( ) ; Map < Component , Set < Group > > mapCompGroups = new HashMap < Component , Set < Group > > ( ) ; for ( Chain chain : chains ) { List < Group > ress = StructureUtil . getAminoAcids ( chain ) ; //List<Group> ligs = chain.getAtomLigands(); List < Group > ligs = StructureTools . filterLigands ( chain . getAtomGroups ( ) ) ; residues . addAll ( ress ) ; residues . removeAll ( ligs ) ; ligands . addAll ( ligs ) ; addModificationGroups ( potentialModifications , ress , ligs , mapCompGroups ) ; } if ( residues . isEmpty ( ) ) { String pdbId = "?" ; if ( chains . size ( ) > 0 ) { Structure struc = chains . get ( 0 ) . getStructure ( ) ; if ( struc != null ) pdbId = struc . getPDBCode ( ) ; } logger . warn ( "No amino acids found for {}. Either you did not parse the PDB file with alignSEQRES records, or this record does not contain any amino acids." , pdbId ) ; } List < ModifiedCompound > modComps = new ArrayList < ModifiedCompound > ( ) ; for ( ProteinModification mod : potentialModifications ) { ModificationCondition condition = mod . getCondition ( ) ; List < Component > components = condition . getComponents ( ) ; if ( ! mapCompGroups . keySet ( ) . containsAll ( components ) ) { // not all components exist for this mod. continue ; } int sizeComps = components . size ( ) ; if ( sizeComps == 1 ) { processCrosslink1 ( mapCompGroups , modComps , mod , components ) ; } else { processMultiCrosslink ( mapCompGroups , modComps , mod , condition ) ; } } if ( recordAdditionalAttachments ) { // identify additional groups that are not directly attached to amino acids. for ( ModifiedCompound mc : modComps ) { identifyAdditionalAttachments ( mc , ligands , chains ) ; } } mergeModComps ( modComps ) ; identifiedModifiedCompounds . addAll ( modComps ) ; // record unidentifiable linkage if ( recordUnidentifiableModifiedCompounds ) { recordUnidentifiableAtomLinkages ( modComps , ligands ) ; recordUnidentifiableModifiedResidues ( modComps ) ; } }
Identify a set of modifications in a a list of chains .