Java Code Examples for htsjdk.samtools.util.CollectionUtil#makeSet()

The following examples show how to use htsjdk.samtools.util.CollectionUtil#makeSet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleCellRnaSeqMetricsCollector.java    From Drop-seq with MIT License 5 votes vote down vote up
public RnaSeqMetricsCollector getCollector(final List<String> cellBarcodes) {
	List<SAMReadGroupRecord> readGroups =  getReadGroups(cellBarcodes);
	return new RnaSeqMtMetricsCollector(CollectionUtil.makeSet(MetricAccumulationLevel.READ_GROUP), readGroups,
               ribosomalBasesInitialValue, geneOverlapDetector, ribosomalSequenceOverlapDetector,
               ignoredSequenceIndices, MINIMUM_TRANSCRIPT_LENGTH, specificity, this.rnaFragPct, false,
               genesWithLongEnoughTranscripts);
}
 
Example 2
Source File: IlluminaBasecallsToFastq.java    From picard with MIT License 5 votes vote down vote up
/**
 * For each line in the MULTIPLEX_PARAMS file create a FastqRecordsWriter and put it in the sampleBarcodeFastqWriterMap map,
 * where the key to the map is the concatenation of all sampleBarcodes in order for the given line.
 */
private void populateWritersFromMultiplexParams() {
    final TabbedTextFileWithHeaderParser libraryParamsParser = new TabbedTextFileWithHeaderParser(MULTIPLEX_PARAMS);

    final Set<String> expectedColumnLabels = CollectionUtil.makeSet("OUTPUT_PREFIX");
    final List<String> sampleBarcodeColumnLabels = new ArrayList<>();
    for (int i = 1; i <= readStructure.sampleBarcodes.length(); i++) {
        sampleBarcodeColumnLabels.add("BARCODE_" + i);
    }

    expectedColumnLabels.addAll(sampleBarcodeColumnLabels);
    assertExpectedColumns(libraryParamsParser.columnLabels(), expectedColumnLabels);

    for (final TabbedTextFileWithHeaderParser.Row row : libraryParamsParser) {
        List<String> sampleBarcodeValues = null;

        if (!sampleBarcodeColumnLabels.isEmpty()) {
            sampleBarcodeValues = new ArrayList<>();
            for (final String sampleBarcodeLabel : sampleBarcodeColumnLabels) {
                sampleBarcodeValues.add(row.getField(sampleBarcodeLabel));
            }
        }

        final String key = (sampleBarcodeValues == null || sampleBarcodeValues.contains("N")) ? null : StringUtil.join("", sampleBarcodeValues);
        if (sampleBarcodeFastqWriterMap.containsKey(key)) {    //This will catch the case of having more than 1 line in a non-barcoded MULTIPLEX_PARAMS file
            throw new PicardException("Row for barcode " + key + " appears more than once in MULTIPLEX_PARAMS file " +
                    MULTIPLEX_PARAMS);
        }

        final FastqRecordsWriter writer = buildWriter(new File(row.getField("OUTPUT_PREFIX")));
        sampleBarcodeFastqWriterMap.put(key, writer);
    }
    if (sampleBarcodeFastqWriterMap.isEmpty()) {
        throw new PicardException("MULTIPLEX_PARAMS file " + MULTIPLEX_PARAMS + " does have any data rows.");
    }
    libraryParamsParser.close();
}
 
Example 3
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
/**
 * Tests that sites with a het allele balance < 0.4 are marked as filtered out.
 */
@Test
public void testAbFiltering() throws Exception {
    final Set<String> fails = CollectionUtil.makeSet("tf2", "rs28566954", "rs28548431");
    final File out = testFiltering(INPUT, ".vcf.gz", 0.4, 0, 0, Double.MAX_VALUE);
    final ListMap<String, String> filters = slurpFilters(out);
    Assert.assertEquals(sorted(filters.keySet()), sorted(fails), "Failed sites did not match expected set of failed sites.");
}
 
Example 4
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
/**
 * Tests that genotypes with DP < 18 are marked as failed, but not >= 18.
 */
@Test
public void testDpFiltering() throws Exception {
    final Set<String> fails = CollectionUtil.makeSet("rs71509448", "rs71628926", "rs13302979", "rs2710876");
    final File out = testFiltering(INPUT, ".vcf.gz", 0, 18, 0, Double.MAX_VALUE);
    final ListMap<String, String> filters = slurpFilters(out);
    Assert.assertEquals(sorted(filters.keySet()), sorted(fails), "Failed sites did not match expected set of failed sites.");
}
 
Example 5
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
/**
 * Tests that genotypes with DP < 18 are marked as failed, but not >= 18.
 */
@Test
public void testDpFilteringToVcf() throws Exception {
    final Set<String> fails = CollectionUtil.makeSet("rs71509448", "rs71628926", "rs13302979", "rs2710876");
    final File out = testFiltering(INPUT, ".vcf", 0, 18, 0, Double.MAX_VALUE);
    final ListMap<String, String> filters = slurpFilters(out);
    Assert.assertEquals(sorted(filters.keySet()), sorted(fails), "Failed sites did not match expected set of failed sites.");
}
 
Example 6
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
/**
 * Tests that genotypes with DP < 18 are marked as failed, but not >= 18.
 */
@Test(dataProvider = "goodInputVcfs")
public void testFsFiltering(final File input) throws Exception {
    final Set<String> fails = CollectionUtil.makeSet("rs13303033", "rs28548431", "rs2799066");
    final File out = testFiltering(input, ".vcf.gz", 0, 0, 0, 5.0d);
    final ListMap<String, String> filters = slurpFilters(out);
    Assert.assertEquals(sorted(filters.keySet()), sorted(fails), "Failed sites did not match expected set of failed sites.");
}
 
Example 7
Source File: TestFilterVcf.java    From picard with MIT License 5 votes vote down vote up
@Test
public void testCombinedFiltering() throws Exception {
    final TreeSet<String> fails = new TreeSet<String>(CollectionUtil.makeSet("rs13302979", "rs13303033", "rs2710876", "rs2799066", "rs28548431", "rs28566954", "rs71509448", "rs71628926", "tf2"));
    final File out = testFiltering(INPUT, ".vcf.gz", 0.4, 18, 22, 5.0d);
    final ListMap<String, String> filters = slurpFilters(out);
    Assert.assertEquals(new TreeSet<String>(filters.keySet()), fails, "Failed sites did not match expected set of failed sites.");
}
 
Example 8
Source File: IntervalListTools.java    From picard with MIT License 4 votes vote down vote up
IntervalListInputType(final String... s) {
    applicableExtensions = CollectionUtil.makeSet(s);
}