本文整理了Java中org.broadinstitute.gatk.utils.sam.GATKSAMRecord.createRandomRead()
方法的一些代码示例,展示了GATKSAMRecord.createRandomRead()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GATKSAMRecord.createRandomRead()
方法的具体详情如下:
包路径:org.broadinstitute.gatk.utils.sam.GATKSAMRecord
类名称:GATKSAMRecord
方法名:createRandomRead
暂无
代码示例来源:origin: broadgsa/gatk
@Test (enabled = true)
public void testGetBasesReverseComplement() {
int iterations = 1000;
Random random = Utils.getRandomGenerator();
while(iterations-- > 0) {
final int l = random.nextInt(1000);
GATKSAMRecord read = GATKSAMRecord.createRandomRead(l);
byte [] original = read.getReadBases();
byte [] reconverted = new byte[l];
String revComp = ReadUtils.getBasesReverseComplement(read);
for (int i=0; i<l; i++) {
reconverted[l-1-i] = BaseUtils.getComplement((byte) revComp.charAt(i));
}
Assert.assertEquals(reconverted, original);
}
}
代码示例来源:origin: broadgsa/gatk-protected
@Test
public void testExcessAlternativeAllelesKeepRef(){
// prep data
final Allele ref = Allele.create("A", true);
final Allele altC = Allele.create("C", false);
final Allele altG = Allele.create("G", false);
final Allele altT = Allele.create("T", false);
final AlleleList<Allele> indexedAlleleList = new IndexedAlleleList<>(altC, altG, altT, ref);// specifically make the ref allele not at index 0
final IndexedSampleList indexedSampleList = new IndexedSampleList("Dummy");
final List<GATKSAMRecord> reads = new ArrayList<>();
for (int i=0; i<10; ++i) {
reads.add(GATKSAMRecord.createRandomRead(101));
}
final Map<String, List<GATKSAMRecord>> sampleToReads = Collections.singletonMap(indexedSampleList.sampleAt(0), reads);
final ReadLikelihoods<Allele> readLikelihoods = new ReadLikelihoods<>(indexedSampleList, indexedAlleleList, sampleToReads);
final PloidyModel ploidyModel = new HomogeneousPloidyModel(indexedSampleList, 2);
final GenotypingModel genotypingModel = new InfiniteRandomMatingPopulationModel();
final GenotypingLikelihoods<Allele> genotypeLikelihoods = genotypingModel.calculateLikelihoods(readLikelihoods, new GenotypingData<>(ploidyModel, readLikelihoods));
// test
final Set<Allele> excessAltAlleles = HaplotypeCallerGenotypingEngine.excessAlternativeAlleles(genotypeLikelihoods, 2);
Assert.assertFalse(excessAltAlleles.contains(ref));
Assert.assertEquals(excessAltAlleles.size(), 1);
}
内容来源于网络,如有侵权,请联系作者删除!