From: tcofoegbu Date: Thu, 29 Oct 2015 13:59:29 +0000 (+0000) Subject: JAL-1926 JAL-1479 updated PDBfile fetcher to add sourceDBRef on importing sequences X-Git-Tag: Release_2_10_0~341^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=12a2da1bc751ed3612bcd022881bf2b6f73bb975;p=jalview.git JAL-1926 JAL-1479 updated PDBfile fetcher to add sourceDBRef on importing sequences --- diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index c1018a3..a7ecc52 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -24,6 +24,7 @@ import jalview.analysis.AlignSeq; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.io.FileParse; @@ -94,11 +95,13 @@ public class PDBfile extends jalview.io.AlignFile doParse(); } + @Override public String print() { return null; } + @Override public void parse() throws IOException { // TODO set the filename sensibly - try using data source name. @@ -285,8 +288,8 @@ public class PDBfile extends jalview.io.AlignFile */ protected SequenceI postProcessChain(PDBChain chain) { - SequenceI dataset = chain.sequence; - dataset.setName(id + "|" + dataset.getName()); + SequenceI pdbSequence = chain.sequence; + pdbSequence.setName(id + "|" + pdbSequence.getName()); PDBEntry entry = new PDBEntry(); entry.setId(id); entry.setType(PDBEntry.Type.PDB); @@ -305,9 +308,16 @@ public class PDBfile extends jalview.io.AlignFile // TODO: decide if we should dump the datasource to disk entry.setFile(getDataName()); } - dataset.addPDBId(entry); + pdbSequence.addPDBId(entry); + + DBRefEntry sourceDBRef = new DBRefEntry(); + sourceDBRef.setAccessionId(id); + sourceDBRef.setSource("PDB"); + sourceDBRef.setStartRes(pdbSequence.getStart()); + sourceDBRef.setEndRes(pdbSequence.getEnd()); + pdbSequence.setSourceDBRef(sourceDBRef); // PDBChain objects maintain reference to dataset - SequenceI chainseq = dataset.deriveSequence(); + SequenceI chainseq = pdbSequence.deriveSequence(); seqs.addElement(chainseq); AlignmentAnnotation[] chainannot = chainseq.getAnnotation(); diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index c8bd902..fd710bd 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -219,6 +219,7 @@ public class Sequence extends ASequence implements SequenceI initSeqAndName(seq.getName(), seq.getSequence(), seq.getStart(), seq.getEnd()); description = seq.getDescription(); + sourceDBRef = seq.getSourceDBRef(); if (seq.getSequenceFeatures() != null) { SequenceFeature[] sf = seq.getSequenceFeatures(); diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 4a50196..7f8c76c 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -97,7 +97,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy */ public AlignmentI getSequenceRecords(String queries) throws Exception { - AlignmentI pdbfile = null; + AlignmentI pdbAlignment = null; Vector result = new Vector(); String chain = null; String id = null; @@ -131,12 +131,12 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy try { - pdbfile = new FormatAdapter().readFile(file, + pdbAlignment = new FormatAdapter().readFile(file, jalview.io.AppletFormatAdapter.FILE, "PDB"); - if (pdbfile != null) + if (pdbAlignment != null) { List toremove = new ArrayList(); - for (SequenceI pdbcs : pdbfile.getSequences()) + for (SequenceI pdbcs : pdbAlignment.getSequences()) { String chid = null; // Mapping map=null; @@ -188,18 +188,18 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy // now remove marked sequences for (SequenceI pdbcs : toremove) { - pdbfile.deleteSequence(pdbcs); + pdbAlignment.deleteSequence(pdbcs); if (pdbcs.getAnnotation() != null) { for (AlignmentAnnotation aa : pdbcs.getAnnotation()) { - pdbfile.deleteAnnotation(aa); + pdbAlignment.deleteAnnotation(aa); } } } } - if (pdbfile == null || pdbfile.getHeight() < 1) + if (pdbAlignment == null || pdbAlignment.getHeight() < 1) { throw new Exception(MessageManager.formatMessage( "exception.no_pdb_records_for_chain", new String[] { id, @@ -211,7 +211,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy stopQuery(); throw (ex); } - return pdbfile; + return pdbAlignment; } /* diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index 176c511..b9d023b 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -519,7 +519,6 @@ public class SiftsClient implements SiftsClientI && getAllMappingAccession().contains(accessionId); } - @Override public Entity getEntityById(String id) throws SiftsException { @@ -568,7 +567,6 @@ public class SiftsClient implements SiftsClientI : strName.length(); int len = 72 - maxid - 1; - // int nochunks = 2;// mp.getWrapHeight(); int nochunks = ((seqRes.length()) / len) + ((seqRes.length()) % len > 0 ? 1 : 0); // output mappings