ad3a176457ad1d21a0fedc47f349ec3484e751f1 angie Fri Feb 9 16:27:51 2018 -0800 Cleaning up some old ugliness about the size parameter to isAllDna and isAllNt. hgc's printSnpAlignment code that parsed snpNNN.fa was using lineSize as length but lineSize is length+1. Then isAllDna was written with "i<size-1" as the loop test instead of "i < size". I didn't fix that properly when I separated out isAllNt from isAllDna. Later, I (re?)discovered that isAllNt needed length+1 as its size and just added some FIXME comments. Thanks Brian R for prodding me to actually fix it. refs #20895 diff --git src/inc/iupac.h src/inc/iupac.h index 2ff3318..0d94f8f 100644 --- src/inc/iupac.h +++ src/inc/iupac.h @@ -1,42 +1,63 @@ /* iupac - routines to help cope with IUPAC ambiguity codes in DNA sequence. */ #ifndef IUPAC_H #define IUPAC_H boolean iupacMatch(char iupac, char dna); /* See if iupac ambiguity code matches dna character */ boolean iupacMatchLower(char iupac, char dna); /* See if iupac ambiguity code matches dna character where * both are lower case */ boolean isIupac(char c); /* See if iupac c is a legal iupac char */ boolean isIupacLower(char c); /* See if iupac c is a legal (lower case) iupac char */ void iupacFilter(char *in, char *out); /* Filter out non-DNA non-UIPAC ambiguity code characters and change to lower case. */ boolean anyIupac(char *s); /* Return TRUE if there are any IUPAC ambiguity codes in s */ char iupacComplementBaseLower(char iupac); /* Return IUPAC complement for a single base */ void iupacComplementLower(char *iupac, int iuSize); /* Return IUPAC complement many bases. Assumes iupac is lower case. */ void iupacReverseComplement(char *iu, int iuSize); /* Reverse complement a string containing DNA and IUPAC codes. Result will be always * lower case. */ boolean iupacMatchStart(char *iupacPrefix, char *dnaString); /* Return TRUE if start of DNA is compatible with iupac */ char *iupacIn(char *needle, char *haystack); /* Return first place in haystack (DNA) that matches needle that may contain IUPAC codes. */ +INLINE boolean isIupacAmbiguous(char c) +/* Return TRUE if c is an IUPAC ambiguity code. */ +{ +switch (tolower(c)) + { + case 'r': + case 'y': + case 's': + case 'w': + case 'k': + case 'm': + case 'b': + case 'd': + case 'h': + case 'v': + case 'n': + return TRUE; + } +return FALSE; +} + #endif /* IUPAC_H */