I have added the missing ambiguities to DNATools.java and then used these in
SCF.java.
The two patches are appended to this email.
Greetings,
Daniel
"Richard Holland" <[EMAIL PROTECTED]> wrote:
> A patch would be much appreciated!
>
> cheers,
> Richard
>
> 2008/10/31 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > True. It was a first quick and dirty hack to get the rest of my project
> going.
> >
> > I think adding support of the IUPAC ambiguities to DNATools would be the
> most
> > approbate solution. The SCF class can then easily be adapted.
> >
> > Are there any plans to do so?
> > If not, I could give it a try and submit a patch for DNATools and SCF.
> >
> > Greetings,
> > Daniel
> >
> > "Richard Holland" <[EMAIL PROTECTED]> wrote:
> >
> >> It is the correct method, yes.
> >>
> >> However your code constructs a new hash set every time it does the
> >> check for W or S etc.. It would be much more efficient to create
> >> class-static references to the ambiguity symbols you need, instead of
> >> (re)creating them every time they're encountered. A class-static gap
> >> symbol reference would also be good in this situation.
> >>
> >> cheers,
> >> Richard
> >>
> >>
> >>
> >> 2008/10/31 [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> >> > Hello,
> >> >
> >> >
> >> > I am using the SCF class in the context of HIV-1 population sequencing.
> In
> >> > this context we do have sometimes ambiguous base calls. To support them
I
> >> > extended the SCF class to allow for IUPAC ambiguities up to 2
> nucleotides.
> >> >
> >> > Therefore I simply added the following code to the "decode" function:
> >> >
> >> > #########################
> >> > public Symbol decode(byte call) throws IllegalSymbolException {
> >> >
> >> > //get the DNA Alphabet
> >> > Alphabet dna = DNATools.getDNA();
> >> >
> >> > char c = (char) call;
> >> > switch (c) {
> >> > case 'a':
> >> > case 'A':
> >> > return DNATools.a();
> >> > case 'c':
> >> > case 'C':
> >> > return DNATools.c();
> >> > case 'g':
> >> > case 'G':
> >> > return DNATools.g();
> >> > case 't':
> >> > case 'T':
> >> > return DNATools.t();
> >> > case 'n':
> >> > case 'N':
> >> > return DNATools.n();
> >> > case '-':
> >> > return DNATools.getDNA().getGapSymbol();
> >> > case 'w':
> >> > case 'W':
> >> > //make the 'W' symbol
> >> > Set symbolsThatMakeW = new HashSet();
> >> > symbolsThatMakeW.add(DNATools.a());
> >> > symbolsThatMakeW.add(DNATools.t());
> >> > Symbol w = dna.getAmbiguity(symbolsThatMakeW);
> >> > return w;
> >> > case 's':
> >> > case 'S':
> >> > //make the 'S' symbol
> >> > Set symbolsThatMakeS = new HashSet();
> >> > symbolsThatMakeS.add(DNATools.c());
> >> > symbolsThatMakeS.add(DNATools.g());
> >> > Symbol s = dna.getAmbiguity(symbolsThatMakeS);
> >> > return s;
> >> > ... (and so on)
> >> > #########################
> >> >
> >> > Is this the right way to do it? And if so, how can this code be
submitted
> > to
> >> > the official biojava source code?
> >> >
> >> >
> >> > Best regards,
> >> > Daniel Struck
> >> > _________________________________________________________
> >> > Mail sent using root eSolutions Webmailer - www.root.lu
> >> >
> >> >
> >> > _______________________________________________
> >> > Biojava-l mailing list - [email protected]
> >> > http://lists.open-bio.org/mailman/listinfo/biojava-l
> >> >
> >>
> >>
> >
> >
> > _________________________________________________________
> > Mail sent using root eSolutions Webmailer - www.root.lu
> >
> >
> >
>
>
_________________________________________________________
Mail sent using root eSolutions Webmailer - www.root.lu
--- DNATools.java.orig 2008-11-03 15:07:22.000000000 +0100
+++ DNATools.java 2008-11-03 15:12:29.000000000 +0100
@@ -69,6 +69,17 @@
static private final AtomicSymbol c;
static private final AtomicSymbol t;
static private final Symbol n;
+ static private final Symbol m;
+ static private final Symbol r;
+ static private final Symbol w;
+ static private final Symbol s;
+ static private final Symbol y;
+ static private final Symbol k;
+ static private final Symbol v;
+ static private final Symbol h;
+ static private final Symbol d;
+ static private final Symbol b;
+
static private final SimpleReversibleTranslationTable transcriptionTable;
@@ -78,12 +89,22 @@
try {
dna = (FiniteAlphabet) AlphabetManager.alphabetForName("DNA");
dnaTokens = dna.getTokenization("token");
- SymbolList syms = new SimpleSymbolList(dnaTokens, "agctn");
+ SymbolList syms = new SimpleSymbolList(dnaTokens, "agctnmrwsykvhdb");
a = (AtomicSymbol) syms.symbolAt(1);
g = (AtomicSymbol) syms.symbolAt(2);
c = (AtomicSymbol) syms.symbolAt(3);
t = (AtomicSymbol) syms.symbolAt(4);
n = syms.symbolAt(5);
+ m = syms.symbolAt(6);
+ r = syms.symbolAt(7);
+ w = syms.symbolAt(8);
+ s = syms.symbolAt(9);
+ y = syms.symbolAt(10);
+ k = syms.symbolAt(11);
+ v = syms.symbolAt(12);
+ h = syms.symbolAt(13);
+ d = syms.symbolAt(14);
+ b = syms.symbolAt(15);
symbolToComplement = new HashMap();
@@ -123,7 +144,17 @@
public static AtomicSymbol c() { return c; }
public static AtomicSymbol t() { return t; }
public static Symbol n() { return n; }
-
+ public static Symbol m() { return m; }
+ public static Symbol r() { return r; }
+ public static Symbol w() { return w; }
+ public static Symbol s() { return s; }
+ public static Symbol y() { return y; }
+ public static Symbol k() { return k; }
+ public static Symbol v() { return v; }
+ public static Symbol h() { return h; }
+ public static Symbol d() { return d; }
+ public static Symbol b() { return b; }
+
private DNATools() {
}
--- SCF.java.orig 2008-11-03 16:06:00.000000000 +0100
+++ SCF.java 2008-11-03 16:04:43.000000000 +0100
@@ -266,6 +266,26 @@
return DNATools.t();
case 'n': case 'N':
return DNATools.n();
+ case 'm': case 'M':
+ return DNATools.m();
+ case 'r': case 'R':
+ return DNATools.r();
+ case 'w': case 'W':
+ return DNATools.w();
+ case 's': case 'S':
+ return DNATools.s();
+ case 'y': case 'Y':
+ return DNATools.y();
+ case 'k': case 'K':
+ return DNATools.k();
+ case 'v': case 'V':
+ return DNATools.v();
+ case 'h': case 'H':
+ return DNATools.h();
+ case 'd': case 'D':
+ return DNATools.d();
+ case 'b': case 'B':
+ return DNATools.b();
case '-':
return DNATools.getDNA().getGapSymbol();
default:
_______________________________________________
Biojava-l mailing list - [email protected]
http://lists.open-bio.org/mailman/listinfo/biojava-l