import jalview.analysis.AlignSeq;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
+import jalview.datamodel.Mapping;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
public int offset;
- public Sequence sequence;
+ /**
+ * sequence is the sequence extracted by the chain parsing code
+ */
+ public SequenceI sequence;
+
+ /**
+ * shadow is the sequence created by any other parsing processes (e.g. Jmol,
+ * RNAview)
+ */
+ public SequenceI shadow = null;
public boolean isNa = false;
*/
protected String newline = System.getProperty("line.separator");
+ public Mapping shadowMap;
+
public void setNewlineString(String nl)
{
newline = nl;
public void transferResidueAnnotation(StructureMapping mapping)
{
SequenceI sq = mapping.getSequence();
+ SequenceI dsq = sq;
if (sq != null)
{
- if (sequence != null && sequence.getAnnotation() != null)
+ while (dsq.getDatasetSequence() != null)
+ {
+ dsq = dsq.getDatasetSequence();
+ }
+ // any annotation will be transferred onto the dataset sequence
+
+ if (shadow != null && shadow.getAnnotation() != null)
{
+ for (AlignmentAnnotation ana : shadow.getAnnotation())
+ {
+ List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations(
+ ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ ana.liftOver(sequence, shadowMap);
+ mapping.transfer(ana);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ else
+ {
+ if (sequence != null && sequence.getAnnotation() != null)
+ {
+ for (AlignmentAnnotation ana : sequence.getAnnotation())
+ {
+ List<AlignmentAnnotation> transfer = sq.getAlignmentAnnotations(
+ ana.getCalcId(), ana.label);
+ if (transfer == null || transfer.size() == 0)
+ {
+ mapping.transfer(ana);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
}
float min = -1, max = 0;
Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
sq.getPDBId().clear();
}
}
- AlignSeq.replaceMatchingSeqsWith(seqs, annotations, prot, al, AlignSeq.PEP, false);
+ replaceAndUpdateChains(prot, al, AlignSeq.PEP, false);
}
} catch (ClassNotFoundException q)
{
}
}
+ private void replaceAndUpdateChains(ArrayList<SequenceI> prot,
+ AlignmentI al, String pep, boolean b)
+ {
+ List<List<? extends Object>> replaced = AlignSeq
+ .replaceMatchingSeqsWith(seqs,
+ annotations, prot, al, AlignSeq.PEP, false);
+ for (PDBChain ch : chains)
+ {
+ int p = 0;
+ for (SequenceI sq : (List<SequenceI>) replaced.get(0))
+ {
+ p++;
+ if (sq == ch.sequence || sq.getDatasetSequence() == ch.sequence)
+ {
+ p = -p;
+ break;
+ }
+ }
+ if (p < 0)
+ {
+ p = -p - 1;
+ // set shadow entry for chains
+ ch.shadow = (SequenceI) replaced.get(1).get(p);
+ ch.shadowMap = ((AlignSeq) replaced.get(2)
+.get(p))
+ .getMappingFromS1(false);
+ }
+ }
+ }
+
private void processPdbFileWithAnnotate3d(ArrayList<SequenceI> rna)
throws Exception
{
{
if (sq.getDatasetSequence() != null)
{
- sq.getDatasetSequence().getPDBId().clear();
+ if (sq.getDatasetSequence().getPDBId() != null)
+ {
+ sq.getDatasetSequence().getPDBId().clear();
+ }
}
else
{
- sq.getPDBId().clear();
+ if (sq.getPDBId() != null)
+ {
+ sq.getPDBId().clear();
+ }
}
}
- AlignSeq.replaceMatchingSeqsWith(seqs, annotations, rna, al, AlignSeq.DNA, false);
+ replaceAndUpdateChains(rna, al, AlignSeq.DNA, false);
}
} catch (ClassNotFoundException x)
{