本文整理汇总了Java中htsjdk.samtools.SAMProgramRecord.setProgramVersion方法的典型用法代码示例。如果您正苦于以下问题:Java SAMProgramRecord.setProgramVersion方法的具体用法?Java SAMProgramRecord.setProgramVersion怎么用?Java SAMProgramRecord.setProgramVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMProgramRecord
的用法示例。
在下文中一共展示了SAMProgramRecord.setProgramVersion方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillHeader
import htsjdk.samtools.SAMProgramRecord; //导入方法依赖的package包/类
private void fillHeader(XMLEventReader r,SAMProgramRecord prog) throws XMLStreamException,JAXBException
{
while(r.hasNext())
{
XMLEvent evt=r.peek();
if(!(evt.isStartElement()))
{
r.next();
continue;
}
StartElement E=evt.asStartElement();
String name=E.getName().getLocalPart();
if(name.equals("BlastOutput_iterations")) break;
r.next();
if(name.equals("BlastOutput_program"))
{
prog.setProgramName(r.getElementText());
}
else if(name.equals("BlastOutput_version"))
{
prog.setProgramVersion(r.getElementText().replace(' ', '_'));
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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.");
}
示例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);
}
示例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);
}
}
示例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;
}