private GATKSAMReadGroupRecord createRG(String name) { GATKSAMReadGroupRecord rg = new GATKSAMReadGroupRecord(name); rg.setPlatform("ILLUMINA"); rg.setSample(name); return rg; }
/** * Section of code shared between the two recalibration walkers which uses the command line arguments to adjust attributes of the read such as quals or platform string * * @param read The read to adjust * @param RAC The list of shared command line arguments */ public static void parsePlatformForRead(final GATKSAMRecord read, final RecalibrationArgumentCollection RAC) { GATKSAMReadGroupRecord readGroup = read.getReadGroup(); if (RAC.FORCE_PLATFORM != null && (readGroup.getPlatform() == null || !readGroup.getPlatform().equals(RAC.FORCE_PLATFORM))) { readGroup.setPlatform(RAC.FORCE_PLATFORM); } if (readGroup.getPlatform() == null) { if (RAC.DEFAULT_PLATFORM != null) { if (!warnUserNullPlatform) { Utils.warnUser("The input .bam file contains reads with no platform information. " + "Defaulting to platform = " + RAC.DEFAULT_PLATFORM + ". " + "First observed at read with name = " + read.getReadName()); warnUserNullPlatform = true; } readGroup.setPlatform(RAC.DEFAULT_PLATFORM); } else { throw new UserException.MalformedBAM(read, "The input .bam file contains reads with no platform information. First observed at read with name = " + read.getReadName()); } } }
public ArtificialBAMBuilder createAndSetHeader(final int nSamples) { createdReads = null; this.header = new SAMFileHeader(); header.setSortOrder(SAMFileHeader.SortOrder.coordinate); header.setSequenceDictionary(parser.getContigs()); samples.clear(); for ( int i = 0; i < nSamples; i++ ) { final GATKSAMReadGroupRecord rg = new GATKSAMReadGroupRecord("rg" + i); final String sample = "sample" + i; samples.add(sample); rg.setSample(sample); rg.setPlatform(NGSPlatform.ILLUMINA.getDefaultPlatform()); header.addReadGroup(rg); } return this; }
@Test(enabled = true, expectedExceptions={UserException.class}) public void testMoreThanMaxCycleFails() { int readLength = RAC.MAXIMUM_CYCLE_VALUE + 1; GATKSAMRecord read = ReadUtils.createRandomRead(readLength); read.setReadPairedFlag(true); read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID")); read.getReadGroup().setPlatform("illumina"); ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1); covariate.recordValues(read, readCovariates); }
@Test(enabled = true) public void testMaxCyclePasses() { int readLength = RAC.MAXIMUM_CYCLE_VALUE; GATKSAMRecord read = ReadUtils.createRandomRead(readLength); read.setReadPairedFlag(true); read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID")); read.getReadGroup().setPlatform("illumina"); ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1); covariate.recordValues(read, readCovariates); } }
samples.add(sample); rg.setSample(sample); rg.setPlatform(NGSPlatform.ILLUMINA.getDefaultPlatform()); header.addReadGroup(rg);
rg.setPlatform("illumina"); final GATKSAMRecord read = ReadUtils.createRandomRead(length, false); read.setReadGroup(rg);
final GATKSAMRecord read = ReadUtils.createRandomRead(length, false); final GATKSAMReadGroupRecord rg = new GATKSAMReadGroupRecord(rgs); rg.setPlatform("illumina"); read.setReadGroup(rg); read.setReadNegativeStrandFlag(rnd.nextBoolean());
@Test(enabled = true) public void testSimpleCycles() { short readLength = 10; GATKSAMRecord read = ReadUtils.createRandomRead(readLength); read.setReadPairedFlag(true); read.setReadGroup(new GATKSAMReadGroupRecord("MY.ID")); read.getReadGroup().setPlatform("illumina"); ReadCovariates readCovariates = new ReadCovariates(read.getReadLength(), 1); covariate.recordValues(read, readCovariates); verifyCovariateArray(readCovariates.getMismatchesKeySet(), 1, (short) 1); read.setReadNegativeStrandFlag(true); covariate.recordValues(read, readCovariates); verifyCovariateArray(readCovariates.getMismatchesKeySet(), readLength, -1); read.setSecondOfPairFlag(true); covariate.recordValues(read, readCovariates); verifyCovariateArray(readCovariates.getMismatchesKeySet(), -readLength, 1); read.setReadNegativeStrandFlag(false); covariate.recordValues(read, readCovariates); verifyCovariateArray(readCovariates.getMismatchesKeySet(), -1, -1); }