addBaseErrors(readBases, phredScaledErrorRate);
byte[] readQuals = new byte[readBases.length];
Arrays.fill(readQuals, (byte)phredScaledErrorRate);
GATKSAMRecord read = new GATKSAMRecord(header);
read.setBaseQualities(readQuals);
read.setReadBases(readBases);
read.setReadName(artificialReadName+readCounter++);
boolean isBeforeDeletion = alleleLength<refAlleleLength;
boolean isBeforeInsertion = alleleLength>refAlleleLength;
int eventLength = alleleLength - refAlleleLength;
if (isReference)
read.setCigarString(readBases.length + "M");
else {
if (isBeforeDeletion || isBeforeInsertion)
read.setCigarString((readOffset+1)+"M"+ Math.abs(eventLength) + (isBeforeDeletion?"D":"I") +
(readBases.length-readOffset)+"M");
else // SNP case
read.setCigarString(readBases.length+"M");
}
read.setReadPairedFlag(false);
read.setAlignmentStart(readStart);
read.setMappingQuality(artificialMappingQuality);
read.setReferenceName(loc.getContig());
read.setReadNegativeStrandFlag(false);
read.setReadGroup(sampleRG(sample));
pileupElements.add(LocusIteratorByState.createPileupForReadAndOffset(read, readOffset));
}
return pileupElements;