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


Java SAMReadGroupRecord类代码示例

本文整理汇总了Java中net.sf.samtools.SAMReadGroupRecord的典型用法代码示例。如果您正苦于以下问题:Java SAMReadGroupRecord类的具体用法?Java SAMReadGroupRecord怎么用?Java SAMReadGroupRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeGenomeSAMFileHeader

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
/**
 * create a header object complete with a HD and SQ lines
 *
 * @param seqinfo
 * @return
 */
private SAMFileHeader makeGenomeSAMFileHeader(File genome, String readgroup) throws IOException {

    // get sequence information from the genome fai file
    File genomefai = new File(genome.getAbsoluteFile() + ".fai");
    BufferedReader faireader = BufferedReaderMaker.makeBufferedReader(genomefai);
    String s;

    SAMFileHeader header = new SAMFileHeader();
    header.setTextHeader("@HD	VN:1.0 SO:unsorted");
    while ((s = faireader.readLine()) != null) {
        String[] ssplit = s.split("\t");
        header.addSequence(new SAMSequenceRecord(ssplit[0], Integer.parseInt(ssplit[1])));
    }

    // add a read group line to the header with the string readgroup specifying the 
    // the actual RG name, the sample, and library
    SAMReadGroupRecord rgr = new SAMReadGroupRecord(readgroup);
    rgr.setPlatform("ILLUMINA");
    rgr.setLibrary(readgroup);
    rgr.setSample(readgroup);
    header.addReadGroup(new SAMReadGroupRecord(readgroup, rgr));

    return header;
}
 
开发者ID:tkonopka,项目名称:GeneticThesaurus,代码行数:31,代码来源:ThesaurusBlat.java

示例2: apply

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
@Override
public String apply(File f) {
    if (!detectable(f)) {
        throw new IllegalArgumentException("Cannot detect sample name for file: " + f.getPath());
    }
    final SAMFileReader in = new SAMFileReader(f);
    try {
        final SAMFileHeader header = in.getFileHeader();
        final List<SAMReadGroupRecord> rgs = header.getReadGroups();
        assertFalse(rgs.isEmpty(), "Cannot determine sample name: missing read group information for file: " + f.getPath());
        assertFalse(rgs.size() > 1, "Cannot determine sample name: more than one read group detected for file: " + f.getPath());
        final String sample = rgs.get(0).getSample();
        assertFalse(sample == null, "Cannot determine sample name: missing sample name in read group for file: " + f.getPath());
        return sample;
    } finally {
        in.close();
    }
}
 
开发者ID:TGenNorth,项目名称:ISGPipeline,代码行数:19,代码来源:BAMSampleNameDetectionAlgorithm.java

示例3: extractSampleNamesFromBAM

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
public static List<String> extractSampleNamesFromBAM(File f){
    final List<String> ret = new ArrayList<String>();
    final SAMFileReader in = new SAMFileReader(f);
    final List<SAMReadGroupRecord> rgs = in.getFileHeader().getReadGroups();
    if(rgs==null){
        throw new MissingReadGroupException(f);
    }
    for(SAMReadGroupRecord rg: rgs){
        ret.add(rg.getSample());
    }
    return ret;
}
 
开发者ID:TGenNorth,项目名称:ISGPipeline,代码行数:13,代码来源:GenomicFileUtils.java

示例4: createRG

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
private SAMReadGroupRecord createRG(String id, String sample) {
    SAMReadGroupRecord ret = new SAMReadGroupRecord(id);
    if (sample != null) {
        ret.setSample(sample);
    }
    return ret;
}
 
开发者ID:TGenNorth,项目名称:ISGPipeline,代码行数:8,代码来源:BAMSampleNameDetectionAlgorithmTest.java

示例5: MultiBAMHelper

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
public MultiBAMHelper(GenomeAnalysisEngine engine, boolean require_clean) {
    sample_set = new HashMap<String, String>();
    Evidence = new HashMap<String, PileupEvidence>();

    for (SAMReaderID rid : engine.getReadsDataSource().getReaderIDs()) {
        total_inputs++;
        Tags tags = rid.getTags();
        if (tags.getPositionalTags().isEmpty())
            throw new UserException.BadInput("This module requires that input BAMs are tagged (ie. -I:dna_normal normal.bam -I:dna_tumor tumor.bam): " +
                    engine.getSourceFileForReaderID(rid));

        for (String tag : tags.getPositionalTags()) {
            for (SAMReadGroupRecord rg : engine.getSAMFileHeader(rid).getReadGroups()) {

                String existing_tag = sample_set.get(rg.getSample());

                if (existing_tag != null && !existing_tag.equals(tag)) {
                    throw new UserException.BadInput(String.format("Sample '%s' is being assigned to tag '%s', but has already been assigned to tag '%s'. This is often a result of tumor/normal BAMs using the same sample IDs in their @RG tags. \n", rg.getSample(), tag, existing_tag));
                }

                sample_set.put(rg.getSample(), tag);
                Evidence.put(tag, new PileupEvidence());

                if (tag.startsWith("rna")) {
                    rna_tags++;
                }
            }

        }

    }
    this.require_clean = require_clean;
}
 
开发者ID:alexischr,项目名称:seurat,代码行数:34,代码来源:MultiBAMHelper.java

示例6: createBAM

import net.sf.samtools.SAMReadGroupRecord; //导入依赖的package包/类
private void createBAM(File f, List<SAMReadGroupRecord> rgs) {
    final SAMFileHeader samHeader = new SAMFileHeader();
    samHeader.setReadGroups(rgs);
    final SAMFileWriter samWriter = new SAMFileWriterFactory().makeSAMWriter(samHeader, false, f);
    samWriter.close();
}
 
开发者ID:TGenNorth,项目名称:ISGPipeline,代码行数:7,代码来源:BAMSampleNameDetectionAlgorithmTest.java


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