import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.Vector;
import jalview.analysis.AlignSeq;
{
ds = ds.getDatasetSequence();
}
-
+ List <PDBEntry> putativePDBe = PDBEntryUtils.selectPutativePDBe(seq,ds, pdb);
+
if (targetChainIds != null && targetChainIds[s] != null)
{
infChain = false;
targetChainId = targetChainIds[s];
}
- else if (seq.getName().indexOf("|") > -1)
- {
- targetChainId = seq.getName()
- .substring(seq.getName().lastIndexOf("|") + 1);
- if (targetChainId.length() > 1)
- {
- if (targetChainId.trim().length() == 0)
- {
- targetChainId = " ";
- }
- else
- {
- // not a valid chain identifier
- targetChainId = "";
- }
- }
- }
- else
- {
- targetChainId = "";
+ else {
+ targetChainId = PDBEntryUtils.inferChainId(seq);
}
/*
{
continue; // don't try to map chains don't match.
}
+ PDBEntry putativeChain = null;
+ if (!putativePDBe.isEmpty() && (putativeChain = PDBEntryUtils
+ .selectPutativePDBEntry(putativePDBe, chain)) == null)
+ {
+ continue;
+ }
// TODO: correctly determine sequence type for mixed na/peptide
// structures
final String type = chain.isNa ? AlignSeq.DNA : AlignSeq.PEP;
}
List<StructureMapping> seqToStrucMapping = new ArrayList<>();
+ List<StructureMapping> foundSiftsMappings = new ArrayList<>();
if (isMapUsingSIFTs && seq.isProtein())
{
if (progress != null)
pdb.getId().toLowerCase(Locale.ROOT));
maxChain.transferResidueAnnotation(siftsMapping, null);
ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0));
+ foundSiftsMappings.add(siftsMapping);
} catch (SiftsException e)
{
- // fall back to NW alignment
Console.error(e.getMessage());
- StructureMapping nwMapping = getNWMappings(seq, pdbFile,
- targetChainId, maxChain, pdb, maxAlignseq);
- seqToStrucMapping.add(nwMapping);
- maxChain.makeExactMapping(maxAlignseq, seq);
- maxChain.transferRESNUMFeatures(seq, "IEA:Jalview",
- pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is
- // this
- // "IEA:Jalview" ?
- maxChain.transferResidueAnnotation(nwMapping, sqmpping);
- ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0));
}
}
else
{
- List<StructureMapping> foundSiftsMappings = new ArrayList<>();
for (PDBChain chain : pdb.getChains())
{
StructureMapping siftsMapping = null;
jalview.bin.Console.errPrintln(e.getMessage());
}
}
+ // If sifts was successful, add mappings and return
if (!foundSiftsMappings.isEmpty())
{
- seqToStrucMapping.addAll(foundSiftsMappings);
ds.addPDBId(sqmpping.getTo().getAllPDBEntries().get(0));
}
- else
- {
- /*
- * fallback to NeedlemanWunch.
- */
- StructureMapping nwMapping = getNWMappings(seq, pdbFile,
- maxChainId, maxChain, pdb, maxAlignseq);
- seqToStrucMapping.add(nwMapping);
- maxChain.transferRESNUMFeatures(seq, null,
- pdb.getId().toLowerCase(Locale.ROOT)); // FIXME: is this
- // "IEA:Jalview" ?
- maxChain.transferResidueAnnotation(nwMapping, sqmpping);
- ds.addPDBId(maxChain.sequence.getAllPDBEntries().get(0));
- }
+ }
+
+ // If sifts was successful, add mappings and return
+ if (!foundSiftsMappings.isEmpty())
+ {
+ seqToStrucMapping.addAll(foundSiftsMappings);
}
}
- else
+ if (foundSiftsMappings.isEmpty())
{
- // Not doing SIFTS
+ // Not doing SIFTS, or SIFTS failed for some reason.
+
// first check if we should use an identity mapping
- if (idLengthChain != null && maxAlignseq.getS2Coverage() < 0.5)
+ if (idLengthChain != null && maxAlignseq.getS2Coverage() < 0.75)
{
Console.info(
"Assuming 3Dsi identity mapping between structure and sequence");
}
else
{
+ if (maxAlignseq.getS1Coverage()<0.15 && maxAlignseq.getS2Coverage()<0.15)
+ {
+ // skip this - the NW alignment is spurious
+ continue;
+ }
// Construct a needleman wunsch mapping instead.
if (progress != null)
{