本文整理汇总了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);
}
}
}
}
示例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);
}
}
}
}
示例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.
}
示例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.
}