当前位置: 首页>>代码示例>>Java>>正文


Java Read类代码示例

本文整理汇总了Java中com.google.api.services.genomics.model.Read的典型用法代码示例。如果您正苦于以下问题:Java Read类的具体用法?Java Read怎么用?Java Read使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Read类属于com.google.api.services.genomics.model包,在下文中一共展示了Read类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReadPCollection

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
/**
 * Create a {@link PCollection<GATKRead>} containing all the reads overlapping the given intervals.
 * Reads that are unmapped are ignored.
 * @param intervals a list of SimpleIntervals.  These must be non-overlapping intervals or the results are undefined.
 * @param stringency how to react to malformed reads.
 * @param includeUnmappedReads to include unmapped reads.
 * @return a PCollection containing all the reads that overlap the given intervals.
 */
public PCollection<GATKRead> getReadPCollection(List<SimpleInterval> intervals, ValidationStringency stringency, boolean includeUnmappedReads) {
    PCollection<GATKRead> preads;
    if(cloudStorageUrl){
        Iterable<Contig> contigs = intervals.stream()
                .map(i -> new Contig(i.getContig(), i.getStart(), i.getEnd()))
                .collect(Collectors.toList());
        try {
            PCollection<Read> rawReads = ReadBAMTransform.getReadsFromBAMFilesSharded(pipeline, auth,contigs, new ReaderOptions(stringency, includeUnmappedReads), bam, ShardingPolicy.LOCI_SIZE_POLICY);
            preads = rawReads.apply(new GoogleGenomicsReadToGATKRead());
        } catch (IOException ex) {
            throw new UserException.CouldNotReadInputFile("Unable to read "+bam, ex);
        }
    } else if (hadoopUrl) {
        preads = DataflowUtils.getReadsFromHadoopBam(pipeline, intervals, stringency, bam);
    } else {
        preads = DataflowUtils.getReadsFromLocalBams(pipeline, intervals, stringency, ImmutableList.of(new File(bam)));
    }
    return preads;
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:28,代码来源:ReadsDataflowSource.java

示例2: bases

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "bases")
public Object[][] bases() {
    Object[][] data = new Object[2][];
    List<Class<?>> classes = Arrays.asList(Read.class, SAMRecord.class);
    for (int i = 0; i < classes.size(); ++i) {
        Class<?> c = classes.get(i);
        ReadsPreprocessingPipelineTestData testData = new ReadsPreprocessingPipelineTestData(c);

        List<GATKRead> reads = testData.getReads();
        List<KV<GATKRead, ReferenceBases>> kvReadRefBases = testData.getKvReadsRefBases();
        List<SimpleInterval> intervals = testData.getAllIntervals();
        List<Variant> variantList = testData.getVariants();
        List<KV<GATKRead, Iterable<Variant>>> kvReadiVariant = testData.getKvReadiVariantBroken();
        List<KV<GATKRead, ReadContextData>> kvReadContextData = testData.getKvReadContextData();
        data[i] = new Object[]{reads, variantList, kvReadRefBases, kvReadContextData, intervals, kvReadiVariant};
    }
    return data;
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:19,代码来源:AddContextDataToReadUnitTest.java

示例3: addContextDataWithCustomReferenceWindowFunctionTestData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "AddContextDataWithCustomReferenceWindowFunctionTestData")
public Object[][] addContextDataWithCustomReferenceWindowFunctionTestData() throws IOException {

    final List<Object[]> testCases = new ArrayList<>();
    for ( final Class<?> readImplementation : Arrays.asList(SAMRecord.class, Read.class) ) {
        // Test case layout: read, mock reference source, reference window function to apply, expected ReferenceBases for read

        // Read at start of contig, identity function
        testCases.add(new Object[]{ makeRead("1", 1, 10, 0, readImplementation), ReferenceWindowFunctions.IDENTITY_FUNCTION, new ReferenceBases("AGCCTTTCGA".getBytes(), new SimpleInterval("1", 1, 10)) });
        // Read at start of contig, expand by 1 base on each side (goes off contig bounds)
        testCases.add(new Object[]{ makeRead("1", 1, 10, 0, readImplementation), new ReferenceWindowFunctions.FixedWindowFunction(1, 1), new ReferenceBases("AGCCTTTCGAA".getBytes(), new SimpleInterval("1", 1, 11)) });
        // Read at start of contig, expand by 3 bases on the left and 5 bases on the right (goes off contig bounds)
        testCases.add(new Object[]{ makeRead("1", 1, 10, 0, readImplementation), new ReferenceWindowFunctions.FixedWindowFunction(3, 5), new ReferenceBases("AGCCTTTCGAACTGA".getBytes(), new SimpleInterval("1", 1, 15)) });
        // Read in middle of contig, identity function
        testCases.add(new Object[]{ makeRead("1", 20, 11, 0, readImplementation), ReferenceWindowFunctions.IDENTITY_FUNCTION, new ReferenceBases("GTTCCTGGGGT".getBytes(), new SimpleInterval("1", 20, 30)) });
        // Read in middle of contig, expand by 1 base on each side
        testCases.add(new Object[]{ makeRead("1", 20, 11, 0, readImplementation), new ReferenceWindowFunctions.FixedWindowFunction(1, 1), new ReferenceBases("CGTTCCTGGGGTT".getBytes(), new SimpleInterval("1", 19, 31)) });
        // Read in middle of contig, expand by 3 bases on the left and 5 bases on the right
        testCases.add(new Object[]{ makeRead("1", 20, 11, 0, readImplementation), new ReferenceWindowFunctions.FixedWindowFunction(3, 5), new ReferenceBases("CCCGTTCCTGGGGTTATAC".getBytes(), new SimpleInterval("1", 17, 35)) });
        // Read in middle of contig, expand by 30 bases on the left and 10 bases on the right (goes off contig bounds)
        testCases.add(new Object[]{ makeRead("1", 20, 11, 0, readImplementation), new ReferenceWindowFunctions.FixedWindowFunction(30, 10), new ReferenceBases("AGCCTTTCGAACTGAGCCCGTTCCTGGGGTTATACCCGGC".getBytes(), new SimpleInterval("1", 1, 40)) });
    }
    return testCases.toArray(new Object[][]{});
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:25,代码来源:AddContextDataToReadUnitTest.java

示例4: variantsAndReads

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "variantsAndReads")
public Object[][] variantsAndReads(){
    Object[][] data = new Object[2][];
    List<Class<?>> classes = Arrays.asList(Read.class, SAMRecord.class);
    for (int i = 0; i < classes.size(); ++i) {
        Class<?> c = classes.get(i);
        ReadsPreprocessingPipelineTestData testData = new ReadsPreprocessingPipelineTestData(c);

        List<GATKRead> reads = testData.getReads();
        List<Variant> variantList = testData.getVariants();
        List<KV<GATKRead, Iterable<Variant>>> kvReadiVariant = testData.getKvReadiVariantBroken();

        data[i] = new Object[]{reads, variantList, kvReadiVariant};
    }
    return data;
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:17,代码来源:KeyVariantsByReadUnitTest.java

示例5: keyedReads

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "keyedVariantShardsReads")
public Object[][] keyedReads(){
    Object[][] data = new Object[2][];
    List<Class<?>> classes = Arrays.asList(Read.class, SAMRecord.class);
    for (int i = 0; i < classes.size(); ++i) {
        Class<?> c = classes.get(i);
        ReadsPreprocessingPipelineTestData testData = new ReadsPreprocessingPipelineTestData(c);

        List<GATKRead> reads = testData.getReads();
        List<KV<UUID, GATKRead>> expected = Arrays.asList(
                KV.of(reads.get(0).getUUID(), reads.get(0)),
                KV.of(reads.get(1).getUUID(), reads.get(1)),
                KV.of(reads.get(2).getUUID(), reads.get(2)),
                KV.of(reads.get(3).getUUID(), reads.get(3)),
                KV.of(reads.get(4).getUUID(), reads.get(4))
        );
        data[i] = new Object[]{reads, expected};
    }
    return data;
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:21,代码来源:KeyReadsByUUIDUnitTest.java

示例6: keyReadsByRefShardWithCustomWindowFunctionTestData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "KeyReadsByRefShardWithCustomWindowFunctionTestData")
public Object[][] keyReadsByRefShardWithCustomWindowFunctionTestData() {
    final List<GATKRead> samReads = ReadsPreprocessingPipelineTestData.makeReferenceShardBoundaryReads(2, 3, SAMRecord.class);
    final List<GATKRead> googleReads = ReadsPreprocessingPipelineTestData.makeReferenceShardBoundaryReads(2, 3, Read.class);

    return new Object[][] {
            // Test case layout: reads, reference window function to apply, expected shard + reads pairs

            // Identity function, SAM reads
            { samReads, ReferenceWindowFunctions.IDENTITY_FUNCTION, generateExpectedCustomWindowResult(samReads, 0, 0) },
            // Identity function, google reads
            { googleReads, ReferenceWindowFunctions.IDENTITY_FUNCTION, generateExpectedCustomWindowResult(googleReads, 0, 0) },
            // Expand reads by 1 base on each side, SAM reads
            { samReads, new ReferenceWindowFunctions.FixedWindowFunction(1, 1), generateExpectedCustomWindowResult(samReads, 1, 1) },
            // Expand reads by 1 base on each side, google reads
            { googleReads, new ReferenceWindowFunctions.FixedWindowFunction(1, 1), generateExpectedCustomWindowResult(googleReads, 1, 1) },
            // Expand reads by 3 bases on the left and 5 bases on the right, SAM reads
            { samReads, new ReferenceWindowFunctions.FixedWindowFunction(3, 5), generateExpectedCustomWindowResult(samReads, 3, 5) },
            // Expand reads by 3 bases on the left and 5 bases on the right, google reads
            { googleReads, new ReferenceWindowFunctions.FixedWindowFunction(3, 5), generateExpectedCustomWindowResult(googleReads, 3, 5) },
    };
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:23,代码来源:KeyReadsByRefShardUnitTest.java

示例7: testEquality

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@Test
public void testEquality() {
    Read read1 = new Read();
    Read read2 = new Read();

    read1.setAlignment(new LinearAlignment());
    read1.getAlignment().setPosition(new Position());
    read1.getAlignment().getPosition().setReferenceName("FOO");

    read2.setAlignment(new LinearAlignment());
    read2.getAlignment().setPosition(new Position());
    read2.getAlignment().getPosition().setReferenceName("FOO");

    Assert.assertEquals(read1, read2, "equal reads not equal");

    read2.getAlignment().getPosition().setReferenceName("BAR");
    Assert.assertNotEquals(read1, read2, "unequal reads are equal");
}
 
开发者ID:broadinstitute,项目名称:gatk-dataflow,代码行数:19,代码来源:ReadEqualityUnitTest.java

示例8: testCodingInIterable

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
/**
 * Tests what happens when trying to read two concatenated JSON objects using GenericJsonCoder
 */
@Test
public void testCodingInIterable() throws IOException {
  Read read = new Read();
  read.setId("TEST_READ_1");

  GenericJsonCoder<Read> coder = GenericJsonCoder.of(Read.class);
  ByteArrayOutputStream output = new ByteArrayOutputStream();
  coder.encode(read, output);
  read.setId("TEST_READ_2");
  coder.encode(read, output);

  InputStream input = new ByteArrayInputStream(output.toByteArray());
  Read out = coder.decode(input);
  assertTrue(out.getId().equals("TEST_READ_1"));
  out = coder.decode(input);
  assertTrue(out.getId().equals("TEST_READ_2"));
}
 
开发者ID:googlegenomics,项目名称:dataflow-java,代码行数:21,代码来源:GenericJsonCoderTest.java

示例9: bases

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "bases")
public Object[][] bases() {
    List<Class<?>> classes = Arrays.asList(Read.class, SAMRecord.class);
    JoinStrategy[] strategies = JoinStrategy.values();
    Object[][] data = new Object[classes.size() * strategies.length][];
    for (int i = 0; i < classes.size(); ++i) {
        Class<?> c = classes.get(i);
        ReadsPreprocessingPipelineSparkTestData testData = new ReadsPreprocessingPipelineSparkTestData(c);

        List<GATKRead> reads = testData.getReads();
        List<GATKVariant> variantList = testData.getVariants();
        List<KV<GATKRead, ReadContextData>> expectedReadContextData = testData.getKvReadContextData();
        for (int j = 0; j < strategies.length; j++) {
            data[i * strategies.length + j] = new Object[]{reads, variantList, expectedReadContextData, strategies[j]};
        }
    }
    return data;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:19,代码来源:AddContextDataToReadSparkUnitTest.java

示例10: pairedReadsAndVariants

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "pairedReadsAndVariants")
public Object[][] pairedReadsAndVariants(){
    List<Object[]> testCases = new ArrayList<>();

    for ( JoinStrategy joinStrategy : JoinStrategy.values() ) {
        for ( Class<?> readImplementation : Arrays.asList(Read.class, SAMRecord.class) ) {
            ReadsPreprocessingPipelineSparkTestData testData = new ReadsPreprocessingPipelineSparkTestData(readImplementation);
            List<GATKRead> reads = testData.getReads();
            List<GATKVariant> variantList = testData.getVariants();
            List<KV<GATKRead, Iterable<GATKVariant>>> kvReadiVariant = testData.getKvReadiVariant();

            testCases.add(new Object[]{reads, variantList, kvReadiVariant, joinStrategy});
        }
    }
    return testCases.toArray(new Object[][]{});
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:17,代码来源:JoinReadsWithVariantsSparkUnitTest.java

示例11: basicGoogleGenomicsRead

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
/**
 * Creates a basic mapped Google read with a mapped mate.
 * @return GoogleGenomicsRead
 */
private static Read basicGoogleGenomicsRead() {
    final Read read = ArtificialReadUtils.createArtificialGoogleGenomicsRead(
            BASIC_READ_NAME,
            BASIC_READ_CONTIG,
            BASIC_READ_START,
            BASIC_READ_BASES,
            BASIC_READ_BASE_QUALITIES,
            BASIC_READ_CIGAR
    );
    read.setReadGroupId(BASIC_READ_GROUP);
    read.getAlignment().getPosition().setReverseStrand(false);
    read.getAlignment().setMappingQuality(BASIC_READ_MAPPING_QUALITY);
    read.setNextMatePosition(new Position());
    read.getNextMatePosition().setReferenceName(BASIC_READ_MATE_CONTIG);
    read.getNextMatePosition().setPosition((long) BASIC_READ_MATE_START - 1);
    read.getNextMatePosition().setReverseStrand(false);
    read.setNumberReads(2);
    read.setReadNumber(0);
    read.setProperPlacement(false);
    Map<String, List<Object>> infoMap = new LinkedHashMap<>();
    infoMap.put(SAMTag.PG.name(), Collections.singletonList(BASIC_PROGRAM));
    read.setInfo(infoMap);

    return read;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:30,代码来源:GATKReadAdaptersUnitTest.java

示例12: getUnclippedStartAndEndData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "GetUnclippedStartAndEndData")
public Object[][] getUnclippedStartAndEndData() {
    final SAMRecord softClippedSam = basicSAMRecord();
    softClippedSam.setCigarString("1S2M1S");

    final SAMRecord hardClippedSam = basicSAMRecord();
    hardClippedSam.setCigarString("3H2M2H");

    final Read softClippedGoogleRead = basicGoogleGenomicsRead();
    softClippedGoogleRead.getAlignment().setCigar(CigarConversionUtils.convertSAMCigarToCigarUnitList(TextCigarCodec.decode("1S2M1S")));

    final Read hardClippedGoogleRead = basicGoogleGenomicsRead();
    hardClippedGoogleRead.getAlignment().setCigar(CigarConversionUtils.convertSAMCigarToCigarUnitList(TextCigarCodec.decode("3H2M2H")));

    return new Object[][]{
            { new SAMRecordToGATKReadAdapter(softClippedSam), BASIC_READ_START - 1, BASIC_READ_START + 2 },
            { new SAMRecordToGATKReadAdapter(hardClippedSam), BASIC_READ_START - 3, BASIC_READ_START + 3 },
            { new GoogleGenomicsReadToGATKReadAdapter(softClippedGoogleRead), BASIC_READ_START - 1, BASIC_READ_START + 2 },
            { new GoogleGenomicsReadToGATKReadAdapter(hardClippedGoogleRead), BASIC_READ_START - 3, BASIC_READ_START + 3 }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:22,代码来源:GATKReadAdaptersUnitTest.java

示例13: getAndSetMappingQualityData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "GetAndSetMappingQualityData")
public Object[][] getAndSetMappingQualityData() {
    final SAMRecord samWithMappingQualityZero = basicSAMRecord();
    samWithMappingQualityZero.setMappingQuality(0);

    final Read googleReadWithMappingQualityZero = basicGoogleGenomicsRead();
    googleReadWithMappingQualityZero.getAlignment().setMappingQuality(0);

    final Read googleReadWithNoMappingQuality = basicGoogleGenomicsRead();
    googleReadWithNoMappingQuality.getAlignment().setMappingQuality(null);

    return new Object[][]{
            { basicReadBackedBySam(), BASIC_READ_MAPPING_QUALITY },
            { basicReadBackedByGoogle(), BASIC_READ_MAPPING_QUALITY },
            { new SAMRecordToGATKReadAdapter(samWithMappingQualityZero), 0 },
            { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithMappingQualityZero), 0 },
            { new GoogleGenomicsReadToGATKReadAdapter(googleReadWithNoMappingQuality), ReadConstants.NO_MAPPING_QUALITY }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:20,代码来源:GATKReadAdaptersUnitTest.java

示例14: getAndSetBaseQualitiesData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "GetAndSetBaseQualitiesData")
public Object[][] getAndSetBaseQualitiesData() {
    final SAMRecord noQualsSam = basicSAMRecord();
    noQualsSam.setBaseQualities(null);

    final SAMRecord emptyQualsSam = basicSAMRecord();
    emptyQualsSam.setBaseQualities(new byte[0]);

    final Read noQualsGoogleRead = basicGoogleGenomicsRead();
    noQualsGoogleRead.setAlignedQuality(null);

    final Read emptyQualsGoogleRead = basicGoogleGenomicsRead();
    emptyQualsGoogleRead.setAlignedQuality(new ArrayList<>());

    return new Object[][]{
            { basicReadBackedBySam(), BASIC_READ_BASE_QUALITIES },
            { basicReadBackedByGoogle(), BASIC_READ_BASE_QUALITIES },
            { new SAMRecordToGATKReadAdapter(noQualsSam), new byte[0] },
            { new SAMRecordToGATKReadAdapter(emptyQualsSam), new byte[0] },
            { new GoogleGenomicsReadToGATKReadAdapter(noQualsGoogleRead), new byte[0] },
            { new GoogleGenomicsReadToGATKReadAdapter(emptyQualsGoogleRead), new byte[0] }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:24,代码来源:GATKReadAdaptersUnitTest.java

示例15: getAndSetCigarData

import com.google.api.services.genomics.model.Read; //导入依赖的package包/类
@DataProvider(name = "GetAndSetCigarData")
public Object[][] getAndSetCigarData() {

    SAMRecord noCigarSam = basicSAMRecord();
    noCigarSam.setCigar(null);

    SAMRecord emptyCigarSam = basicSAMRecord();
    emptyCigarSam.setCigar(new Cigar());

    Read noCigarRead = basicGoogleGenomicsRead();
    noCigarRead.getAlignment().setCigar(null);

    Read emptyCigarRead = basicGoogleGenomicsRead();
    emptyCigarRead.getAlignment().setCigar(null);

    return new Object[][]{
            { basicReadBackedBySam(), TextCigarCodec.decode(BASIC_READ_CIGAR) },
            { basicReadBackedByGoogle(), TextCigarCodec.decode(BASIC_READ_CIGAR) },
            { new SAMRecordToGATKReadAdapter(noCigarSam), new Cigar() },
            { new SAMRecordToGATKReadAdapter(emptyCigarSam), new Cigar() },
            { new GoogleGenomicsReadToGATKReadAdapter(noCigarRead), new Cigar() },
            { new GoogleGenomicsReadToGATKReadAdapter(emptyCigarRead), new Cigar() }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:25,代码来源:GATKReadAdaptersUnitTest.java


注:本文中的com.google.api.services.genomics.model.Read类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。