/** * {@inheritDoc} */ @Override public String getSeqResSequence(){ StringBuilder str = new StringBuilder(); for (Group g : seqResGroups) { ChemComp cc = g.getChemComp(); if ( cc == null) { logger.warn("Could not load ChemComp for group: ", g); str.append(StructureTools.UNKNOWN_GROUP_LABEL); } else if ( PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); // AB oneLetter.length() should be one. e.g. in 1EMA it is 3 and this makes mapping residue to sequence impossible. if ( oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("?")) { oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); } str.append(oneLetter); } else { str.append(StructureTools.UNKNOWN_GROUP_LABEL); } } return str.toString(); }
/** * Get the one letter sequence so that Sequence is guaranteed to * be the same length as seqResGroups. * Method related to https://github.com/biojava/biojava/issues/457 * @return a string of the sequence guaranteed to be the same length * as seqResGroups. */ public String getSeqResOneLetterSeq(){ StringBuilder str = new StringBuilder(); for (Group g : seqResGroups) { ChemComp cc = g.getChemComp(); if ( cc == null) { logger.warn("Could not load ChemComp for group: ", g); str.append(StructureTools.UNKNOWN_GROUP_LABEL); } else if ( PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); // AB oneLetter.length() should be one. e.g. in 1EMA it is 3 and this makes mapping residue to sequence impossible. if ( oneLetter == null || oneLetter.isEmpty() || oneLetter.equals("?") || oneLetter.length()!=1) { oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); } str.append(oneLetter); } else { str.append(StructureTools.UNKNOWN_GROUP_LABEL); } } return str.toString(); }
/** * {@inheritDoc} */ @Override public String getAtomSequence(){ List<Group> groups = getAtomGroups(); StringBuilder sequence = new StringBuilder() ; for ( Group g: groups){ ChemComp cc = g.getChemComp(); if ( PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())){ // an amino acid residue.. use for alignment String oneLetter= ChemCompGroupFactory.getOneLetterCode(cc); if ( oneLetter == null) oneLetter = Character.toString(StructureTools.UNKNOWN_GROUP_LABEL); sequence.append(oneLetter); } } return sequence.toString(); }
/** * Returns true if the given group is part of the main chain, i.e. if it is * a peptide-linked group or a nucleotide * @param g * @return */ private static boolean isInChain(Group g) { ChemComp chemComp = g.getChemComp(); if (chemComp==null) { logger.warn("Warning: can't determine PolymerType for group "+g.getResidueNumber()+" ("+g.getPDBName()+"). Will consider it as non-nucleotide/non-protein type."); return false; } PolymerType polyType = chemComp.getPolymerType(); for (PolymerType protOnlyType: PolymerType.PROTEIN_ONLY) { if (polyType==protOnlyType) return true; } for (PolymerType protOnlyType: PolymerType.POLYNUCLEOTIDE_ONLY) { if (polyType==protOnlyType) return true; } return false; }
@Override public boolean matches(Group group) { if( group == null ) return false; ChemComp chem = group.getChemComp(); if(chem == null) return false; // Get polymer type PolymerType polyType = chem.getPolymerType(); if( polyType == null) { ResidueType type = chem.getResidueType(); if(type != null ) { polyType = type.getPolymerType(); } } if( polyType == null ) { return false; } return PolymerType.PROTEIN_ONLY.contains(polyType) && group.hasAtom(StructureTools.CA_ATOM_NAME); } };
ChemComp cc = g.getChemComp(); if ( cc == null) { logger.debug("No chem comp available for group {}",g.toString());
if (currentGroup.getChemComp() != null) { for (ChemCompAtom a : currentGroup.getChemComp().getAtoms()) { if (a.getAtom_id().equals(fullname.trim())) { elementSymbol = a.getType_symbol();
/** initiate new resNum, either Hetatom, Nucleotide, or AminoAcid */ private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) { Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3); if ( g != null && !g.getChemComp().isEmpty()) return g; Group group; if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){ group = new HetatomImpl(); } else if(StructureTools.isNucleotide(aminoCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; } else { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); group = aa ; } // System.out.println("new resNum type: "+ resNum.getType() ); return group ; }
if ( strBuf1[i] == null) break; System.out.print(strBuf1[i].getGroup().getChemComp().getOne_letter_code());
if ( g != null && !g.getChemComp().isEmpty()) { if ( g instanceof AminoAcidImpl) { AminoAcidImpl aa = (AminoAcidImpl) g;
set.getCompoundForString(a1.getGroup().getChemComp().getOne_letter_code()); AminoAcidCompound ac2 = set.getCompoundForString(a2.getGroup().getChemComp().getOne_letter_code());
set.getCompoundForString(a1.getGroup().getChemComp().getOne_letter_code()); AminoAcidCompound ac2 = set.getCompoundForString(a2.getGroup().getChemComp().getOne_letter_code());
Group group = groups.get(groupInChainIndex); List<Atom> atomsInGroup = MmtfUtils.getAtomsForGroup(group); ChemComp chemComp = group.getChemComp(); Character insCode = group.getResidueNumber().getInsCode(); if(insCode==null || insCode.equals(' ')){
if ( g != null && !g.getChemComp().isEmpty()) { if ( g instanceof AminoAcidImpl) { AminoAcidImpl aa = (AminoAcidImpl) g;