git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5a022fd
)
gracefully cope with non-standard nucleotide or amino acid symbols in pairwise alignment.
author
jprocter
<Jim Procter>
Mon, 2 Nov 2009 13:25:49 +0000
(13:25 +0000)
committer
jprocter
<Jim Procter>
Mon, 2 Nov 2009 13:25:49 +0000
(13:25 +0000)
src/jalview/analysis/AlignSeq.java
patch
|
blob
|
history
diff --git
a/src/jalview/analysis/AlignSeq.java
b/src/jalview/analysis/AlignSeq.java
index
02776f9
..
c9ae044
100755
(executable)
--- a/
src/jalview/analysis/AlignSeq.java
+++ b/
src/jalview/analysis/AlignSeq.java
@@
-113,6
+113,8
@@
public class AlignSeq
String type;
String type;
+ private int[] charToInt;
+
/**
* Creates a new AlignSeq object.
*
/**
* Creates a new AlignSeq object.
*
@@
-380,11
+382,13
@@
public class AlignSeq
if (type.equals(AlignSeq.PEP))
{
intToStr = pep;
if (type.equals(AlignSeq.PEP))
{
intToStr = pep;
+ charToInt = ResidueProperties.aaIndex;
defInt = 23;
}
else if (type.equals(AlignSeq.DNA))
{
intToStr = dna;
defInt = 23;
}
else if (type.equals(AlignSeq.DNA))
{
intToStr = dna;
+ charToInt = ResidueProperties.nucleotideIndex;
defInt = 4;
}
else
defInt = 4;
}
else
@@
-714,7
+718,7
@@
public class AlignSeq
{
E[i][0] = -gapOpen;
F[i][0] = max(score[i - 1][0] - gapOpen, F[i - 1][0] - gapExtend);
{
E[i][0] = -gapOpen;
F[i][0] = max(score[i - 1][0] - gapOpen, F[i - 1][0] - gapExtend);
-
+
score[i][0] = max(lookup[seq1[i]][seq2[0]] * 10, E[i][0], F[i][0]);
traceback[i][0] = -1;
}
score[i][0] = max(lookup[seq1[i]][seq2[0]] * 10, E[i][0], F[i][0]);
traceback[i][0] = -1;
}
@@
-834,33
+838,15
@@
public class AlignSeq
try
{
try
{
- if (type.equals("pep"))
+ seq1[i] = charToInt[c]; // set accordingly from setType
+ if (seq1[i]<0 || seq1[i] > defInt) // set from setType: 23 for peptides, or 4 for NA.
{
{
- seq1[i] = ResidueProperties.aaIndex[c];
- if (seq1[i] > 23)
- {
- seq1[i] = 23;
- }
+ seq1[i] = defInt;
}
}
- else if (type.equals("dna"))
- {
- seq1[i] = ResidueProperties.nucleotideIndex[c];
- if (seq1[i] > 4)
- {
- seq1[i] = 4;
- }
- }
-
+
} catch (Exception e)
{
} catch (Exception e)
{
- if (type.equals("dna"))
- {
- seq1[i] = 4;
- }
- else
- {
- seq1[i] = 23;
- }
+ seq1[i] = defInt;
}
}
}
}