/** * Hallucinates sample objects for all the samples in the SAM file and stores them */ public SampleDBBuilder addSamplesFromSAMHeader(final SAMFileHeader header) { addSamplesFromSampleNames(ReadUtils.getSAMFileSamples(header)); return this; }
@Test(expectedExceptions = IllegalArgumentException.class) public void testGetSAMFileMissingHeader() { ReadUtils.getSAMFileSamples(null); }
/** * Returns the sample list including samples in read inputs. * @return never {@code null}. */ public SampleList getReadSampleList() { return new IndexedSampleList(ReadUtils.getSAMFileSamples(getSAMFileHeader())); } }
@Test(expectedExceptions = UserException.class) public void testGetSAMFileMissingReadGroupsSamples() { final SAMFileHeader header = ArtificialSAMUtils.createArtificialSamHeader(); final SAMReadGroupRecord samGroup = new SAMReadGroupRecord("id"); final List<SAMReadGroupRecord> list = new ArrayList<>(Arrays.asList(samGroup)); header.setReadGroups(list); ReadUtils.getSAMFileSamples(header); } }
@Override public void initialize(GenomeAnalysisEngine engine, Walker walker, ProgressMeter progressMeter) { super.initialize(engine, walker, progressMeter); this.walker = (ActiveRegionWalker<M,T>)walker; if ( this.walker.wantsExtendedReads() && ! this.walker.wantsNonPrimaryReads() ) { throw new IllegalArgumentException("Active region walker " + this.walker + " requested extended events but not " + "non-primary reads, an inconsistent state. Please modify the walker"); } ActiveRegionTraversalParameters annotation = walker.getClass().getAnnotation(ActiveRegionTraversalParameters.class); this.activeRegionExtension = this.walker.activeRegionExtension == null ? annotation.extension() : this.walker.activeRegionExtension; this.maxRegionSize = this.walker.activeRegionMaxSize == null ? annotation.maxRegion() : this.walker.activeRegionMaxSize; this.minRegionSize = annotation.minRegion(); final double bandPassSigma = this.walker.bandPassSigma == null ? annotation.bandPassSigma() : this.walker.bandPassSigma; walkerHasPresetRegions = this.walker.hasPresetActiveRegions(); activityProfile = new BandPassActivityProfile(engine.getGenomeLocParser(), engine.getIntervals(), this.walker.maxProbPropagationDistance, this.walker.activeProbThreshold, BandPassActivityProfile.MAX_FILTER_SIZE, bandPassSigma); final int maxReadsAcrossSamples = this.walker.maxReadsInMemoryPerSample * ReadUtils.getSAMFileSamples(engine.getSAMFileHeader()).size(); final int maxReadsToHoldInMemory = Math.min(maxReadsAcrossSamples, this.walker.maxTotalReadsInMemory); myReads = new TAROrderedReadCache(maxReadsToHoldInMemory); }
writer.writeHeader(new VCFHeader(hInfo, vcfSamples)); Set<String> readSamples = ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()); readSamples.retainAll(vcfSamples); if (readSamples.isEmpty()) {
/** * Create a new LocusIteratorByState based on a SamReader using reads in an iterator it * * Simple constructor that uses the samples in the reader, doesn't do any downsampling, * and makes a new GenomeLocParser using the reader. This constructor will be slow(ish) * if you continually invoke this constructor, but it's easy to make. * * @param reader a non-null reader * @param it an iterator from reader that has the reads we want to use to create ReadBackPileups */ public LocusIteratorByState(final SamReader reader, final CloseableIterator<SAMRecord> it) { this(new GATKSAMRecordIterator(it), new LIBSDownsamplingInfo(false, 0), true, new GenomeLocParser(reader.getFileHeader().getSequenceDictionary()), ReadUtils.getSAMFileSamples(reader.getFileHeader()), false); }
private HashSet<String> getSamplesFromToolKit(DoCOutputType.Partition type) { HashSet<String> partition = new HashSet<String>(); if ( type == DoCOutputType.Partition.sample ) { partition.addAll(ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader())); } else if ( type == DoCOutputType.Partition.readgroup ) { for ( SAMReadGroupRecord rg : getToolkit().getSAMFileHeader().getReadGroups() ) {
} else { sampleNameSet = ReadUtils.getSAMFileSamples(toolkit.getSAMFileHeader()); if ( UAC.referenceSampleName != null ) sampleNameSet.remove(UAC.referenceSampleName);
@Override public void initialize() { super.initialize(); if (getToolkit().getIntervals() == null || getToolkit().getIntervals().isEmpty()) throw new UserException("This tool only works if you provide one or more intervals (use the -L argument). If you want to run whole genome, use -T DepthOfCoverage instead."); intervalMap = new LinkedHashMap<>(INITIAL_HASH_SIZE); intervalListIterator = new PeekableIterator<>(getToolkit().getIntervals().iterator()); // get all of the unique sample names for the VCF Header samples = ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()); vcfWriter.writeHeader(new VCFHeader(getHeaderInfo(), samples)); // pre load all the statistics classes because it is costly to operate on the JVM and we only want to do it once. loadAllPlugins(thresholds); }
private List<LocusShardDataProvider> createDataProviders(TraverseActiveRegions traverseActiveRegions, final Walker walker, List<GenomeLoc> intervals, File bamFile) { GenomeAnalysisEngine engine = new GenomeAnalysisEngine(); engine.setGenomeLocParser(genomeLocParser); Collection<SAMReaderID> samFiles = new ArrayList<SAMReaderID>(); SAMReaderID readerID = new SAMReaderID(bamFile, new Tags()); samFiles.add(readerID); SAMDataSource dataSource = new SAMDataSource(referenceFile, samFiles, new ThreadAllocation(), null, genomeLocParser, false, ValidationStringency.STRICT, null, null, new ValidationExclusion(), new ArrayList<ReadFilter>(), new ArrayList<ReadTransformer>(), false, (byte)30, false, true, null, IntervalMergingRule.ALL); engine.setReadsDataSource(dataSource); final Set<String> samples = ReadUtils.getSAMFileSamples(dataSource.getHeader()); traverseActiveRegions.initialize(engine, walker); List<LocusShardDataProvider> providers = new ArrayList<LocusShardDataProvider>(); for (Shard shard : dataSource.createShardIteratorOverIntervals(new GenomeLocSortedSet(genomeLocParser, intervals), new ActiveRegionShardBalancer())) { for (WindowMaker.WindowMakerIterator window : new WindowMaker(shard, genomeLocParser, dataSource.seek(shard), shard.getGenomeLocs(), samples)) { providers.add(new LocusShardDataProvider(shard, shard.getReadProperties(), genomeLocParser, window.getLocus(), window, reference, new ArrayList<ReferenceOrderedDataSource>())); } } return providers; }
super.initialize(); samplesList = new IndexedSampleList(new ArrayList<>(ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()))); if (samplesList.sampleCount() == 2 && normalSampleName != null && tumorSampleName != null && ReadUtils.getSAMFileSamples(getToolkit().getSAMFileHeader()).size() == 2) printTCGAsampleHeader = true;
final Set<String> samples = ReadUtils.getSAMFileSamples(dataSource.getHeader());
final Set<String> samples = ReadUtils.getSAMFileSamples(dataSource.getHeader());
getReadIterator(shard), shard.getGenomeLocs(), ReadUtils.getSAMFileSamples(engine.getSAMFileHeader())); for(WindowMaker.WindowMakerIterator iterator: windowMaker) { ShardDataProvider dataProvider = new LocusShardDataProvider(shard,iterator.getSourceInfo(),engine.getGenomeLocParser(),iterator.getLocus(),iterator,reference,rods);