當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。