当前位置: 首页>>代码示例>>Java>>正文


Java Object2IntMap.remove方法代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.objects.Object2IntMap.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Object2IntMap.remove方法的具体用法?Java Object2IntMap.remove怎么用?Java Object2IntMap.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在it.unimi.dsi.fastutil.objects.Object2IntMap的用法示例。


在下文中一共展示了Object2IntMap.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: changeReads

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public void changeReads(final Map<GATKSAMRecord, GATKSAMRecord> readRealignments) {
    final int sampleCount = samples.sampleCount();
    for (int s = 0; s < sampleCount; s++) {
        final GATKSAMRecord[] sampleReads = readsBySampleIndex[s];
        final Object2IntMap<GATKSAMRecord> readIndex = readIndexBySampleIndex[s];
        final int sampleReadCount = sampleReads.length;
        for (int r = 0; r < sampleReadCount; r++) {
            final GATKSAMRecord read = sampleReads[r];
            final GATKSAMRecord replacement = readRealignments.get(read);
            if (replacement == null)
                continue;
            sampleReads[r] = replacement;
            if (readIndex != null) {
                readIndex.remove(read);
                readIndex.put(replacement, r);
            }
        }
    }
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:20,代码来源:ReadLikelihoods.java

示例2: changeReads

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public void changeReads(final Map<GATKRead, GATKRead> readRealignments) {
    final int sampleCount = samples.numberOfSamples();
    for (int s = 0; s < sampleCount; s++) {
        final GATKRead[] sampleReads = readsBySampleIndex[s];
        final Object2IntMap<GATKRead> readIndex = readIndexBySampleIndex[s];
        final int sampleReadCount = sampleReads.length;
        for (int r = 0; r < sampleReadCount; r++) {
            final GATKRead read = sampleReads[r];
            final GATKRead replacement = readRealignments.get(read);
            if (replacement == null) {
                continue;
            }
            sampleReads[r] = replacement;
            if (readIndex != null) {
                readIndex.remove(read);
                readIndex.put(replacement, r);
            }
        }
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:21,代码来源:ReadLikelihoods.java

示例3: removeSampleReads

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
private void removeSampleReads(final int sampleIndex, final IntArrayList indexToRemove, final int alleleCount) {
    final int removeCount = indexToRemove.size();
    if (removeCount == 0)
        return;

    final GATKSAMRecord[] sampleReads = readsBySampleIndex[sampleIndex];
    final int sampleReadCount = sampleReads.length;

    final Object2IntMap<GATKSAMRecord> indexByRead = readIndexBySampleIndex[sampleIndex];
    if (indexByRead != null)
        for (int i = 0; i < removeCount; i++)
            indexByRead.remove(sampleReads[indexToRemove.getInt(i)]);
    final boolean[] removeIndex = new boolean[sampleReadCount];
    int firstDeleted = indexToRemove.get(0);
    for (int i = 0; i < removeCount; i++)
        removeIndex[indexToRemove.get(i)] = true;

    final int newSampleReadCount = sampleReadCount - removeCount;

    // Now we skim out the removed reads from the read array.
    final GATKSAMRecord[] oldSampleReads = readsBySampleIndex[sampleIndex];
    final GATKSAMRecord[] newSampleReads = new GATKSAMRecord[newSampleReadCount];

    System.arraycopy(oldSampleReads, 0, newSampleReads, 0, firstDeleted);
    Utils.skimArray(oldSampleReads, firstDeleted, newSampleReads, firstDeleted, removeIndex, firstDeleted);

    // Then we skim out the likelihoods of the removed reads.
    final double[][] oldSampleValues = valuesBySampleIndex[sampleIndex];
    final double[][] newSampleValues = new double[alleleCount][newSampleReadCount];
    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);
    }
    valuesBySampleIndex[sampleIndex] = newSampleValues;
    readsBySampleIndex[sampleIndex] = newSampleReads;
    readListBySampleIndex[sampleIndex] = null; // reset the unmodifiable list.
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:38,代码来源:ReadLikelihoods.java

示例4: removeSampleReads

import it.unimi.dsi.fastutil.objects.Object2IntMap; //导入方法依赖的package包/类
public void removeSampleReads(final int sampleIndex, final Collection<GATKRead> readsToRemove, final int alleleCount) {
    final GATKRead[] sampleReads = readsBySampleIndex[sampleIndex];
    final int sampleReadCount = sampleReads.length;

    final Object2IntMap<GATKRead> indexByRead = readIndexBySampleIndex(sampleIndex);
    // Count how many we are going to remove, which ones (indexes) and remove entry from the read-index map.
    final boolean[] removeIndex = new boolean[sampleReadCount];
    int removeCount = 0; // captures the number of deletions.
    int firstDeleted = sampleReadCount;    // captures the first position that was deleted.

    final Iterator<GATKRead> readsToRemoveIterator = readsToRemove.iterator();
    while (readsToRemoveIterator.hasNext()) {
        final GATKRead read = readsToRemoveIterator.next();
        if (indexByRead.containsKey(read)) {
            final int index = indexByRead.getInt(read);
            if (firstDeleted > index) {
                firstDeleted = index;
            }
            removeCount++;
            removeIndex[index] = true;
            readsToRemoveIterator.remove();
            indexByRead.remove(read);
        }
    }

    // Nothing to remove we just finish here.
    if (removeCount == 0) {
        return;
    }

    final int newSampleReadCount = sampleReadCount - removeCount;

    // Now we skim out the removed reads from the read array.
    final GATKRead[] oldSampleReads = readsBySampleIndex[sampleIndex];
    final GATKRead[] newSampleReads = new GATKRead[newSampleReadCount];

    System.arraycopy(oldSampleReads,0,newSampleReads,0,firstDeleted);
    Utils.skimArray(oldSampleReads,firstDeleted, newSampleReads, firstDeleted, removeIndex, firstDeleted);

    // Update the indices for the extant reads from the first deletion onwards.
    for (int r = firstDeleted; r < newSampleReadCount; r++) {
        indexByRead.put(newSampleReads[r], r);
    }

    // Then we skim out the likelihoods of the removed reads.
    final double[][] oldSampleValues = valuesBySampleIndex[sampleIndex];
    final double[][] newSampleValues = new double[alleleCount][newSampleReadCount];
    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);
    }
    valuesBySampleIndex[sampleIndex] = newSampleValues;
    readsBySampleIndex[sampleIndex] = newSampleReads;
    readListBySampleIndex[sampleIndex] = null; // reset the unmodifiable list.
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:56,代码来源:ReadLikelihoods.java


注:本文中的it.unimi.dsi.fastutil.objects.Object2IntMap.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。