From c71453f1c7de4cc250700c1b6dd39d061982e794 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 19 Apr 2023 17:21:43 +0100 Subject: [PATCH] JAL-629 Now showing temp fac and secondary structure for File opened structures and command line added structure. Added linegraph annotation marks for 'singleton' data points. Added splashscreen property. Adjusted test_fab41.result argfile. --- examples/test_fab41.result/argfile.txt | 16 +++-- examples/test_fab41.result/sample.html | 62 +++++++++++++++++++ src/jalview/bin/Commands.java | 10 +-- src/jalview/bin/Jalview.java | 3 +- src/jalview/ext/jmol/JmolParser.java | 20 ++++-- src/jalview/gui/AssociatePdbFileWithSeq.java | 7 ++- src/jalview/gui/StructureChooser.java | 13 ++-- src/jalview/io/AlignFile.java | 39 +++++++++++- src/jalview/io/FileLoader.java | 3 +- src/jalview/io/StructureFile.java | 64 ++++++++++++++++---- src/jalview/renderer/AnnotationRenderer.java | 60 +++++++++++------- .../structure/StructureSelectionManager.java | 29 ++++++--- src/jalview/ws/dbsources/EBIAlfaFold.java | 1 - src/mc_view/PDBfile.java | 4 -- 14 files changed, 262 insertions(+), 69 deletions(-) create mode 100644 examples/test_fab41.result/sample.html diff --git a/examples/test_fab41.result/argfile.txt b/examples/test_fab41.result/argfile.txt index 50e898e..52d68ee 100644 --- a/examples/test_fab41.result/argfile.txt +++ b/examples/test_fab41.result/argfile.txt @@ -1,18 +1,24 @@ --debug --nonews --nosplash +--noannotation --substitutions --open={argfiledirname}/sample.a2m --colour=gecos:flower --structure={dirname}/test_fab41_unrelaxed_rank_1_model_3.pdb ---paematrix=[seqid=101;label=PAE R1-M3]{dirname}/test_fab41_unrelaxed_rank_1_model_3_scores.json +--paematrix={dirname}/test_fab41_unrelaxed_rank_1_model_3_scores.json +--tempfac=plddt --structure={dirname}/test_fab41_unrelaxed_rank_2_model_4.pdb ---paematrix=[label=PAE R2-M4]{dirname}/test_fab41_unrelaxed_rank_2_model_4_scores.json +--paematrix={dirname}/test_fab41_unrelaxed_rank_2_model_4_scores.json +--tempfac=plddt --structure={dirname}/test_fab41_unrelaxed_rank_3_model_2.pdb ---paematrix=[label=PAE R3-M2]{dirname}/test_fab41_unrelaxed_rank_3_model_2_scores.json +--paematrix={dirname}/test_fab41_unrelaxed_rank_3_model_2_scores.json +--tempfac=plddt --structure={dirname}/test_fab41_unrelaxed_rank_4_model_5.pdb ---paematrix=[label=PAE R4-M5]{dirname}/test_fab41_unrelaxed_rank_4_model_5_scores.json +--paematrix={dirname}/test_fab41_unrelaxed_rank_4_model_5_scores.json +--tempfac=plddt --structure={dirname}/test_fab41_unrelaxed_rank_5_model_1.pdb ---paematrix=[label=PAE R5-M1]{dirname}/test_fab41_unrelaxed_rank_5_model_1_scores.json +--tempfac=plddt +--paematrix={dirname}/test_fab41_unrelaxed_rank_5_model_1_scores.json --image={dirname}/{basename}.html #--headless diff --git a/examples/test_fab41.result/sample.html b/examples/test_fab41.result/sample.html new file mode 100644 index 0000000..85c9587 --- /dev/null +++ b/examples/test_fab41.result/sample.html @@ -0,0 +1,62 @@ + + +
+
+ + + + +101/1-59UPI000695F0FD/1-68SRR5512138_1377460/1-69SRR5579871_5171350/1-69MGYP000923236236/1-794468|scaffold_1473490_c1_1|-89|00/1-69SRR6185503_13177952/1-68SRR6185436_16110281/1-68SRR5258706_5983935/1-68SRR5258708_19012803/1-68SRR5207247_4366399/1-69SRR5215212_2981939/1-68SRR3954452_24621378/1-71SRR5438045_3761950/1-70SRR5258707_1096459/1-72SRR5438270_3928578/1-85ConservationQualityConsensusOccupancy101 Alphafold ReliabilitySecondary StructurePAE MatrixTemperature FactorSecondary StructurePAE MatrixTemperature FactorSecondary StructurePAE MatrixTemperature FactorSecondary StructurePAE MatrixTemperature FactorSecondary StructurePAE Matrix +
+ + + +
+ + + +102030405060708090100110120130140150160170180190200210220230240250260270280290300310320330340350360370P-I---A--Q--I-----H-----I--------L-------E--------G-------R-------S----D-------E-------Q-----K----E-T--LI----RE---V-S-E---A---I------S-------R---S-------L--------D----A-----P------L-----------------------------T------S-------V-------R------V---I----I-------T------E-----M--------A----K---------G------H----------F----------G--------I----------G--------G------E--------L----A---SKP-Hye-V--S--V-----T-----M--------P-------T--------G-------Wl------N----T-------V-------R-----K----Q-G--MI----DA---V-T-R---A---L------L-------E---A-------I--------A----T-----P------F-----------------------------D------Essrfr--V-------R------C---L----I-------P------E-----I--------P----D---------G------N----------W----------G--------S----------G--------Gya----L--------P----L---S-P-H---V--A--V-----K-----L--------Y-------P--------G-------R-------T----E-------Q-------Q-----K----E-Q--LA----RA---I-A-D---D---V------M-------R---I-------L--------G----S-----S------E-----------------------------A------S-------V-------S------V---S----I-------E------E-----V--------D----A---------A------D----------W----------A--------EkvyrplivegG--------G------T--------L----Y---KKP-H---V--I--V-----K-----L--------W-------P--------G-------R-------S----E-------P-------Q-----K----Q-K--LV----ES---V-T-K---A---V------T-------T---S-------L--------G----Y-----S------D-----------------------------E------A-------V-------S------V---S----L-------Q------E-----V--------P----S---------D------Q----------WtekvyrpdilG--------T----------A--------G------R--------L----Y---KKP-I---V--R--I-----T-----M--------F-------E--------G-------R-------T----K-------E-------Q-----K----Q-E--LA----RV---I-T-E---A---V------V-------N---I-------A--------K----T-----T------P-----------------------------D------A-------T-------E------VkdqI----L-------Q------K-----VllvrslrlP----PppasrrqvsG------A----------W----------S--------A----------D--------G------K--------P----T---SEP-H---V--I--V-----K-----L--------W-------P--------G-------K-------S----E-------R-------E-----E----T-Q--LA----EA---I-T-K---S---V------T-------E---T-------L--------N----F-----G------P-----------------------------E------S-------V-------S------V---A----F-------E------E-----I--------P----A---------K------D----------W----------AskvyhadiI----------Gne------G------K--------L----Y---KKP-L---V--R--I-----T-----Y--------P-------R--------Ga------L-------S----P-------E-------H-----K----T-R--IA----RA---L-T-E---I---V------L-------D---Vevdaa--T--------D----A-----G------R-----------------------------M------V-------T-------V------V---H----F-------N------E-----A--------A----P---------D------D----------W----------A--------V----------G--------G------Eirs-----T----A---AEP-L---V--R--I-----T-----Y--------P-------R--------Ga------L-------S----P-------D-------H-----K----R-R--IA----RE---L-T-E---I---V------L-------D---Vevdaa--T--------D----A-----G------R-----------------------------M------V-------T-------V------I---H----F-------N------E-----A--------A----A---------D------D----------W----------A--------V----------G--------G------Eirs-----T----A---AEP-R---Y--R--Vip---T-----V--------P-------E--------G-------Qy------S----N-------E-------S-----R----K-A--LV----KD---V-T-E---A---V------V-------R---A-------D--------G----G-----K------Y-----------------------------E------Dvapr---V-------W------V---F----P-------T------E-----I--------P----D---------G------Q----------W----------G--------S----------R--------Gvi----R--------P----L---PEP-R---Y--R--Iip---T-----V--------P-------E--------G-------Qy------S----N-------E-------S-----R----K-A--LV----KD---V-T-E---A---V------V-------R---A-------D--------G----G-----K------Y-----------------------------E------Dvapr---V-------W------V---F----P-------T------E-----I--------P----D---------G------Q----------W----------G--------S----------R--------Gvi----R--------P----L---PEP-V---I--E--M-----F-----V--------P-------E--------G-------La------D----A-------E-------A-----K----R-A--LH----DR---V-S-R---Q---V------L-------E---V-------E--------G----AtydesP------L-----------------------------A------Qsi-----T-------W------M---L----I-------Q------E-----V--------L----E---------C------G----------W----------S--------V----------G--------S------K--------Avw--A---SEP-I---I--E--M-----H-----V--------Q-------E--------Gv------L-------D----E-------E-------T-----K----R-T--LH----ER---V-G-R---Q---V------L-------E---I-------E--------G----Any---D------E-----------------------------N------D-------Varllt--F------M---F----I-------R------E-----H--------P----E---------G------G----------F----------S--------I----------G--------G------E--------M----It--SEP-Lyr-V--D--V-----T-----V--------P-------E--------Gsmihg--Q-------G----Pwal----S-------R-----R----R-A--IV----RE---V-T-E---I---V------L-------E---A-------E--------G----S-----D------P-----------------------------Slgeaw-R-------V-------W------V---V----L-------R------E-----V--------G----D---------A------F----------W----------G--------A----------A--------G------E--------L----------P-Lyr-V--Q--I-----T-----V--------P-------E--------Gsmlhg--Q-------G----Pwai----E-------R-----R----R-E--LV----RA---V-S-K---A---V------L-------D---A-------E--------G----Teyn--P------A-----------------------------Saw----R-------V-------W------V---L----M-------S------E-----I--------S----E---------T------H----------W----------G--------A----------A--------G------E-------------------P-L---V--E--M-----S-----F--------P-------V--------Gv------L-------T----L-------D-------Q-----K----A-A--MI----KS---V-T-D---V---V------R-------G---A-------M--------K----L-----P------P-----------------------------Dpar---K-------L-------F------V---E----I-------F------E-----T--------P----G---------G------G----------F----------G--------Vtakvvvvp--G--------Gky----R--------P----A---P-P-L---V--E--I-----D-----L--------L-------E--------A-------W-------A----P-------D-------Q-----I----D-A--IA----DA---I-H-E---A---M------V-------E---T-------L--------G----V-----P------EraagrdsatkqhfysrfaallaeratvqsA------D-------L-------T------A---V----L-------V------E-----N--------S----R---------D------D----------W----------S--------F----------Gm-------G------Q-------------------*-3---5--2--8-----2-----6--------4-------2--------+-------4-------5----1-------1-------2-----4----3-3--93----62---9-3-6---3---8------3-------3---5-------3--------3----4-----2------0-----------------------------4------2-------7-------1------7---1----5-------0------7-----2--------2----2---------3------2----------9----------8--------2----------3--------8------3--------0----1---0- P-LYR-V--R--IIP---T-----V--------P-------E--------G+M+HG--LY------S----PWA+----E-------Q-----K----R-A--LA----RA---V-T-E---A---V------L-------E---AEVDAA--L--------G----A+Y+ESP------PRAAGRDSATKQHFYSRFAALLAERATVQSE+++AW-D+APRR--VARLLT--W------VKDQ+----I-------+------E-----+LLVRSLRLP----DPPASRRQVSG------D----------WTEKVYRPDILGSKVYHADIV++++++++EGG+E------GVI----EIRS-----+VW--AT--SE +
+ + + + \ No newline at end of file diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 5341874..6d514b0 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -22,12 +22,10 @@ import jalview.bin.argparser.ArgValuesMap; import jalview.bin.argparser.SubVals; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; -import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.datamodel.annotations.AlphaFoldAnnotationRowBuilder; import jalview.gui.AlignFrame; import jalview.gui.AlignmentPanel; -import jalview.gui.AssociatePdbFileWithSeq; import jalview.gui.Desktop; import jalview.gui.Preferences; import jalview.gui.StructureChooser; @@ -323,7 +321,7 @@ public class Commands .getStructureSelectionManager(Desktop.instance); SequenceI seq = af.alignPanel.getAlignment().getSequenceAt(0); ssm.computeMapping(false, new SequenceI[] { seq }, null, - openFile, DataSourceType.FILE, null, null, null); + openFile, DataSourceType.FILE, null, null, null, false); } } else @@ -424,9 +422,13 @@ public class Commands Console.debug("Using structure file " + structureFile.getAbsolutePath()); + // ##### Does this need to happen? Follow + // openStructureFileForSequence() below + /* PDBEntry fileEntry = new AssociatePdbFileWithSeq() .associatePdbWithSeq(structureFile.getAbsolutePath(), DataSourceType.FILE, seq, true, Desktop.instance); + */ // open structure view AlignmentPanel ap = af.alignPanel; @@ -500,7 +502,7 @@ public class Commands // TODO pass PAE label StructureChooser.openStructureFileForSequence(null, null, ap, seq, - false, structureFilepath, tft, paeFilepath); + false, structureFilepath, tft, paeFilepath, false); } } } diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 44494e2..5d14f98 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -567,7 +567,8 @@ public class Jalview if (!(headless || headlessArg)) { Desktop.nosplash = "false".equals(bootstrapArgs.get(Arg.SPLASH)) - || aparser.contains("nosplash"); + || aparser.contains("nosplash") + || Cache.getDefault("SPLASH", "true").equals("false"); desktop = new Desktop(); desktop.setInBatchMode(true); // indicate we are starting up diff --git a/src/jalview/ext/jmol/JmolParser.java b/src/jalview/ext/jmol/JmolParser.java index a276fb6..b7c83c6 100644 --- a/src/jalview/ext/jmol/JmolParser.java +++ b/src/jalview/ext/jmol/JmolParser.java @@ -88,6 +88,11 @@ public class JmolParser extends StructureFile implements JmolStatusListener super(inFile, sourceType, tempfacType); } + public JmolParser(FileParse fp, boolean doXferSettings) throws IOException + { + super(fp, doXferSettings); + } + public JmolParser(FileParse fp) throws IOException { super(fp); @@ -108,6 +113,12 @@ public class JmolParser extends StructureFile implements JmolStatusListener @Override public void parse() throws IOException { + parse(true); + } + + @Override + public void parse(boolean doXferSettings) throws IOException + { setChains(new Vector()); Viewer jmolModel = getJmolData(); jmolModel.openReader(getDataName(), getDataName(), getReader()); @@ -132,7 +143,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener ? PDBEntry.Type.MMCIF.toString() : "PDB"); - transformJmolModelToJalview(jmolModel.ms); + transformJmolModelToJalview(jmolModel.ms, doXferSettings); } } @@ -202,7 +213,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener return false; } - public void transformJmolModelToJalview(ModelSet ms) throws IOException + public void transformJmolModelToJalview(ModelSet ms, + boolean localDoXferSettings) throws IOException { try { @@ -260,7 +272,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener } lastID = tmpatom.resNumIns.trim(); } - if (isParseImmediately()) + if (isParseImmediately() && localDoXferSettings) { // configure parsing settings from the static singleton xferSettings(); @@ -292,7 +304,7 @@ public class JmolParser extends StructureFile implements JmolStatusListener { try { - Console.info("retrieving pAE for " + pdbId); + Console.info("Retrieving PAE for " + pdbId); File paeFile = EBIAlfaFold.fetchAlphaFoldPAE(pdbId, null); this.setPAEMatrix(paeFile.getAbsolutePath()); } catch (Throwable t) diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index 420e2cb..c9951f5 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -49,19 +49,20 @@ public class AssociatePdbFileWithSeq StructureSelectionManagerProvider ssmp) { return associatePdbWithSeq(choice, file, sequence, prompt, ssmp, - TFType.DEFAULT, null); + TFType.DEFAULT, null, true); } public PDBEntry associatePdbWithSeq(String choice, DataSourceType file, SequenceI sequence, boolean prompt, StructureSelectionManagerProvider ssmp, TFType tft, - String paeFilename) + String paeFilename, boolean doXferSettings) { PDBEntry entry = new PDBEntry(); StructureFile pdbfile = StructureSelectionManager .getStructureSelectionManager(ssmp) .setMapping(false, new SequenceI[] - { sequence }, null, choice, file, tft, paeFilename); + { sequence }, null, choice, file, tft, paeFilename, + doXferSettings); if (pdbfile == null) { // stacktrace already thrown so just return diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index fc73c27..7d2d907 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -1284,7 +1284,8 @@ public class StructureChooser extends GStructureChooser String pdbFilename = selectedPdbFileName; StructureChooser.openStructureFileForSequence(ssm, sc, ap, - selectedSequence, true, pdbFilename, tft, paeFilename); + selectedSequence, true, pdbFilename, tft, paeFilename, + true); } SwingUtilities.invokeLater(new Runnable() { @@ -1716,17 +1717,19 @@ public class StructureChooser extends GStructureChooser public static void openStructureFileForSequence( StructureSelectionManager ssm, StructureChooser sc, AlignmentPanel ap, SequenceI seq, boolean prompt, - String sFilename, TFType tft, String paeFilename) + String sFilename, TFType tft, String paeFilename, + boolean doXferSettings) { openStructureFileForSequence(ssm, sc, ap, seq, prompt, sFilename, tft, - paeFilename, false, true); + paeFilename, false, true, doXferSettings); } public static void openStructureFileForSequence( StructureSelectionManager ssm, StructureChooser sc, AlignmentPanel ap, SequenceI seq, boolean prompt, String sFilename, TFType tft, String paeFilename, - boolean forceHeadless, boolean showAnnotations) + boolean forceHeadless, boolean showAnnotations, + boolean doXferSettings) { boolean headless = forceHeadless; if (sc == null) @@ -1740,7 +1743,7 @@ public class StructureChooser extends GStructureChooser PDBEntry fileEntry = new AssociatePdbFileWithSeq().associatePdbWithSeq( sFilename, DataSourceType.FILE, seq, prompt, Desktop.instance, - tft, paeFilename); + tft, paeFilename, doXferSettings); // if headless, "false" in the sc constructor above will avoid GUI behaviour // in sc.launchStructureViewer() diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 1233940..b2cf262 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -82,6 +82,8 @@ public abstract class AlignFile extends FileParse private boolean dataClosed = false; + private boolean doXferSettings = true; + /** * @return if doParse() was called at construction time */ @@ -152,6 +154,12 @@ public abstract class AlignFile extends FileParse * @param source * @throws IOException */ + public AlignFile(FileParse source, boolean doXferSettings) + throws IOException + { + this(true, source, true, doXferSettings); + } + public AlignFile(FileParse source) throws IOException { this(true, source); @@ -174,12 +182,19 @@ public abstract class AlignFile extends FileParse public AlignFile(boolean parseImmediately, FileParse source, boolean closeData) throws IOException { + this(parseImmediately, source, closeData, true); + } + + public AlignFile(boolean parseImmediately, FileParse source, + boolean closeData, boolean doXferSettings) throws IOException + { super(source); initData(); // stash flag in case parse needs to know if it has to autoconfigure or was // configured after construction this.parseImmediately = parseImmediately; + this.doXferSettings = doXferSettings; if (parseImmediately) { @@ -206,7 +221,7 @@ public abstract class AlignFile extends FileParse + "Need to call initData() again before parsing can be reattempted."); } parseCalled = true; - parse(); + parse(this.doXferSettings); if (closeData && !dataClosed) { dataIn.close(); @@ -371,6 +386,18 @@ public abstract class AlignFile extends FileParse public abstract void parse() throws IOException; /** + * This method is only overridden by JmolParser because of its use in + * StructureFile to parse annotations + * + * @param doXferSettings + * @throws IOException + */ + public void parse(boolean doXferSettings) throws IOException + { + parse(); + } + + /** * A general parser for ids. * * @String id Id to be parsed @@ -452,4 +479,14 @@ public abstract class AlignFile extends FileParse { seqs.add(seq); } + + public void setDoXferSettings(boolean b) + { + doXferSettings = b; + } + + public boolean getDoXferSettings() + { + return doXferSettings; + } } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 971aba3..a2585b3 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -332,7 +332,8 @@ public class FileLoader implements Runnable MessageManager.getString("label.couldnt_read_data"), JvOptionPane.WARNING_MESSAGE); } - this.setShouldBeSaved(); + // don't set shouldBeSaved if didn't load anything + // this.setShouldBeSaved(); return; } // TODO: cache any stream datasources as a temporary file (eg. PDBs diff --git a/src/jalview/io/StructureFile.java b/src/jalview/io/StructureFile.java index f498c1e..fb416db 100644 --- a/src/jalview/io/StructureFile.java +++ b/src/jalview/io/StructureFile.java @@ -23,6 +23,7 @@ package jalview.io; import java.awt.Color; import java.io.IOException; import java.lang.reflect.Constructor; +import java.net.MalformedURLException; import java.util.List; import java.util.Vector; @@ -36,6 +37,7 @@ import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.datamodel.PDBEntry.Type; import jalview.datamodel.SequenceI; +import jalview.ext.jmol.JmolParser; import jalview.structure.StructureImportSettings; import jalview.structure.StructureImportSettings.TFType; import mc_view.PDBChain; @@ -125,7 +127,13 @@ public abstract class StructureFile extends AlignFile public StructureFile(FileParse fp) throws IOException { - super(fp); + this(fp, true); + } + + public StructureFile(FileParse fp, boolean doXferSettings) + throws IOException + { + super(fp, doXferSettings); } public void addSettings(boolean addAlignmentAnnotations, @@ -138,14 +146,17 @@ public abstract class StructureFile extends AlignFile public void xferSettings() { - this.visibleChainAnnotation = StructureImportSettings - .isVisibleChainAnnotation(); - this.predictSecondaryStructure = StructureImportSettings - .isProcessSecondaryStructure(); - this.externalSecondaryStructure = StructureImportSettings - .isExternalSecondaryStructure(); - this.temperatureFactorType = StructureImportSettings - .getTemperatureFactorType(); + if (this.getDoXferSettings()) + { + this.visibleChainAnnotation = StructureImportSettings + .isVisibleChainAnnotation(); + this.predictSecondaryStructure = StructureImportSettings + .isProcessSecondaryStructure(); + this.externalSecondaryStructure = StructureImportSettings + .isExternalSecondaryStructure(); + this.temperatureFactorType = StructureImportSettings + .getTemperatureFactorType(); + } } public StructureFile(boolean parseImmediately, Object dataObject, @@ -338,7 +349,7 @@ public abstract class StructureFile extends AlignFile { try { - processWithJmolParser(proteinSequences); + processWithJmolParser(proteinSequences, true); } catch (Exception x) { System.err.println( @@ -349,7 +360,8 @@ public abstract class StructureFile extends AlignFile } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void processWithJmolParser(List prot) throws Exception + private void NOTprocessWithJmolParser(List prot) + throws Exception { try { @@ -395,6 +407,36 @@ public abstract class StructureFile extends AlignFile StructureImportSettings.setShowSeqFeatures(true); } + private void processWithJmolParser(List prot, + boolean doXferSettings) throws MalformedURLException, IOException + { + FileParse fp = new FileParse(getDataName(), dataSourceType); + + StructureImportSettings.setShowSeqFeatures(false); + StructureImportSettings.setVisibleChainAnnotation(false); + StructureImportSettings + .setProcessSecondaryStructure(predictSecondaryStructure); + StructureImportSettings + .setExternalSecondaryStructure(externalSecondaryStructure); + StructureImportSettings.setTemperatureFactorType(temperatureFactorType); + JmolParser jmf = new JmolParser(fp, doXferSettings); + AlignmentI al = new Alignment((SequenceI[]) jmf.getSeqsAsArray()); + jmf.addAnnotations(al); + for (SequenceI sq : al.getSequences()) + { + if (sq.getDatasetSequence() != null) + { + sq.getDatasetSequence().getAllPDBEntries().clear(); + } + else + { + sq.getAllPDBEntries().clear(); + } + } + replaceAndUpdateChains(prot, al, AlignSeq.PEP, false); + StructureImportSettings.setShowSeqFeatures(true); + } + /** * Answers the first PDBChain found matching the given id, or null if none is * found diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index eb83f31..ad1fa4a 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -20,6 +20,18 @@ */ package jalview.renderer; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.geom.AffineTransform; +import java.awt.image.ImageObserver; +import java.util.BitSet; +import java.util.Hashtable; + import jalview.analysis.AAFrequency; import jalview.analysis.CodingUtils; import jalview.analysis.Rna; @@ -38,18 +50,6 @@ import jalview.schemes.ResidueProperties; import jalview.schemes.ZappoColourScheme; import jalview.util.Platform; -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Image; -import java.awt.geom.AffineTransform; -import java.awt.image.ImageObserver; -import java.util.BitSet; -import java.util.Hashtable; - public class AnnotationRenderer { private static final int UPPER_TO_LOWER = 'a' - 'A'; // 32 @@ -1077,22 +1077,22 @@ public class AnnotationRenderer .getRendererFor(row); if (renderer != null) { - renderer.renderRow(g, charWidth, charHeight, - hasHiddenColumns, av, hiddenColumns, columnSelection, - row, row_annotations, startRes, endRes, row.graphMin, + renderer.renderRow(g, charWidth, charHeight, hasHiddenColumns, + av, hiddenColumns, columnSelection, row, + row_annotations, startRes, endRes, row.graphMin, row.graphMax, y); } if (debugRedraw) { if (renderer == null) { - System.err.println("No renderer found for " - + row.toString()); + System.err + .println("No renderer found for " + row.toString()); } else { - System.err.println("rendered with " - + renderer.getClass().toString()); + System.err.println( + "rendered with " + renderer.getClass().toString()); } } @@ -1300,8 +1300,7 @@ public class AnnotationRenderer break; } - if (aa_annotations[column] == null - || aa_annotations[column - 1] == null) + if (aa_annotations[column] == null) { x++; continue; @@ -1316,6 +1315,25 @@ public class AnnotationRenderer g.setColor(aa_annotations[column].colour); } + if (aa_annotations[column - 1] == null + && aa_annotations.length > column + 1 + && aa_annotations[column + 1] == null) + { + // standalone value + y1 = y - (int) (((aa_annotations[column].value - min) / range) + * graphHeight); + g.drawLine(x * charWidth + charWidth / 4, y1, + x * charWidth + 3 * charWidth / 4, y1); + x++; + continue; + } + + if (aa_annotations[column - 1] == null) + { + x++; + continue; + } + y1 = y - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight); y2 = y - (int) (((aa_annotations[column].value - min) / range) diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index 3194cce..563f0e7 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -327,7 +327,7 @@ public class StructureSelectionManager IProgressIndicator progress) { return computeMapping(true, sequence, targetChains, pdbFile, protocol, - progress, null, null); + progress, null, null, true); } /** @@ -353,8 +353,17 @@ public class StructureSelectionManager String pdbFile, DataSourceType sourceType, TFType tft, String paeFilename) { + return setMapping(forStructureView, sequenceArray, targetChainIds, + pdbFile, sourceType, tft, paeFilename, true); + } + + synchronized public StructureFile setMapping(boolean forStructureView, + SequenceI[] sequenceArray, String[] targetChainIds, + String pdbFile, DataSourceType sourceType, TFType tft, + String paeFilename, boolean doXferSettings) + { return computeMapping(forStructureView, sequenceArray, targetChainIds, - pdbFile, sourceType, null, tft, paeFilename); + pdbFile, sourceType, null, tft, paeFilename, doXferSettings); } /** @@ -384,7 +393,8 @@ public class StructureSelectionManager synchronized public StructureFile computeMapping(boolean forStructureView, SequenceI[] sequenceArray, String[] targetChainIds, String pdbFile, DataSourceType sourceType, - IProgressIndicator progress, TFType tft, String paeFilename) + IProgressIndicator progress, TFType tft, String paeFilename, + boolean doXferSettings) { long progressSessionId = System.currentTimeMillis() * 3; @@ -394,8 +404,7 @@ public class StructureSelectionManager // FIXME: possibly should just delete boolean parseSecStr = processSecondaryStructure - ? isStructureFileProcessed(pdbFile, sequenceArray) - : false; + && !isStructureFileProcessed(pdbFile, sequenceArray); StructureFile pdb = null; boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts(); @@ -412,7 +421,11 @@ public class StructureSelectionManager pdb.addSettings(parseSecStr && processSecondaryStructure, parseSecStr && addTempFacAnnot, parseSecStr && secStructServices); + // save doXferSettings and reset after doParse() + boolean temp = pdb.getDoXferSettings(); + pdb.setDoXferSettings(doXferSettings); pdb.doParse(); + pdb.setDoXferSettings(temp); if (pdb.getId() != null && pdb.getId().trim().length() > 0 && DataSourceType.FILE == sourceType) { @@ -667,7 +680,7 @@ public class StructureSelectionManager private boolean isStructureFileProcessed(String pdbFile, SequenceI[] sequenceArray) { - boolean parseSecStr = true; + boolean processed = false; if (isPDBFileRegistered(pdbFile)) { for (SequenceI sq : sequenceArray) @@ -687,13 +700,13 @@ public class StructureSelectionManager // passed, not the structure data ID - if (PDBfile.isCalcIdForFile(ala, findIdForPDBFile(pdbFile))) { - parseSecStr = false; + processed = true; } } } } } - return parseSecStr; + return processed; } public void addStructureMapping(StructureMapping sm) diff --git a/src/jalview/ws/dbsources/EBIAlfaFold.java b/src/jalview/ws/dbsources/EBIAlfaFold.java index 8044717..a734f52 100644 --- a/src/jalview/ws/dbsources/EBIAlfaFold.java +++ b/src/jalview/ws/dbsources/EBIAlfaFold.java @@ -503,7 +503,6 @@ public class EBIAlfaFold extends EbiFileRetrievedProxy } SequenceI seq = sm.getSequence(); - Console.debug("##### SEQUENCE FOUND=" + seq.getName()); ContactMatrixI matrix = new PAEContactMatrix(seq, (Map) pae_obj); ((PAEContactMatrix) matrix).makeGroups(5f, true); diff --git a/src/mc_view/PDBfile.java b/src/mc_view/PDBfile.java index 2a89e61..21d3dcb 100755 --- a/src/mc_view/PDBfile.java +++ b/src/mc_view/PDBfile.java @@ -26,7 +26,6 @@ import java.util.Hashtable; import java.util.List; import java.util.Vector; -import jalview.bin.Console; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.DBRefSource; import jalview.datamodel.SequenceI; @@ -52,9 +51,7 @@ public class PDBfile extends StructureFile DataSourceType sourceType) throws IOException { super(false, dataObject, sourceType); - Console.debug("***** PDBfile constructor"); addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr); - Console.debug("***** About to doParse() 1"); doParse(); } @@ -63,7 +60,6 @@ public class PDBfile extends StructureFile { super(false, source); addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr); - Console.debug("***** About to doParse() 2"); doParse(); } -- 1.7.10.2