本文整理了Java中org.broadinstitute.gatk.utils.Utils.skimArray()
方法的一些代码示例,展示了Utils.skimArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.skimArray()
方法的具体详情如下:
包路径:org.broadinstitute.gatk.utils.Utils
类名称:Utils
方法名:skimArray
[英]Skims out positions of an array returning a shorter one with the remaning positions in the same order.
If the dest array provide is not long enough a new one will be created and returned with the same component type. All elements before destOffset will be copied from the input to the result array. If dest is null, a brand-new array large enough will be created where the position preceding destOffset will be left with the default value. The component type Will match the one of the source array.
[中]略过数组中的位置,以相同的顺序返回一个较短的数组。
如果dest数组不够长,将创建一个新数组,并返回相同的组件类型。destOffset之前的所有元素都将从输入复制到结果数组。如果dest为空,将创建一个足够大的全新数组,其中destOffset前面的位置将保留默认值。组件类型将与源阵列的类型匹配。
代码示例来源:origin: broadgsa/gatk
/**
* Skims out positions of an array returning a shorter one with the remaning positions in the same order.
* @param original the original array to splice.
* @param remove for each position in {@code original} indicates whether it should be spliced away ({@code true}),
* or retained ({@code false})
*
* @param <T> the array type.
*
* @throws IllegalArgumentException if either {@code original} or {@code remove} is {@code null},
* or {@code remove length is different to {@code original}'s}, or {@code original} is not in
* fact an array.
*
* @return never {@code null}.
*/
public static <T> T skimArray(final T original, final boolean[] remove) {
return skimArray(original,0,null,0,remove,0);
}
代码示例来源:origin: broadgsa/gatk
if (length < 0)
throw new IllegalArgumentException("the source offset goes beyond the source array length");
return skimArray(source,sourceOffset,dest,destOffset,remove,removeOffset,length);
代码示例来源:origin: broadgsa/gatk
@Test(dataProvider = "skimArrayData")
public void testSkimArray(final String original, final String remove) {
final StringBuilder resultBuilder = new StringBuilder();
final boolean[] removeBoolean = new boolean[remove.length()];
for (int i = 0; i < original.length(); i++)
if (remove.charAt(i) == '1') {
resultBuilder.append(original.charAt(i));
removeBoolean[i] = false;
} else
removeBoolean[i] = true;
final String expected = resultBuilder.toString();
final byte[] resultBytes = Utils.skimArray(original.getBytes(),removeBoolean);
final String resultString = new String(resultBytes);
Assert.assertEquals(resultString,expected);
}
代码示例来源:origin: broadgsa/gatk
Utils.skimArray(oldSampleReads,firstDeleted, newSampleReads, firstDeleted, removeIndex, firstDeleted);
for (int a = 0; a < alleleCount; a++) {
System.arraycopy(oldSampleValues[a],0,newSampleValues[a],0,firstDeleted);
Utils.skimArray(oldSampleValues[a], firstDeleted, newSampleValues[a], firstDeleted, removeIndex, firstDeleted);
代码示例来源:origin: broadgsa/gatk
Utils.skimArray(oldSampleReads,firstDeleted, newSampleReads, firstDeleted, removeIndex, firstDeleted);
for (int a = 0; a < alleleCount; a++) {
System.arraycopy(oldSampleValues[a],0,newSampleValues[a],0,firstDeleted);
Utils.skimArray(oldSampleValues[a], firstDeleted, newSampleValues[a], firstDeleted, removeIndex, firstDeleted);
内容来源于网络,如有侵权,请联系作者删除!