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


Java Read.setAlignment方法代码示例

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


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

示例1: 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

示例2: createArtificialGoogleGenomicsRead

import com.google.api.services.genomics.model.Read; //导入方法依赖的package包/类
public static Read createArtificialGoogleGenomicsRead( final String name, final String contig, final int start, final byte[] bases, final byte[] quals, final String cigar ) {
    Read googleRead = new Read();

    googleRead.setFragmentName(name);
    googleRead.setAlignment(new LinearAlignment());
    googleRead.getAlignment().setPosition(new Position());
    googleRead.getAlignment().getPosition().setReferenceName(contig);
    googleRead.getAlignment().getPosition().setPosition((long) start - 1);
    googleRead.setAlignedSequence(StringUtil.bytesToString(bases));
    googleRead.getAlignment().setCigar(CigarConversionUtils.convertSAMCigarToCigarUnitList(TextCigarCodec.decode(cigar)));

    List<Integer> convertedQuals = new ArrayList<>();
    for ( byte b : quals ) {
        convertedQuals.add((int)b);
    }
    googleRead.setAlignedQuality(convertedQuals);

    // Create a fully formed read that can be wrapped by a GATKRead and have a valid
    // SAMString without GATKRead throwing missing field exceptions.
    googleRead.setFailedVendorQualityChecks(false);
    googleRead.setSecondaryAlignment(false);
    googleRead.setSupplementaryAlignment(false);
    googleRead.setDuplicateFragment(false);

    Position matePos = new Position();
    matePos.setReverseStrand(false);
    googleRead.setNextMatePosition(matePos);

    return googleRead;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:31,代码来源:ArtificialReadUtils.java

示例3: getUnmappedReads

import com.google.api.services.genomics.model.Read; //导入方法依赖的package包/类
private static List<GATKRead> getUnmappedReads() {
    List<GATKRead> unmappedReads = new ArrayList<>();

    final SAMRecord unmappedFlagSam = basicSAMRecord();
    unmappedFlagSam.setReadUnmappedFlag(true);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(unmappedFlagSam));

    final SAMRecord unmappedContigSam = basicSAMRecord();
    unmappedContigSam.setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(unmappedContigSam));

    final SAMRecord noAlignmentStartSam = basicSAMRecord();
    noAlignmentStartSam.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
    unmappedReads.add(new SAMRecordToGATKReadAdapter(noAlignmentStartSam));

    final Read noAlignmentGoogleRead = basicGoogleGenomicsRead();
    noAlignmentGoogleRead.setAlignment(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noAlignmentGoogleRead));

    final Read noPositionGoogleRead = basicGoogleGenomicsRead();
    noPositionGoogleRead.getAlignment().setPosition(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noPositionGoogleRead));

    final Read noContigGoogleRead = basicGoogleGenomicsRead();
    noContigGoogleRead.getAlignment().getPosition().setReferenceName(null);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noContigGoogleRead));

    final Read starContigGoogleRead = basicGoogleGenomicsRead();
    starContigGoogleRead.getAlignment().getPosition().setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(starContigGoogleRead));

    final Read noStartGoogleRead = basicGoogleGenomicsRead();
    noStartGoogleRead.getAlignment().getPosition().setPosition(-1l);
    unmappedReads.add(new GoogleGenomicsReadToGATKReadAdapter(noStartGoogleRead));

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

示例4: testGetCigarString

import com.google.api.services.genomics.model.Read; //导入方法依赖的package包/类
@Test
public void testGetCigarString() throws Exception {
  Read read = new Read();
  assertEquals(null, ReadUtils.getCigarString(read));

  List<CigarUnit> cigar = Lists.newArrayList(
      new CigarUnit().setOperation("ALIGNMENT_MATCH").setOperationLength(100L),
      new CigarUnit().setOperation("CLIP_SOFT").setOperationLength(3L));
  read.setAlignment(new LinearAlignment().setCigar(cigar));
  assertEquals("100M3S", ReadUtils.getCigarString(read));
}
 
开发者ID:googlegenomics,项目名称:utils-java,代码行数:12,代码来源:ReadUtilsTest.java

示例5: readHasNoAssignedPositionTestData

import com.google.api.services.genomics.model.Read; //导入方法依赖的package包/类
@DataProvider(name = "ReadHasNoAssignedPositionTestData")
public Object[][] readHasNoAssignedPositionTestData() {
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader();

    // To test the "null contig" cases, we need to use a Google Genomics Read, since SAMRecord doesn't allow it
    final Read unmappedGoogleReadWithNullContigSetStart = new Read();
    unmappedGoogleReadWithNullContigSetStart.setAlignment(new LinearAlignment());
    unmappedGoogleReadWithNullContigSetStart.getAlignment().setPosition(new Position());
    unmappedGoogleReadWithNullContigSetStart.getAlignment().getPosition().setReferenceName(null);
    unmappedGoogleReadWithNullContigSetStart.getAlignment().getPosition().setPosition(10l);
    final GATKRead unmappedReadWithNullContigSetStart = new GoogleGenomicsReadToGATKReadAdapter(unmappedGoogleReadWithNullContigSetStart);

    final Read unmappedGoogleReadWithNullContigUnsetStart = new Read();
    unmappedGoogleReadWithNullContigUnsetStart.setAlignment(new LinearAlignment());
    unmappedGoogleReadWithNullContigUnsetStart.getAlignment().setPosition(new Position());
    unmappedGoogleReadWithNullContigUnsetStart.getAlignment().getPosition().setReferenceName(null);
    unmappedGoogleReadWithNullContigUnsetStart.getAlignment().getPosition().setPosition(Long.valueOf(ReadConstants.UNSET_POSITION));
    final GATKRead unmappedReadWithNullContigUnsetStart = new GoogleGenomicsReadToGATKReadAdapter(unmappedGoogleReadWithNullContigUnsetStart);

    // We'll also test the improbable case of a SAMRecord marked as mapped, but with an unset contig/start
    final SAMRecord mappedSAMWithUnsetContigSetStart = new SAMRecord(header);
    mappedSAMWithUnsetContigSetStart.setReferenceName(ReadConstants.UNSET_CONTIG);
    mappedSAMWithUnsetContigSetStart.setAlignmentStart(10);
    mappedSAMWithUnsetContigSetStart.setReadUnmappedFlag(false);
    final GATKRead mappedReadWithUnsetContigSetStart = new SAMRecordToGATKReadAdapter(mappedSAMWithUnsetContigSetStart);

    final SAMRecord mappedSAMWithSetContigUnsetStart = new SAMRecord(header);
    mappedSAMWithSetContigUnsetStart.setReferenceName("1");
    mappedSAMWithSetContigUnsetStart.setAlignmentStart(ReadConstants.UNSET_POSITION);
    mappedSAMWithSetContigUnsetStart.setReadUnmappedFlag(false);
    final GATKRead mappedReadWithSetContigUnsetStart = new SAMRecordToGATKReadAdapter(mappedSAMWithSetContigUnsetStart);

    return new Object[][] {
            // Mapped read with position
            { ArtificialReadUtils.createArtificialRead(header, "foo", 0, 5, 10), false },
            // Basic unmapped read with no position
            { ArtificialReadUtils.createArtificialUnmappedRead(header, new byte[]{'A'}, new byte[]{30}), true },
            // Unmapped read with set position (contig and start)
            { ArtificialReadUtils.createArtificialUnmappedReadWithAssignedPosition(header, "1", 10, new byte[]{'A'}, new byte[]{30}), false },
            // Unmapped read with null contig, set start
            { unmappedReadWithNullContigSetStart, true },
            // Unmapped read with "*" contig, set start
            { ArtificialReadUtils.createArtificialUnmappedReadWithAssignedPosition(header, ReadConstants.UNSET_CONTIG, 10, new byte[]{'A'}, new byte[]{30}), true },
            // Unmapped read with set contig, unset start
            { ArtificialReadUtils.createArtificialUnmappedReadWithAssignedPosition(header, "1", ReadConstants.UNSET_POSITION, new byte[]{'A'}, new byte[]{30}), true },
            // Unmapped read with null contig, unset start
            { unmappedReadWithNullContigUnsetStart, true },
            // Unmapped read with "*" contig, unset start
            { ArtificialReadUtils.createArtificialUnmappedReadWithAssignedPosition(header, ReadConstants.UNSET_CONTIG, ReadConstants.UNSET_POSITION, new byte[]{'A'}, new byte[]{30}), true },
            // "Mapped" read with unset contig, set start
            { mappedReadWithUnsetContigSetStart, true },
            // "Mapped" read with set contig, unset start
            { mappedReadWithSetContigUnsetStart, true }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:56,代码来源:ReadUtilsUnitTest.java

示例6: getAssignedPositionData

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

    testCases.add(new Object[]{basicReadBackedBySam(), BASIC_READ_CONTIG, BASIC_READ_START});
    testCases.add(new Object[]{basicReadBackedByGoogle(), BASIC_READ_CONTIG, BASIC_READ_START});

    // SAMRecord, unmapped flag set, but has an assigned position
    final SAMRecord unmappedFlagSam = basicSAMRecord();
    unmappedFlagSam.setReadUnmappedFlag(true);
    testCases.add(new Object[]{new SAMRecordToGATKReadAdapter(unmappedFlagSam), BASIC_READ_CONTIG, BASIC_READ_START});

    // SAMRecord, unmapped flag not set, but no contig
    final SAMRecord unmappedContigSam = basicSAMRecord();
    unmappedContigSam.setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    testCases.add(new Object[]{new SAMRecordToGATKReadAdapter(unmappedContigSam), SAMRecord.NO_ALIGNMENT_REFERENCE_NAME, BASIC_READ_START});

    // SAMRecord, unmapped flag not set, but no start
    final SAMRecord noAlignmentStartSam = basicSAMRecord();
    noAlignmentStartSam.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START);
    testCases.add(new Object[]{new SAMRecordToGATKReadAdapter(noAlignmentStartSam), BASIC_READ_CONTIG, ReadConstants.UNSET_POSITION});

    // Google read, no alignment
    final Read noAlignmentGoogleRead = basicGoogleGenomicsRead();
    noAlignmentGoogleRead.setAlignment(null);
    testCases.add(new Object[]{new GoogleGenomicsReadToGATKReadAdapter(noAlignmentGoogleRead), null, ReadConstants.UNSET_POSITION});

    // Google read, no position
    final Read noPositionGoogleRead = basicGoogleGenomicsRead();
    noPositionGoogleRead.getAlignment().setPosition(null);
    testCases.add(new Object[]{new GoogleGenomicsReadToGATKReadAdapter(noPositionGoogleRead), null, ReadConstants.UNSET_POSITION});

    // Google read, position with no contig
    final Read noContigGoogleRead = basicGoogleGenomicsRead();
    noContigGoogleRead.getAlignment().getPosition().setReferenceName(null);
    testCases.add(new Object[]{new GoogleGenomicsReadToGATKReadAdapter(noContigGoogleRead), null, BASIC_READ_START});

    // Google read, position with * contig
    final Read starContigGoogleRead = basicGoogleGenomicsRead();
    starContigGoogleRead.getAlignment().getPosition().setReferenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
    testCases.add(new Object[]{new GoogleGenomicsReadToGATKReadAdapter(starContigGoogleRead), SAMRecord.NO_ALIGNMENT_REFERENCE_NAME, BASIC_READ_START});

    // Google read, position with contig but no start
    final Read noStartGoogleRead = basicGoogleGenomicsRead();
    noStartGoogleRead.getAlignment().getPosition().setPosition(-1l);
    testCases.add(new Object[]{new GoogleGenomicsReadToGATKReadAdapter(noStartGoogleRead), BASIC_READ_CONTIG, ReadConstants.UNSET_POSITION});

    return testCases.toArray(new Object[][]{});
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:50,代码来源:GATKReadAdaptersUnitTest.java


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