Examples of SAMSequenceDictionary


Examples of htsjdk.samtools.SAMSequenceDictionary

    String inpath = TestUtils.DATA_DIR + "vcf/SRP32_v4.sorted.0.vcf";
    File outFile = new File(TestUtils.TMP_OUTPUT_DIR, "testwriterout.vcf");

    private VariantContextWriter getWriter() {
        SAMSequenceDictionary seqDict = new SAMSequenceDictionary();
        EnumSet<Options> options = VariantContextWriterFactory.DEFAULT_OPTIONS;
        options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
        VariantContextWriter writer = VariantContextWriterFactory.create(outFile, seqDict, options);
        return writer;
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

    }

    @Override
    public Map<String, Object> encodeAll(OutputStream outputStream, Iterator<? extends VCFVariant> features) throws IOException {

        SAMSequenceDictionary seqDict = new SAMSequenceDictionary();
        EnumSet<Options> options = VariantContextWriterFactory.DEFAULT_OPTIONS;
        options.add(Options.ALLOW_MISSING_FIELDS_IN_HEADER);
        options.remove(Options.INDEX_ON_THE_FLY);
        VariantContextWriter writer = VariantContextWriterFactory.create(outputStream, seqDict, options);
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

            return chromoName;
        }
    }

    private GenomeLocParser createGenomeLocParser() {
        SAMSequenceDictionary dict = new SAMSequenceDictionary();
        for (Chromosome chr : GenomeManager.getInstance().getCurrentGenome().getChromosomes()) {
            dict.addSequence(new SAMSequenceRecord(chromoNameToStandard(chr.getName()), chr.getLength()));
        }
        return new GenomeLocParser(dict);
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

        return haplotypeList;
    }


    protected SAMSequenceDictionary artificialSAMSequenceDictionary() {
        return new SAMSequenceDictionary(Collections.singletonList(new SAMSequenceRecord("00",reference.length())));
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

        List<Object[]> tests = new ArrayList<Object[]>();

        for ( final String ref : Arrays.asList(b37KGReference, hg18Reference) ) {
            final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(ref));
            final GenomeLocParser genomeLocParser = new GenomeLocParser(seq);
            final SAMSequenceDictionary dict = genomeLocParser.getContigs();

            for ( final SAMSequenceRecord rec1 : dict.getSequences() ) {
                for ( final SAMSequenceRecord rec2 : dict.getSequences() ) {
                    final int expected = Integer.valueOf(rec1.getSequenceIndex()).compareTo(rec2.getSequenceIndex());
                    tests.add(new Object[]{dict, rec1.getSequenceName(), rec2.getSequenceName(), expected});
                }
            }
        }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

                                                                        String name,
                                                                        File inputFile,
                                                                        RMDStorageType storageType) {
        // Feature source and sequence dictionary to use as the ultimate reference
        AbstractFeatureReader featureSource = null;
        SAMSequenceDictionary sequenceDictionary = null;

        // Detect whether or not this source should be indexed.
        boolean canBeIndexed = (storageType == RMDStorageType.FILE);

        if(canBeIndexed) {
            try {
                Index index = loadIndex(inputFile, createCodec(descriptor, name, inputFile));
                try { logger.info(String.format("  Index for %s has size in bytes %d", inputFile, Sizeof.getObjectGraphSize(index))); }
                catch (ReviewedGATKException e) { }

                sequenceDictionary = IndexDictionaryUtils.getSequenceDictionaryFromProperties(index);

                // if we don't have a dictionary in the Tribble file, and we've set a dictionary for this builder, set it in the file if they match
                if (sequenceDictionary.size() == 0 && dict != null) {
                    validateAndUpdateIndexSequenceDictionary(inputFile, index, dict);

                    if ( ! disableAutoIndexCreation ) {
                        File indexFile = Tribble.indexFile(inputFile);
                        try { // re-write the index
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

     */
    public void validateAndUpdateIndexSequenceDictionary(final File inputFile, final Index index, final SAMSequenceDictionary dict) {
        if (dict == null) throw new ReviewedGATKException("BUG: dict cannot be null");

        // check that every contig in the RMD contig list is at least in the sequence dictionary we're being asked to set
        final SAMSequenceDictionary currentDict = IndexDictionaryUtils.createSequenceDictionaryFromContigList(index, new SAMSequenceDictionary());
        validateTrackSequenceDictionary(inputFile.getAbsolutePath(), currentDict, dict);

        // actually update the dictionary in the index
        IndexDictionaryUtils.setIndexSequenceDictionary(index, dict);
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

     * get the sequence dictionary from the track, if available.  If not, make it from the contig list that is always in the index
     * @param index the index file to use
     * @return a SAMSequenceDictionary if available, null if unavailable
     */
    public static SAMSequenceDictionary getSequenceDictionaryFromProperties(Index index) {
        SAMSequenceDictionary dict = new SAMSequenceDictionary();
        for (Map.Entry<String,String> entry : index.getProperties().entrySet()) {
            if (entry.getKey().startsWith(SequenceDictionaryPropertyPredicate))
                dict.addSequence(new SAMSequenceRecord(entry.getKey().substring(SequenceDictionaryPropertyPredicate.length() , entry.getKey().length()),
                        Integer.valueOf(entry.getValue())));
        }
        return dict;
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

public class VerifyingSamIteratorUnitTest {
    private SAMFileHeader samFileHeader;

    @BeforeClass
    public void init() {
        SAMSequenceDictionary sequenceDictionary = new SAMSequenceDictionary();
        sequenceDictionary.addSequence(new SAMSequenceRecord("1",500));
        sequenceDictionary.addSequence(new SAMSequenceRecord("2",500));

        samFileHeader = new SAMFileHeader();
        samFileHeader.setSequenceDictionary(sequenceDictionary);
    }
View Full Code Here

Examples of htsjdk.samtools.SAMSequenceDictionary

            index = loadIndex(inputFile, codec);
            featureReader = new TestFeatureReader(inputFile.getAbsolutePath(), codec);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        SAMSequenceDictionary sequenceDictionary = IndexDictionaryUtils.getSequenceDictionaryFromProperties(index);
        return new RMDTrack(descriptor.getCodecClass(), name, inputFile, featureReader, sequenceDictionary, genomeLocParser, codec);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.