From feb00a2deac901163f9d130b0ed0195b9ae73bfa Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 11 Feb 2005 10:39:20 +0000 Subject: [PATCH] bug fixed if featureEnd is beyond end of sequence --- src/jalview/analysis/SequenceFeatureFetcher.java | 25 ++++++++++++++++------ src/jalview/gui/FeatureRenderer.java | 3 +++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/jalview/analysis/SequenceFeatureFetcher.java b/src/jalview/analysis/SequenceFeatureFetcher.java index e034b3f..6560504 100755 --- a/src/jalview/analysis/SequenceFeatureFetcher.java +++ b/src/jalview/analysis/SequenceFeatureFetcher.java @@ -2,6 +2,7 @@ package jalview.analysis; import java.io.*; import java.util.*; +import javax.swing.*; import jalview.io.*; import jalview.gui.*; import jalview.datamodel.*; @@ -11,6 +12,9 @@ public class SequenceFeatureFetcher implements Runnable AlignmentI align; AlignmentPanel ap; ArrayList unknownSequences; + JInternalFrame outputFrame = new JInternalFrame(); + CutAndPasteTransfer output = new CutAndPasteTransfer(false); + StringBuffer sbuffer = new StringBuffer(); public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap) { @@ -80,7 +84,6 @@ public class SequenceFeatureFetcher implements Runnable remainingIds.append(ids.get(i) + ";"); EBIFetchClient ebi = new EBIFetchClient(); - System.out.println(remainingIds.toString()); String[] result = ebi.fetchData(remainingIds.toString(), "xml", null); if(result!=null) @@ -98,6 +101,16 @@ public class SequenceFeatureFetcher implements Runnable ap.RefreshPanels(); findMissingIds(align); + if(sbuffer.length()>0) + { + output.formatForOutput(); + outputFrame.setContentPane(output); + output.setText("Your sequences have been matched to Uniprot. Some of the ids have been\n" + +"altered, most likely the start/end residue will have been updated.\n" + +"Save your alignment to maintain the updated id.\n\n"+sbuffer.toString()); + Desktop.addInternalFrame(outputFrame, "Sequence names updated ", 600,300); + + } if(unknownSequences.size()>0) { @@ -132,13 +145,13 @@ void ReadUniprotFile(String [] result, RandomAccessFile out, AlignmentI align) sequence = align.findName( seqName.substring(0, seqName.indexOf('_'))); if(sequence!=null) { - System.out.println("changing "+sequence.getName()+" to "+seqName); + sbuffer.append("changing "+sequence.getName()+" to "+seqName+"\n"); sequence.setName(seqName); } } if(sequence==null) { - System.out.println("UNIPROT updated suggestion is "+result[r]); + sbuffer.append("UNIPROT updated suggestion is "+result[r]+"\n"); sequence = align.findName( result[r] ) ; // this entry has been suggested by ebi. @@ -230,7 +243,7 @@ void ReadUniprotFile(String [] result, RandomAccessFile out, AlignmentI align) { unknownSequences.add(sequence.getName()); features = null; - System.out.println(sequence.getName()+ "does not match "); + sbuffer.append(sequence.getName()+ " SEQUENCE NOT %100 MATCH \n"); continue; } @@ -238,8 +251,8 @@ void ReadUniprotFile(String [] result, RandomAccessFile out, AlignmentI align) absStart+=1; if(absStart!=sequence.getStart() || absEnd!=sequence.getEnd()) - System.out.println("Updated: "+sequence.getName()+" "+ - sequence.getStart()+"/"+sequence.getEnd()+" to "+ absStart+"/"+absEnd); + sbuffer.append("Updated: "+sequence.getName()+" "+ + sequence.getStart()+"/"+sequence.getEnd()+" to "+ absStart+"/"+absEnd+"\n"); sequence.setStart(absStart); diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 6a0daa8..59f446e 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -27,6 +27,9 @@ public class FeatureRenderer implements RendererI while( e.hasMoreElements() ) { SequenceFeature sf = (SequenceFeature)e.nextElement(); + if(sf.getStart()>seq.getEnd()) + continue; + int fstart = seq.findIndex(sf.getStart())-1; int fend = seq.findIndex(sf.getEnd())-1; -- 1.7.10.2