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


Java SAMReadGroupRecord.setPlatform方法代码示例

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


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

示例1: createReadGroupRecord

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
protected SAMReadGroupRecord createReadGroupRecord(
        String RGID, String RGLB, String RGPL, 
        String RGPU, String RGSM, String RGCN, 
        String RGDS, Iso8601Date RGDT, Integer RGPI) {
    SAMReadGroupRecord rg = new SAMReadGroupRecord(RGID);
    rg.setLibrary(RGLB);
    rg.setPlatform(RGPL);
    rg.setSample(RGSM);
    rg.setPlatformUnit(RGPU);
    if(RGCN != null)
        rg.setSequencingCenter(RGCN);
    if(RGDS != null)
        rg.setDescription(RGDS);
    if(RGDT != null)
        rg.setRunDate(RGDT);
    if(RGPI != null)
        rg.setPredictedMedianInsertSize(RGPI);
    return rg;
}
 
开发者ID:biointec,项目名称:halvade,代码行数:20,代码来源:HalvadeReducer.java

示例2: createSamFileHeader

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/** 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 ;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:25,代码来源:FastqToSam.java

示例3: parsePlatformForRead

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/**
 * Section of code shared between the two recalibration walkers which uses the command line arguments to adjust attributes of the read such as quals or platform string
 *
 * @param read The read to adjust
 * @param RAC  The list of shared command line arguments
 */
public static void parsePlatformForRead(final GATKRead read, final SAMFileHeader header, final RecalibrationArgumentCollection RAC) {
    final SAMReadGroupRecord readGroup = ReadUtils.getSAMReadGroupRecord(read, header);

    if (RAC.FORCE_PLATFORM != null && (readGroup.getPlatform() == null || !readGroup.getPlatform().equals(RAC.FORCE_PLATFORM))) {
        readGroup.setPlatform(RAC.FORCE_PLATFORM);
    }

    if (readGroup.getPlatform() == null) {
        if (RAC.DEFAULT_PLATFORM != null) {
            if (!warnUserNullPlatform) {
                Utils.warnUser("The input .bam file contains reads with no platform information. " +
                        "Defaulting to platform = " + RAC.DEFAULT_PLATFORM + ". " +
                        "First observed at read with name = " + read.getName());
                warnUserNullPlatform = true;
            }
            readGroup.setPlatform(RAC.DEFAULT_PLATFORM);
        }
        else {
            throw new UserException.MalformedRead(read, "The input .bam file contains reads with no platform information. First observed at read with name = " + read.getName());
        }
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:29,代码来源:RecalUtils.java

示例4: readsWithReadGroupData

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
@DataProvider(name = "ReadsWithReadGroupData")
public Object[][] readsWithReadGroupData() {
    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(2, 1, 1000000);
    final SAMReadGroupRecord readGroup = new SAMReadGroupRecord("FOO");
    readGroup.setPlatform("FOOPLATFORM");
    readGroup.setPlatformUnit("FOOPLATFORMUNIT");
    readGroup.setLibrary("FOOLIBRARY");
    readGroup.setSample("FOOSAMPLE");
    header.addReadGroup(readGroup);

    final GATKRead googleBackedRead = new GoogleGenomicsReadToGATKReadAdapter(ArtificialReadUtils.createArtificialGoogleGenomicsRead("google", "1", 5, new byte[]{'A', 'C', 'G', 'T'}, new byte[]{1, 2, 3, 4}, "4M"));
    googleBackedRead.setReadGroup("FOO");

    final GATKRead samBackedRead = new SAMRecordToGATKReadAdapter(ArtificialReadUtils.createArtificialSAMRecord(header, "sam", header.getSequenceIndex("1"), 5, new byte[]{'A', 'C', 'G', 'T'}, new byte[]{1, 2, 3, 4}, "4M"));
    samBackedRead.setReadGroup("FOO");

    return new Object[][] {
            { googleBackedRead, header, "FOO" },
            { samBackedRead, header, "FOO" }
    };
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:22,代码来源:ReadUtilsUnitTest.java

示例5: transfer

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
public static SAMReadGroupRecord transfer(ReadGroupInfo readGroupInfo) {
    SAMReadGroupRecord record = new SAMReadGroupRecord(readGroupInfo.id());
    record.setSample(readGroupInfo.sample());
    record.setLibrary(readGroupInfo.lib());
    record.setPlatform(readGroupInfo.platform());
    record.setPlatformUnit(readGroupInfo.platformUnit());
    return record;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:9,代码来源:SAMReadGroupRecordTransfer.java

示例6: defaultPlatformForRead

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
public static void defaultPlatformForRead(GaeaSamRecord read, String forcePlatform, String defaultPlatform) {
	SAMReadGroupRecord readGroup = read.getReadGroup();
	String platform = readGroup.getPlatform();
	if (forcePlatform != null && (platform == null || !platform.equals(forcePlatform)))
		readGroup.setPlatform(forcePlatform);

	if (readGroup.getPlatform() == null) {
		if (defaultPlatform != null)
			readGroup.setPlatform(defaultPlatform);
	}
}
 
开发者ID:BGI-flexlab,项目名称:SOAPgaea,代码行数:12,代码来源:RecalibratorUtil.java

示例7: getReadGroupFromArguments

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/**
 * Gets a basic Read Group from the arguments.
 *
 * Note: the program group is set to {@link RTHelpConstants#PROGRAM_NAME}.
 *
 */
public SAMReadGroupRecord getReadGroupFromArguments(final String id, final String sampleName) {
    final SAMReadGroupRecord rg = new SAMReadGroupRecord(id);
    rg.setProgramGroup(RTHelpConstants.PROGRAM_NAME);
    rg.setSample(sampleName);
    // the program group is the one in the project properties
    rg.setProgramGroup(RTHelpConstants.PROGRAM_NAME);
    if (readGroupLibrary != null) {
        rg.setLibrary(readGroupLibrary);
    }
    if (readGroupPlatform != null) {
        rg.setPlatform(readGroupPlatform.toString());
    }
    if (readGroupPlatformUnit != null) {
        rg.setPlatformUnit(readGroupPlatformUnit);
    }
    if (readGroupSequencingCenter != null) {
        rg.setSequencingCenter(readGroupSequencingCenter);
    }
    if (readGroupRunDate != null) {
        rg.setRunDate(readGroupRunDate);
    }
    if (readGroupPredictedInsertSize != null) {
        rg.setPredictedMedianInsertSize(readGroupPredictedInsertSize);
    }
    if (readGroupPlatformModel != null) {
        rg.setPlatformModel(readGroupPlatformModel);
    }
    // return it
    return rg;
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:37,代码来源:ReadGroupArgumentCollection.java

示例8: testGetReadGroupWithArguments

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
@Test
public void testGetReadGroupWithArguments() throws Exception {
    // setting expected RG
    final SAMReadGroupRecord expected = new SAMReadGroupRecord("RGID");
    expected.setProgramGroup("ReadTools");
    expected.setSample("sampleName");
    // setting args
    final ReadGroupArgumentCollection rgargs = new ReadGroupArgumentCollection();

    // starting setting params
    expected.setLibrary("LB");
    rgargs.readGroupLibrary = "LB";

    expected.setPlatform("ILLUMINA");
    rgargs.readGroupPlatform = SAMReadGroupRecord.PlatformValue.ILLUMINA;

    expected.setPlatformUnit("PU");
    rgargs.readGroupPlatformUnit = expected.getPlatformUnit();

    expected.setSequencingCenter("CN");
    rgargs.readGroupSequencingCenter = expected.getSequencingCenter();

    final Iso8601Date date = new Iso8601Date("2007-11-03");
    expected.setRunDate(date);
    rgargs.readGroupRunDate = date;

    expected.setPredictedMedianInsertSize(100);
    rgargs.readGroupPredictedInsertSize = expected.getPredictedMedianInsertSize();

    expected.setPlatformModel("PM");
    rgargs.readGroupPlatformModel = expected.getPlatformModel();

    // testing
    Assert.assertEquals(rgargs
                    .getReadGroupFromArguments(expected.getReadGroupId(), expected.getSample()),
            expected);
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:38,代码来源:ReadGroupArgumentCollectionUnitTest.java

示例9: setupTest1

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:34,代码来源:CollectGcBiasMetricsTest.java

示例10: setupTest2

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
public void setupTest2(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;
    final int contig3 = 2;
    readGroupRecord.setSample(sample);
    readGroupRecord.setPlatform(platform);
    readGroupRecord.setLibrary(library);
    readGroupRecord.setPlatformUnit(readGroupId);
    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 all 3 chr in reference file
    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/3) {
            setBuilder.addPair(newReadName, contig1, start + ID, start + ID + LENGTH);
        } else if (i< (NUM_READS - (NUM_READS/3))) {
            setBuilder.addPair(newReadName, contig2, start + ID, start + ID + LENGTH);
        } else {
            setBuilder.addPair(newReadName, contig3, start + ID, start + ID + LENGTH);
        }
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:36,代码来源:CollectGcBiasMetricsTest.java

示例11: setup

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:32,代码来源:CollectMultipleMetricsTest.java

示例12: init

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
@BeforeClass
public void init() {
    RAC = new RecalibrationArgumentCollection();
    covariate = new CycleCovariate(RAC);
    illuminaReadGroup = new SAMReadGroupRecord("MY.ID");
    illuminaReadGroup.setPlatform("illumina");
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:8,代码来源:CycleCovariateUnitTest.java

示例13: testLIBS_NotHoldingTooManyReads

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
@Test(enabled = true, dataProvider = "LIBS_NotHoldingTooManyReads")
public void testLIBS_NotHoldingTooManyReads(final int nReadsPerLocus, final int downsampleTo, final int payloadInBytes) {
    logger.warn(String.format("testLIBS_NotHoldingTooManyReads %d %d %d", nReadsPerLocus, downsampleTo, payloadInBytes));
    final int readLength = 10;

    final SAMFileHeader header = ArtificialReadUtils.createArtificialSamHeader(1, 1, 100000);
    final int nSamples = 1;
    final List<String> samples = new ArrayList<>(nSamples);
    for ( int i = 0; i < nSamples; i++ ) {
        final SAMReadGroupRecord rg = new SAMReadGroupRecord("rg" + i);
        final String sample = "sample" + i;
        samples.add(sample);
        rg.setSample(sample);
        rg.setPlatform(NGSPlatform.ILLUMINA.getDefaultPlatform());
        header.addReadGroup(rg);
    }

    final boolean downsample = downsampleTo != -1;
    final DownsamplingMethod downsampler = downsample
            ? new DownsamplingMethod(DownsampleType.BY_SAMPLE, downsampleTo, null)
            : new DownsamplingMethod(DownsampleType.NONE, null, null);

    final WeakReadTrackingIterator iterator = new WeakReadTrackingIterator(nReadsPerLocus, readLength, payloadInBytes, header);

    final LocusIteratorByState li;
    li = new LocusIteratorByState(
            iterator,
            downsampler,
            false,
            samples,
            header,
            true
    );

    while ( li.hasNext() ) {
        final AlignmentContext next = li.next();
        Assert.assertTrue(next.getBasePileup().size() <= downsampleTo, "Too many elements in pileup " + next);
        // TODO -- assert that there are <= X reads in memory after GC for some X
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:41,代码来源:LocusIteratorByStateUnitTest.java

示例14: testPLFromReadWithRG

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
/**
 * 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 = ArtificialReadUtils.createArtificialSamHeader(seq.getSequenceDictionary());
    final String rgID = "ID";
    final SAMReadGroupRecord rg = new SAMReadGroupRecord(rgID);
    if ( plField != null )
        rg.setPlatform(plField);
    header.addReadGroup(rg);
    final GATKRead read = ArtificialReadUtils.createArtificialRead(header, "myRead", 0, 1, 10);
    read.setAttribute("RG", rgID);
    Assert.assertEquals(NGSPlatform.fromRead(read, header), expected);
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:16,代码来源:NGSPlatformUnitTest.java

示例15: doWork

import htsjdk.samtools.SAMReadGroupRecord; //导入方法依赖的package包/类
protected int doWork() {
    IOUtil.assertInputIsValid(INPUT);
    IOUtil.assertFileIsWritable(OUTPUT);

    final SamReader in = SamReaderFactory.makeDefault()
        .referenceSequence(REFERENCE_SEQUENCE)
        .open(SamInputResource.of(INPUT));

    // create the read-group we'll be using
    final SAMReadGroupRecord rg = new SAMReadGroupRecord(RGID);
    rg.setLibrary(RGLB);
    rg.setPlatform(RGPL);
    rg.setSample(RGSM);
    rg.setPlatformUnit(RGPU);
    if (RGCN != null) rg.setSequencingCenter(RGCN);
    if (RGDS != null) rg.setDescription(RGDS);
    if (RGDT != null) rg.setRunDate(RGDT);
    if (RGPI != null) rg.setPredictedMedianInsertSize(RGPI);
    if (RGPG != null) rg.setProgramGroup(RGPG);
    if (RGPM != null) rg.setPlatformModel(RGPM);
    if (RGKS != null) rg.setKeySequence(RGKS);
    if (RGFO != null) rg.setFlowOrder(RGFO);

    log.info(String.format("Created read-group ID=%s PL=%s LB=%s SM=%s%n", rg.getId(), rg.getPlatform(), rg.getLibrary(), rg.getSample()));

    // create the new header and output file
    final SAMFileHeader inHeader = in.getFileHeader();
    final SAMFileHeader outHeader = inHeader.clone();
    outHeader.setReadGroups(Collections.singletonList(rg));
    if (SORT_ORDER != null) outHeader.setSortOrder(SORT_ORDER);

    final SAMFileWriter outWriter = new SAMFileWriterFactory().makeSAMOrBAMWriter(outHeader,
            outHeader.getSortOrder() == inHeader.getSortOrder(),
            OUTPUT);

    final ProgressLogger progress = new ProgressLogger(log);
    for (final SAMRecord read : in) {
        read.setAttribute(SAMTag.RG.name(), RGID);
        outWriter.addAlignment(read);
        progress.record(read);
    }

    // cleanup
    CloserUtil.close(in);
    outWriter.close();
    return 0;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:48,代码来源:AddOrReplaceReadGroups.java


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