@Override public void setPlatform(String s) { super.setPlatform(s); mPlatform = s; retrievedPlatform = true; retrievedNGSPlatform = false; // recalculate the NGSPlatform } }
/** Creates a simple header with the values provided on the command line. */ public SAMFileHeader createSamFileHeader() { final SAMReadGroupRecord rgroup = new SAMReadGroupRecord(this.READ_GROUP_NAME); rgroup.setSample(this.SAMPLE_NAME); if (this.LIBRARY_NAME != null) rgroup.setLibrary(this.LIBRARY_NAME); if (this.PLATFORM != null) rgroup.setPlatform(this.PLATFORM); if (this.PLATFORM_UNIT != null) rgroup.setPlatformUnit(this.PLATFORM_UNIT); if (this.SEQUENCING_CENTER != null) rgroup.setSequencingCenter(SEQUENCING_CENTER); if (this.PREDICTED_INSERT_SIZE != null) rgroup.setPredictedMedianInsertSize(PREDICTED_INSERT_SIZE); if (this.DESCRIPTION != null) rgroup.setDescription(this.DESCRIPTION); if (this.RUN_DATE != null) rgroup.setRunDate(this.RUN_DATE); if (this.PLATFORM_MODEL != null) rgroup.setPlatformModel(this.PLATFORM_MODEL); if (this.PROGRAM_GROUP != null) rgroup.setProgramGroup(this.PROGRAM_GROUP); final SAMFileHeader header = new SAMFileHeader(); header.addReadGroup(rgroup); for (final String comment : COMMENT) { header.addComment(comment); } header.setSortOrder(this.SORT_ORDER); return header ; }
void setup(final int numReads, final String readName, final int ID, final String readGroupId, final SAMReadGroupRecord readGroupRecord, final String sample, final String library, final SAMFileHeader header, final SAMRecordSetBuilder setBuilder) throws IOException { final String separator = ":"; readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId); header.addReadGroup(readGroupRecord); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); setBuilder.setHeader(header); final int max = 15000; final int min = 1; final Random rg = new Random(5); for (int i = 0; i < numReads; i++) { final int start = rg.nextInt(max) + min; final String newReadName = readName + separator + ID + separator + i; setBuilder.addPair(newReadName, 0, start + ID, start + ID + 99); } }
public void setupTest1(final int ID, final String readGroupId, final SAMReadGroupRecord readGroupRecord, final String sample, final String library, final SAMFileHeader header, final SAMRecordSetBuilder setBuilder) throws IOException { final String separator = ":"; final int contig1 = 0; final int contig2 = 1; readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId); header.addReadGroup(readGroupRecord); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); setBuilder.setHeader(header); final int max = 800; final int min = 1; final Random rg = new Random(5); //add records that align to chrM and O but not N for (int i = 0; i < NUM_READS; i++) { final int start = rg.nextInt(max) + min; final String newReadName = READ_NAME + separator + ID + separator + i; if (i != NUM_READS - 1) { setBuilder.addPair(newReadName, contig1, start + ID, start + ID + LENGTH); } else { setBuilder.addPair(newReadName, contig2, start + ID, start + ID + LENGTH); } } }
/** Creates a simple header with the values provided on the command line. */ public SAMFileHeader createSamFileHeader() { final SAMReadGroupRecord rgroup = new SAMReadGroupRecord(this.READ_GROUP_NAME); rgroup.setSample(this.SAMPLE_NAME); if (this.LIBRARY_NAME != null) rgroup.setLibrary(this.LIBRARY_NAME); if (this.PLATFORM != null) rgroup.setPlatform(this.PLATFORM); if (this.PLATFORM_UNIT != null) rgroup.setPlatformUnit(this.PLATFORM_UNIT); if (this.SEQUENCING_CENTER != null) rgroup.setSequencingCenter(SEQUENCING_CENTER); if (this.PREDICTED_INSERT_SIZE != null) rgroup.setPredictedMedianInsertSize(PREDICTED_INSERT_SIZE); if (this.DESCRIPTION != null) rgroup.setDescription(this.DESCRIPTION); if (this.RUN_DATE != null) rgroup.setRunDate(this.RUN_DATE); if (this.PLATFORM_MODEL != null) rgroup.setPlatformModel(this.PLATFORM_MODEL); if (this.PROGRAM_GROUP != null) rgroup.setProgramGroup(this.PROGRAM_GROUP); final SAMFileHeader header = new SAMFileHeader(); header.addReadGroup(rgroup); for (final String comment : COMMENT) { header.addComment(comment); } header.setSortOrder(this.SORT_ORDER); return header ; }
private SAMReadGroupRecord createRG(String name) { SAMReadGroupRecord rg = new SAMReadGroupRecord(name); rg.setPlatform(rgPlatform.getDefaultPlatform()); rg.setSample(name); return rg; }
final int contig3 = 2; readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId);
rg.setPlatform(RGPL); rg.setSample(RGSM); rg.setPlatformUnit(RGPU);
public SAMRecordSetBuilder(final boolean sortForMe, final SAMFileHeader.SortOrder sortOrder, final boolean addReadGroup, final int defaultChromosomeLength) { final List<SAMSequenceRecord> sequences = new ArrayList<SAMSequenceRecord>(); for (final String chrom : chroms) { final SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(chrom, defaultChromosomeLength); sequences.add(sequenceRecord); } this.header = new SAMFileHeader(); this.header.setSequenceDictionary(new SAMSequenceDictionary(sequences)); this.header.setSortOrder(sortOrder); if (sortForMe) { final SAMRecordComparator comparator; if (sortOrder == SAMFileHeader.SortOrder.queryname) { comparator = new SAMRecordQueryNameComparator(); } else { comparator = new SAMRecordCoordinateComparator(); } this.records = new TreeSet<SAMRecord>(comparator); } else { this.records = new ArrayList<SAMRecord>(); } if (addReadGroup) { final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(READ_GROUP_ID); readGroupRecord.setSample(SAMPLE); readGroupRecord.setPlatform("ILLUMINA"); final List<SAMReadGroupRecord> readGroups = new ArrayList<SAMReadGroupRecord>(); readGroups.add(readGroupRecord); this.header.setReadGroups(readGroups); } }
readgroup.setPlatform(RG.getExperiment().getInstrumentModel());
rg.setPlatform(RGPL); rg.setSample(RGSM); rg.setPlatformUnit(RGPU);
public SAMRecordSetBuilder(final boolean sortForMe, final SAMFileHeader.SortOrder sortOrder, final boolean addReadGroup, final int defaultChromosomeLength, final ScoringStrategy duplicateScoringStrategy) { final List<SAMSequenceRecord> sequences = new ArrayList<SAMSequenceRecord>(); for (final String chrom : chroms) { final SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(chrom, defaultChromosomeLength); sequences.add(sequenceRecord); } this.header = new SAMFileHeader(); this.header.setSequenceDictionary(new SAMSequenceDictionary(sequences)); this.header.setSortOrder(sortOrder); if (sortForMe) { final SAMRecordComparator comparator; if (sortOrder == SAMFileHeader.SortOrder.queryname) { comparator = new SAMRecordQueryNameComparator(); } else { comparator = new SAMRecordCoordinateComparator(); } this.records = new TreeSet<SAMRecord>(comparator); } else { this.records = new ArrayList<SAMRecord>(); } if (addReadGroup) { final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(READ_GROUP_ID); readGroupRecord.setSample(SAMPLE); readGroupRecord.setPlatform("ILLUMINA"); final List<SAMReadGroupRecord> readGroups = new ArrayList<SAMReadGroupRecord>(); readGroups.add(readGroupRecord); this.header.setReadGroups(readGroups); } }
protected static SAMRecordSetBuilder createTestSAMBuilder(final File reference, final String readGroupId, final String sample, final String platform, final String library) { final SAMFileHeader header = new SAMFileHeader(); // check that dictionary file is readable and then set header dictionary try { header.setSequenceDictionary(SAMSequenceDictionaryExtractor.extractDictionary(reference.toPath())); header.setSortOrder(SAMFileHeader.SortOrder.unsorted); } catch (final SAMException e) { e.printStackTrace(); } // set readGroupRecord final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(readGroupId); readGroupRecord.setSample(sample); readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId); header.addReadGroup(readGroupRecord); final SAMRecordSetBuilder setBuilder = new SAMRecordSetBuilder(true, SAMFileHeader.SortOrder.coordinate, true, 100); setBuilder.setReadGroup(readGroupRecord); setBuilder.setUseNmFlag(true); setBuilder.setHeader(header); return(setBuilder); }
public SAMRecordSetBuilder(final boolean sortForMe, final SAMFileHeader.SortOrder sortOrder, final boolean addReadGroup, final int defaultChromosomeLength, final ScoringStrategy duplicateScoringStrategy) { final List<SAMSequenceRecord> sequences = new ArrayList<SAMSequenceRecord>(); for (final String chrom : chroms) { final SAMSequenceRecord sequenceRecord = new SAMSequenceRecord(chrom, defaultChromosomeLength); sequences.add(sequenceRecord); } this.header = new SAMFileHeader(); this.header.setSequenceDictionary(new SAMSequenceDictionary(sequences)); this.header.setSortOrder(sortOrder); if (sortForMe) { final SAMRecordComparator comparator; if (sortOrder == SAMFileHeader.SortOrder.queryname) { comparator = new SAMRecordQueryNameComparator(); } else { comparator = new SAMRecordCoordinateComparator(); } this.records = new TreeSet<SAMRecord>(comparator); } else { this.records = new ArrayList<SAMRecord>(); } if (addReadGroup) { final SAMReadGroupRecord readGroupRecord = new SAMReadGroupRecord(READ_GROUP_ID); readGroupRecord.setSample(SAMPLE); readGroupRecord.setPlatform("ILLUMINA"); final List<SAMReadGroupRecord> readGroups = new ArrayList<SAMReadGroupRecord>(); readGroups.add(readGroupRecord); this.header.setReadGroups(readGroups); } }
readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library); readGroupRecord.setPlatformUnit(readGroupId);
@Test public void testGetSAMString() { SAMReadGroupRecord r = new SAMReadGroupRecord("rg1"); r.setSample("mysample"); r.setPlatform("ILLUMINA"); r.setDescription("my description"); Assert.assertEquals("@RG\tID:rg1\tSM:mysample\tPL:ILLUMINA\tDS:my description", r.getSAMString()); }
readGroupRecord.setPlatform(PLATFORM); readGroupRecord.setLibrary(LIBRARY); readGroupRecord.setPlatformUnit(READ_GROUP_ID);
/** * A unit test that creates an artificial read for testing some code that uses reads */ @Test(dataProvider = "TestMappings") public void testPLFromReadWithRG(final String plField, final NGSPlatform expected) { final SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(seq.getSequenceDictionary()); final String rgID = "ID"; final SAMReadGroupRecord rg = new SAMReadGroupRecord(rgID); if ( plField != null ) rg.setPlatform(plField); header.addReadGroup(rg); final GATKSAMRecord read = ArtificialSAMUtils.createArtificialRead(header, "myRead", 0, 1, 10); read.setAttribute("RG", rgID); Assert.assertEquals(NGSPlatform.fromRead(read), expected); }
readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library);
readGroupRecord.setPlatform(platform); readGroupRecord.setLibrary(library);