public static AFPChain fastaToAfpChain(SequencePair<Sequence<AminoAcidCompound>, AminoAcidCompound> alignment,
Structure structure1, Structure structure2) throws StructureException {
List<AlignedSequence<Sequence<AminoAcidCompound>, AminoAcidCompound>> seqs = alignment.getAlignedSequences();
StringBuilder sb1 = new StringBuilder();
for (AminoAcidCompound a : seqs.get(0)) {
sb1.append(a.getBase());
}
try {
ProteinSequence seq1 = new ProteinSequence(sb1.toString());
StringBuilder sb2 = new StringBuilder();
for (AminoAcidCompound a : seqs.get(1)) {
sb1.append(a.getBase());
}
ProteinSequence seq2 = new ProteinSequence(sb2.toString());
LinkedHashMap<String, ProteinSequence> map = new LinkedHashMap<String, ProteinSequence>();
map.put(structure1.getName(), seq1);
map.put(structure2.getName(), seq2);
return fastaToAfpChain(map, structure1, structure2);
} catch (CompoundNotFoundException e) {
logger.error("Unexpected error while creating protein sequences: {}. This is most likely a bug.",e.getMessage());
return null;
}
}