use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class RMSMappingQualityUnitTest method testEmptyLikelihoods.
@Test
public void testEmptyLikelihoods() throws Exception {
final List<GATKRead> reads = Collections.emptyList();
final Map<String, List<GATKRead>> readsBySample = ImmutableMap.of("sample1", reads);
final org.broadinstitute.hellbender.utils.genotyper.SampleList sampleList = new IndexedSampleList(Arrays.asList("sample1"));
final AlleleList<Allele> alleleList = new IndexedAlleleList<>(Arrays.asList(Allele.create("A")));
final ReadLikelihoods<Allele> likelihoods = new ReadLikelihoods<>(sampleList, alleleList, readsBySample);
final VariantContext vc = makeVC();
final ReferenceContext referenceContext = null;
final Map<String, Object> annotate = new RMSMappingQuality().annotate(referenceContext, vc, likelihoods);
Assert.assertTrue(annotate.isEmpty());
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class FragmentCollectionUnitTest method createFromMultiSamplePileup.
@Test
public void createFromMultiSamplePileup() throws Exception {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader();
final GATKRead read1 = ArtificialReadUtils.createArtificialRead(header, "10M");
final GATKRead read2 = ArtificialReadUtils.createArtificialRead(header, "10M");
read1.setPosition(new SimpleInterval("22", 200, 210));
read2.setPosition(new SimpleInterval("22", 208, 218));
read1.setMatePosition(read2);
read2.setMatePosition(read1);
final Locatable loc = new SimpleInterval("22", 208, 208);
final Map<String, ReadPileup> stratified = new LinkedHashMap<>();
stratified.put("sample1", new ReadPileup(loc, Arrays.asList(read2), 0));
stratified.put("sample2", new ReadPileup(loc, Arrays.asList(read1), 9));
final ReadPileup combined = new ReadPileup(loc, stratified);
final FragmentCollection<PileupElement> elements = FragmentCollection.create(combined);
Assert.assertTrue(elements.getSingletonReads().isEmpty());
Assert.assertEquals(elements.getOverlappingPairs().size(), 1);
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class FragmentUtilsUnitTest method makeOverlappingRead.
private GATKRead makeOverlappingRead(final String leftFlank, final int leftQual, final String overlapBases, final byte[] overlapQuals, final String rightFlank, final int rightQual, final int alignmentStart) {
final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader();
header.addReadGroup(new SAMReadGroupRecord("RG1"));
final String bases = leftFlank + overlapBases + rightFlank;
final int readLength = bases.length();
final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, alignmentStart, readLength);
final byte[] leftQuals = Utils.dupBytes((byte) leftQual, leftFlank.length());
final byte[] rightQuals = Utils.dupBytes((byte) rightQual, rightFlank.length());
final byte[] quals = Utils.concat(leftQuals, overlapQuals, rightQuals);
read.setCigar(readLength + "M");
read.setBases(bases.getBytes());
read.setBaseQualities(quals);
read.setReadGroup("RG1");
read.setMappingQuality(60);
return read;
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class FractionalDownsamplerUnitTest method testSignalNoMoreReadsBefore.
@Test
public void testSignalNoMoreReadsBefore() throws Exception {
FractionalDownsampler rd = new FractionalDownsampler(0.1);
final GATKRead r1 = ArtificialReadUtils.createArtificialRead("100M");
final GATKRead r2 = ArtificialReadUtils.createArtificialRead("101M");
rd.submit(r1);
//no op
rd.signalNoMoreReadsBefore(r2);
rd.submit(r2);
}
use of org.broadinstitute.hellbender.utils.read.GATKRead in project gatk by broadinstitute.
the class PassThroughDownsamplerUnitTest method testConsumeFinalizedItems.
@Test
public void testConsumeFinalizedItems() throws Exception {
final PassThroughDownsampler ptd = new PassThroughDownsampler();
for (int i = 0; i < 10; i++) {
final GATKRead read = ArtificialReadUtils.createArtificialRead("100M");
ptd.submit(read);
}
Assert.assertEquals(ptd.size(), 10);
ptd.signalEndOfInput();
ptd.signalNoMoreReadsBefore(ptd.peekFinalized());
Assert.assertEquals(ptd.size(), 10);
final List<GATKRead> finalizedItems = ptd.consumeFinalizedItems();
Assert.assertEquals(finalizedItems.size(), 10);
Assert.assertEquals(ptd.size(), 0);
}
Aggregations