Misc. additions to correct utilities
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3329 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
64ccaa4c6a
commit
504103bd15
|
|
@ -192,6 +192,10 @@ public class BaseUtils {
|
||||||
return isRegularBase((char)base);
|
return isRegularBase((char)base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public boolean isNBase(char base) {
|
||||||
|
return isNBase((byte)base);
|
||||||
|
}
|
||||||
|
|
||||||
static public boolean isNBase(byte base) {
|
static public boolean isNBase(byte base) {
|
||||||
return base == 'N';
|
return base == 'N';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -710,9 +710,20 @@ public class MathUtils {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static byte getQScoreMedian(List<SAMRecord> reads, List<Integer> offsets) {
|
public static byte getQScoreMedian(List<SAMRecord> reads, List<Integer> offsets) {
|
||||||
return getQScoreOrderStatistic(reads, offsets, (int)Math.floor(reads.size()/2.));
|
return getQScoreOrderStatistic(reads, offsets, (int)Math.floor(reads.size()/2.));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// useful common utility routines
|
||||||
|
//
|
||||||
|
public static double rate(long n, long d) { return n / (1.0 * Math.max(d, 1)); }
|
||||||
|
public static double rate(int n, int d) { return n / (1.0 * Math.max(d, 1)); }
|
||||||
|
|
||||||
|
public static long inverseRate(long n, long d) { return n == 0 ? 0 : d / Math.max(n, 1); }
|
||||||
|
public static long inverseRate(int n, int d) { return n == 0 ? 0 : d / Math.max(n, 1); }
|
||||||
|
|
||||||
|
public static double ratio(int num, int denom) { return ((double)num) / (Math.max(denom, 1)); }
|
||||||
|
public static double ratio(long num, long denom) { return ((double)num) / (Math.max(denom, 1)); }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue