From b4fcf4e6d26742a2dfeadc0e7b13bbca189c363e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 31 May 2018 17:35:35 +0100 Subject: [PATCH] JAL-1950 JAL-2629 insert gaps into HMM used to search DB - AVOIDS NEED TO RUN HMMALIGN AFTERWARDS ! --- src/jalview/hmmer/HMMSearch.java | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/jalview/hmmer/HMMSearch.java b/src/jalview/hmmer/HMMSearch.java index 409ef80..1883fef 100644 --- a/src/jalview/hmmer/HMMSearch.java +++ b/src/jalview/hmmer/HMMSearch.java @@ -365,7 +365,31 @@ public class HMMSearch extends HmmerCommand hmmSeq = hmmSeq.deriveSequence(); // otherwise all bad things happen hmmAndSeqs[0] = hmmSeq; System.arraycopy(seqs, 0, hmmAndSeqs, 1, seqCount); - + if (modelpos != null) + { + // TODO need - get ungapped sequence method + hmmSeq.setSequence( + hmmSeq.getDatasetSequence().getSequenceAsString()); + Annotation[] refpos = modelpos.annotations; + // insert gaps to match with refseq positions + int gc = 0, lcol = 0; + for (int c = 0; c < refpos.length; c++) + { + if (refpos[c] != null && ("x".equals(refpos[c].displayCharacter))) + { + if (gc > 0) + { + hmmSeq.insertCharAt(lcol + 1, gc, '-'); + } + gc = 0; + lcol = c; + } + else + { + gc++; + } + } + } if (realign) { realignResults(hmmAndSeqs); -- 1.7.10.2