From: TZVanaalten Date: Fri, 1 Sep 2017 14:18:09 +0000 (+0100) Subject: JAL-2629 manual curation of HMMs via reference annotation functional X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=dbdc8807d9059dacf65a087b7bcb8363be53fb8f;p=jalview.git JAL-2629 manual curation of HMMs via reference annotation functional --- diff --git a/src/jalview/hmmer/HMMAlignThread.java b/src/jalview/hmmer/HMMAlignThread.java index 532271b..5eec1c4 100644 --- a/src/jalview/hmmer/HMMAlignThread.java +++ b/src/jalview/hmmer/HMMAlignThread.java @@ -125,7 +125,7 @@ public class HMMAlignThread implements Runnable try { cmds.exportData(seqs, outTemp.getAbsoluteFile(), hmm, - hmmTemp.getAbsoluteFile()); + hmmTemp.getAbsoluteFile(), null); } catch (IOException e1) { e1.printStackTrace(); diff --git a/src/jalview/hmmer/HMMBuildThread.java b/src/jalview/hmmer/HMMBuildThread.java index f940fbb..2fdc97b 100644 --- a/src/jalview/hmmer/HMMBuildThread.java +++ b/src/jalview/hmmer/HMMBuildThread.java @@ -234,7 +234,16 @@ public class HMMBuildThread implements Runnable } cmds.uniquifySequences(newArr); - cmds.exportData(newArr, stoTemp, null, null); + + if (forGroup) + { + cmds.exportData(newArr, stoTemp, null, null, group); + } + else + { + cmds.exportData(newArr, stoTemp, null, null, alignment); + } + jalview.analysis.SeqsetUtils.deuniquify(cmds.hash, array); } catch (FileNotFoundException e) @@ -330,8 +339,11 @@ public class HMMBuildThread implements Runnable { if (af != null) { + if (af.getTitle().length() < 15) + { name = af.getTitle(); } + } if (name == null || "".equals(name)) { name = "Alignment"; @@ -362,7 +374,8 @@ public class HMMBuildThread implements Runnable */ private void importData() throws IOException, InterruptedException { - HMMFile file = new HMMFile(new FileParse(hmmTemp.getAbsolutePath(), + HMMFile file = new HMMFile( + new FileParse(hmmTemp.getAbsolutePath(), DataSourceType.FILE)); SequenceI[] seqs = file.getSeqsAsArray(); SequenceI seq = seqs[0]; diff --git a/src/jalview/hmmer/HMMERCommands.java b/src/jalview/hmmer/HMMERCommands.java index ba4c57b..4c1748b 100644 --- a/src/jalview/hmmer/HMMERCommands.java +++ b/src/jalview/hmmer/HMMERCommands.java @@ -1,7 +1,9 @@ package jalview.hmmer; import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.HiddenMarkovModel; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; @@ -128,12 +130,24 @@ public class HMMERCommands * @throws IOException */ public void exportData(SequenceI[] seqs, - File stoLocation, HiddenMarkovModel hmm, File hmmLocation) + File stoLocation, HiddenMarkovModel hmm, File hmmLocation, + AnnotatedCollectionI al) throws IOException { if (seqs != null) { - StockholmFile file = new StockholmFile(new Alignment(seqs)); + AlignmentI newAl = new Alignment(seqs); + if (stoLocation != null) + { + for (AlignmentAnnotation annot : al.getAlignmentAnnotation()) + { + if (annot.label.contains("Reference") || "RF".equals(annot.label)) + { + newAl.addAnnotation(annot); + } + } + } + StockholmFile file = new StockholmFile(newAl); String output = file.print(seqs, false); PrintWriter writer = new PrintWriter(stoLocation); writer.println(output); diff --git a/src/jalview/hmmer/HMMSearchThread.java b/src/jalview/hmmer/HMMSearchThread.java index 4012cfe..8adeb22 100644 --- a/src/jalview/hmmer/HMMSearchThread.java +++ b/src/jalview/hmmer/HMMSearchThread.java @@ -118,7 +118,7 @@ public class HMMSearchThread implements Runnable } try { - cmds.exportData(null, null, hmm, hmmTemp.getAbsoluteFile()); + cmds.exportData(null, null, hmm, hmmTemp.getAbsoluteFile(), null); } catch (IOException e1) { e1.printStackTrace(); diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 3644ff9..efd45eb 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -1069,6 +1069,10 @@ public class StockholmFile extends AlignFile { label = aa.label; } + else if ("RF".equals(key)) + { + label = key; + } else { label = key + "_cons"; diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index c2c2c5d..9b4e1fe 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -3146,7 +3146,7 @@ public abstract class AlignmentViewport AlignmentAnnotation[] annots = this.alignment.getAlignmentAnnotation(); for (AlignmentAnnotation annot : annots) { - if ("RF".equals(annot.getCalcId())) + if ("RF".equals(annot.label) || annot.label.contains("Reference")) { return true; }