本文整理汇总了Java中htsjdk.samtools.DefaultSAMRecordFactory类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSAMRecordFactory类的具体用法?Java DefaultSAMRecordFactory怎么用?Java DefaultSAMRecordFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSAMRecordFactory类属于htsjdk.samtools包,在下文中一共展示了DefaultSAMRecordFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: openBAMReader
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
private static SamReader openBAMReader(SamInputResource resource, ValidationStringency stringency, boolean includeFileSource, long offset) throws IOException {
SamReaderFactory samReaderFactory = SamReaderFactory
.makeDefault()
.validationStringency(stringency)
.enable(SamReaderFactory.Option.CACHE_FILE_BASED_INDEXES);
if (includeFileSource) {
samReaderFactory.enable(SamReaderFactory.Option.INCLUDE_SOURCE_IN_RECORDS);
}
if (offset == 0) {
return samReaderFactory.open(resource);
}
LOG.info("Initializing seeking reader with the offset of " + offset);
SeekingBAMFileReader primitiveReader = new SeekingBAMFileReader(resource,
false,
stringency,
DefaultSAMRecordFactory.getInstance(),
offset);
final SeekingReaderAdapter reader =
new SeekingReaderAdapter(primitiveReader, resource);
samReaderFactory.reapplyOptions(reader);
return reader;
}
开发者ID:googlegenomics,项目名称:dataflow-java,代码行数:23,代码来源:BAMIO.java
示例2: align
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
private void align(Context context) throws IOException, InterruptedException {
result = mem.align(L1, L2);
for (int i = 0; i < result.length; i++) {
String read = result[i];
String sample = ((SingleRead) L1.get(i / 2)).getFilename();
/**
* hack to write a valid SAM since BWA MEM outputs tabs at the end,
* samtools can not handle this
*/
read = read.replaceAll("\\t+$", "");
read = read.replaceAll("\\s+$", "");
String tiles[] = read.split("\t+\n");
for (String tile : tiles) {
SAMLineParser parser = new SAMLineParser(new DefaultSAMRecordFactory(),
ValidationStringency.SILENT, new SAMFileHeader(),
null, null);
SAMRecord samRecord = parser.parseLine(tile);
if(samRecord.getIntegerAttribute("AS")<30){
continue;
}
out.clear();
out.set(tile);
context.write(new Text(sample), out);
}
}
L1.clear();
L2.clear();
}
开发者ID:seppinho,项目名称:mutation-server,代码行数:41,代码来源:PairedAlignerReducer.java
示例3: getSamReader
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
public static SamReader getSamReader(String filename) {
return SamReaderFactory.make()
.validationStringency(ValidationStringency.SILENT)
.samRecordFactory(DefaultSAMRecordFactory.getInstance())
.open(new File(filename));
}
开发者ID:mozack,项目名称:abra2,代码行数:8,代码来源:SAMRecordUtils.java
示例4: close
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
@Override
public void close()
{
LOG.info("CLOSING "+this.groupName+" N="+this.count);
if(count==0L && SplitBam3.this.ADD_MOCK_RECORD)
{
final List<SAMReadGroupRecord> G=getFileHeader().getReadGroups();
final String bases="NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN";
final SAMRecordFactory f=new DefaultSAMRecordFactory();
++id_generator;
for(int i=0;i< 2;++i)
{
final SAMRecord rec=f.createSAMRecord(getFileHeader());
rec.setFirstOfPairFlag(i%2==0);
rec.setSecondOfPairFlag(i%2==1);
rec.setReadBases(bases.getBytes());
rec.setMappingQuality(0);
rec.setBaseQualityString(bases.replace('N', '#'));
rec.setReadUnmappedFlag(true);
rec.setMateUnmappedFlag(true);
rec.setReadPairedFlag(true);
String readName="MOCKREAD"+(id_generator)+":1:190:289:82";
rec.setReadName(readName);
LOG.info("generating mock read: "+readName);
rec.setAttribute("MK",1);
if(G!=null && !G.isEmpty())
{
rec.setAttribute("RG", G.get(0).getId());
}
this.addAlignment(rec);
}
}
CloserUtil.close(this._writer);
this._writer=null;
}
开发者ID:lindenb,项目名称:jvarkit,代码行数:36,代码来源:SplitBam3.java
示例5: Basic2SAMRecordTransfer
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
public Basic2SAMRecordTransfer(SAMFileHeader header) {
this.mFileHeader = header;
this.samRecordFactory = new DefaultSAMRecordFactory();
this.validationStringency = ValidationStringency.DEFAULT_STRINGENCY;
}
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:6,代码来源:Basic2SAMRecordTransfer.java
示例6: SortTestSE
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
@Test
public void SortTestSE() throws IOException {
String inputFolder = "test-data/mtdna/fastqse/input";
String archive = "test-data/mtdna/fastqse/reference/rcrs.tar.gz";
String hdfsFolder = "inputSE";
String type = "se";
importInputdata(inputFolder, hdfsFolder);
// create workflow context
WorkflowTestContext context = buildContext(hdfsFolder, archive, type);
// create step instance
AlignStep align = new AlignnMock("files");
context.setOutput("bwaOut", "cloudgene-bwaOut");
context.setOutput("outputBam", "outputBam");
boolean result = align.run(context);
assertTrue(result);
SortStep sort = new SortMock("files");
result = sort.run(context);
assertTrue(result);
assertTrue(HdfsUtil.exists("outputBam"));
List<String> files = HdfsUtil.getFiles("outputBam");
String out = "test-data/tmp/out.bam";
for (String file : files) {
HdfsUtil.get(file, out);
}
final SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT)
.samRecordFactory(DefaultSAMRecordFactory.getInstance()).open(new File(out));
SAMRecordIterator s = reader.iterator();
int i = 0;
while (s.hasNext()) {
SAMRecord rec = s.next();
//read having two alignments (first, secondary).
if(rec.getReadName().equals("QS6LK:01115:01248")){
System.out.println("sorted " + rec.getSAMString());
}
if (rec.getReadName().equals("QS6LK:01421:01280")) {
assertEquals("rCRS", rec.getContig());
}
i++;
}
assertEquals(317, i);
//FileUtil.deleteDirectory("test-data/tmp");
}
开发者ID:seppinho,项目名称:mutation-server,代码行数:60,代码来源:MutationServerTest.java
示例7: SortTestPE
import htsjdk.samtools.DefaultSAMRecordFactory; //导入依赖的package包/类
@Test
public void SortTestPE() throws IOException {
String inputFolder = "test-data/mtdna/fastqpe/input";
String archive = "test-data/mtdna/fastqpe/reference/rcrs.tar.gz";
String hdfsFolder = "inputPE";
String type = "pe";
importInputdata(inputFolder, hdfsFolder);
// create workflow context
WorkflowTestContext context = buildContext(hdfsFolder, archive, type);
// create step instance
AlignStep align = new AlignnMock("files");
context.setInput("chunkLength", "0");
context.setOutput("bwaOut", "cloudgene-bwaOut");
context.setOutput("outputBam", "outputBam");
boolean result = align.run(context);
assertTrue(result);
SortStep sort = new SortMock("files");
result = sort.run(context);
assertTrue(result);
assertTrue(HdfsUtil.exists("outputBam"));
List<String> files = HdfsUtil.getFiles("outputBam");
String out = "test-data/tmp/out.bam";
for (String file : files) {
HdfsUtil.get(file, out);
}
final SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT)
.samRecordFactory(DefaultSAMRecordFactory.getInstance()).open(new File(out));
SAMRecordIterator s = reader.iterator();
int i = 0;
while (s.hasNext()) {
SAMRecord rec = s.next();
i++;
System.out.println("sorted " + rec.getSAMString());
}
System.out.println("AMOUNT " + i);
FileUtil.deleteDirectory("test-data/tmp");
}
开发者ID:seppinho,项目名称:mutation-server,代码行数:53,代码来源:MutationServerTest.java
注:本文中的htsjdk.samtools.DefaultSAMRecordFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论