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


Java SAMProgramRecord.setCommandLine方法代码示例

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


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

示例1: getOutputWriterData

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
@DataProvider(name = "outputWriterProvider")
public Object[][] getOutputWriterData() {
    final File testDir = createTestTempDir(this.getClass().getSimpleName());
    final SAMProgramRecord record = new SAMProgramRecord("test");
    record.setCommandLine("command line");
    return new Object[][] {
            // TODO: test cram
            // {new File(testDir, "example.empty.cram"), null},
            // {new File(testDir, "example.cram"), record},
            // test bam
            {new File(testDir, "example.empty.bam"), null, false},
            {new File(testDir, "example.empty2.bam"), null, true},
            {new File(testDir, "example.bam"), record, false},
            {new File(testDir, "example2.bam"), record, true},
            // test sam
            {new File(testDir, "example.empty.sam"), null, false},
            {new File(testDir, "example.empty2.sam"), null, true},
            {new File(testDir, "example.sam"), record, false},
            {new File(testDir, "example2.sam"), record, true},
    };
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:22,代码来源:RTOutputBamArgumentCollectionUnitTest.java

示例2: buildSAMProgramRecord

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
public static SAMProgramRecord buildSAMProgramRecord(String prog, List<SAMProgramRecord> records) {
    String pgTemplate = "ngsutilsj:" + prog + "-";
    String pgID = pgTemplate;
    boolean found = true;
    int i = 0;
    
    SAMProgramRecord mostRecent = null;
    
    while (found) {
        found = false;
        i++;
        pgID = pgTemplate + i;
        if (records!=null) {
            for (SAMProgramRecord record: records) {
                if (mostRecent == null && (record.getPreviousProgramGroupId() == null || record.getPreviousProgramGroupId().equals(""))) {
                   mostRecent = record;
                }
                
                if (record.getId().equals(pgID)) {
                    found = true;
                }
            }
        }
    }

    SAMProgramRecord programRecord = new SAMProgramRecord(pgID);
    programRecord.setProgramName("ngsutilsj:"+prog);
    programRecord.setProgramVersion(NGSUtils.getVersion());
    programRecord.setCommandLine("ngsutilsj " + NGSUtils.getArgs());
    if (mostRecent!=null) {
        programRecord.setPreviousProgramGroupId(mostRecent.getId());
    }
    return programRecord;
}
 
开发者ID:compgen-io,项目名称:ngsutilsj,代码行数:35,代码来源:BamHeaderUtils.java

示例3: getChainedPgIds

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
/**
 * We have to re-chain the program groups based on this algorithm.  This returns the map from existing program group ID
 * to new program group ID.
 */
protected Map<String, String> getChainedPgIds(final SAMFileHeader outputHeader) {
    final Map<String, String> chainedPgIds;
    // Generate new PG record(s)
    if (PROGRAM_RECORD_ID != null) {
        final SAMFileHeader.PgIdGenerator pgIdGenerator = new SAMFileHeader.PgIdGenerator(outputHeader);
        if (PROGRAM_GROUP_VERSION == null) {
            PROGRAM_GROUP_VERSION = this.getVersion();
        }
        if (PROGRAM_GROUP_COMMAND_LINE == null) {
            PROGRAM_GROUP_COMMAND_LINE = this.getCommandLine();
        }
        chainedPgIds = new HashMap<>();
        for (final String existingId : this.pgIdsSeen) {
            final String newPgId = pgIdGenerator.getNonCollidingId(PROGRAM_RECORD_ID);
            chainedPgIds.put(existingId, newPgId);
            final SAMProgramRecord programRecord = new SAMProgramRecord(newPgId);
            programRecord.setProgramVersion(PROGRAM_GROUP_VERSION);
            programRecord.setCommandLine(PROGRAM_GROUP_COMMAND_LINE);
            programRecord.setProgramName(PROGRAM_GROUP_NAME);
            programRecord.setPreviousProgramGroupId(existingId);
            outputHeader.addProgramRecord(programRecord);
        }
    } else {
        chainedPgIds = null;
    }
    return chainedPgIds;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:32,代码来源:AbstractMarkDuplicatesCommandLineProgram.java

示例4: getHeaderForSAMWriter

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
/**
 * Returns the SAM header suitable for writing SAM/BAM/CRAM files produced by this tool.
 *
 * The default implementation calls {@link #getHeaderForReads} (and makes an empty header if that call returns null)
 * and optionally adds program tag to the header with a program version {@link #getVersion()}, program name {@link #getToolName()}
 * and command line {@link #getCommandLine()}.
 *
 * Subclasses may override.
 *
 * @return SAM header for the SAM writer with (optionally, if {@link #addOutputSAMProgramRecord} is true) program record appropriately.
 */
protected SAMFileHeader getHeaderForSAMWriter(){
    final SAMFileHeader header = getHeaderForReads() == null ? new SAMFileHeader(): getHeaderForReads();
    if (addOutputSAMProgramRecord) {
        final SAMProgramRecord programRecord = new SAMProgramRecord(createProgramGroupID(header));
        programRecord.setProgramVersion(getVersion());
        programRecord.setCommandLine(getCommandLine());
        programRecord.setProgramName(getToolName());
        header.addProgramRecord(programRecord);
    }
    return header;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:23,代码来源:GATKTool.java

示例5: reAlign

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
public void reAlign(String[] inputFiles, String[] outputFiles) throws Exception {
	
	this.inputSams = inputFiles;
	
	logStartupInfo(outputFiles);
			
	String tempDir = init();
	
	c2r = new CompareToReference2();
	c2r.init(this.reference);
	
	chromosomeChunker = new ChromosomeChunker(c2r);
	chromosomeChunker.init();

	Logger.info("Reading Input SAM Header and identifying read length");
	getSamHeaderAndReadLength();
	
	Logger.info("Read length: " + readLength);
	
	Logger.info("Loading target regions");
	loadRegions();
	loadJunctions();
	
	Clock clock = new Clock("Realignment");
	clock.start();
	
	if (contigFile != null) {
		contigWriter = new BufferedWriter(new FileWriter(contigFile, false));
	}
			
	for (int i=0; i<inputSams.length; i++) {
		
		SAMProgramRecord pg = new SAMProgramRecord("ABRA2");
		pg.setProgramVersion(this.version);
		pg.setCommandLine(cl);
		samHeaders[i].addProgramRecord(pg);			
	}
	
	writer = new SortedSAMWriter(outputFiles, tempDir.toString(), samHeaders, isKeepTmp, chromosomeChunker,
			finalCompressionLevel, shouldSort, maxRealignDist, shouldUnsetDuplicates, shouldCreateIndex, shouldUseGkl, maxReadsInRamForSort);

	// Spawn thread for each chromosome
	// TODO: Validate identical sequence dictionary for each input file
	
	for (int i=0; i<this.chromosomeChunker.getChunks().size(); i++) {
		spawnChromosomeThread(i);
	}
	
	Logger.info("Waiting for processing threads to complete");
	threadManager.waitForAllThreadsToComplete();
	
	if (contigWriter != null) {
		contigWriter.close();
	}
	
	clock.stopAndPrint();
	
	clock = new Clock("Sort and cleanup");
	clock.start();
	
	// Cut num threads in half to allow for async writer thread
	threadManager = new ThreadManager(Math.max(numThreads / 2, 1));
	
	for (int i=0; i<outputFiles.length; i++) {
		SortedSAMWriterRunnable thread = new SortedSAMWriterRunnable(threadManager, writer, i, inputSams[i]);
		threadManager.spawnThread(thread);
	}
	
	Logger.info("Waiting for writer threads to complete");
	threadManager.waitForAllThreadsToComplete();
	
	clock.stopAndPrint();
	
	Logger.info("Done.");
}
 
开发者ID:mozack,项目名称:abra2,代码行数:76,代码来源:ReAligner.java

示例6: addPG

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
public void addPG(SAMFileHeader header, String program, String cmd, String version) {
	SAMProgramRecord programRecord = header.createProgramRecord();
	programRecord.setCommandLine(cmd);
	programRecord.setProgramName(program);
	programRecord.setProgramVersion(version);
}
 
开发者ID:enasequence,项目名称:cramtools,代码行数:7,代码来源:FixBAMFileHeader.java

示例7: doWork

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
@Override
public int doWork(final List<String> args) {
	if(this.knownGeneUri==null || this.knownGeneUri.trim().isEmpty())
		{
		LOG.error("known Gene file undefined");
		return -1;
		}
	
	SamReader sfr=null;
	try
		{

		final Pattern tab=Pattern.compile("[\t]");
			{
			LOG.info("Opening "+this.knownGeneUri);
			LineIterator r=IOUtils.openURIForLineIterator(this.knownGeneUri);
			while(r.hasNext())
				{
				final KnownGene g=new KnownGene(tab.split(r.next()));
				if(g.getExonCount()==1) continue;//need spliced one
				final Interval interval = new Interval(g.getContig(), g.getTxStart()+1, g.getTxEnd());
				List<KnownGene> L = this.knownGenesMap.get(interval);
				if(L==null) {
					L= new ArrayList<>();
					this.knownGenesMap.put(interval,L);
				}
				L.add(g);
				}
			LOG.info("Done reading: "+this.knownGeneUri);
			}
		sfr = super.openSamReader(oneFileOrNull(args));
		
		SAMFileHeader header=sfr.getFileHeader().clone();
		SAMProgramRecord p=header.createProgramRecord();
		p.setCommandLine(getProgramCommandLine());
		p.setProgramVersion(getVersion());
		p.setProgramName(getProgramName());
		this.sfw=this.writingBamArgs.openSAMFileWriter(outputFile, header, true);
		
		header=sfr.getFileHeader().clone();
		p=header.createProgramRecord();
		p.setCommandLine(getProgramCommandLine());
		p.setProgramVersion(getVersion());
		p.setProgramName(getProgramName());
		this.weird=this.writingBamArgs.createSAMFileWriterFactory().makeSAMWriter(header,true, new NullOuputStream());
		
		scan(sfr);
		sfr.close();
		LOG.info("Done");
		return 0;
		}
	catch(final Exception err)
		{
		LOG.error(err);
		return -1;
		}
	finally
		{
		CloserUtil.close(sfr);
		CloserUtil.close(this.sfw);
		CloserUtil.close(this.weird);
		}
	}
 
开发者ID:lindenb,项目名称:jvarkit,代码行数:64,代码来源:FindNewSpliceSites.java

示例8: getProgramRecord

import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
/**
 * Returns a program tag to the header with a program version {@link #getVersion()}, program
 * name {@link #getToolName()} and command line {@link #getCommandLine()}.
 *
 * @param header the header to get an unique program group ID.
 *
 * @return the program record.
 */
protected final SAMProgramRecord getProgramRecord(final SAMFileHeader header) {
    final SAMProgramRecord programRecord = new SAMProgramRecord(createProgramGroupID(header));
    programRecord.setProgramVersion(getVersion());
    programRecord.setCommandLine(getCommandLine());
    programRecord.setProgramName(getToolName());
    return programRecord;
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:16,代码来源:ReadToolsProgram.java


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