Package htsjdk.samtools.reference

Examples of htsjdk.samtools.reference.IndexedFastaSequenceFile


        HCTestIndelQualityScores(NA12878_RECALIBRATED_BAM, "", "f2242d1696ef542196d363cf56159851");
    }

    private void HCTestNearbySmallIntervals(String bam, String args, String md5) {
        try {
            final IndexedFastaSequenceFile fasta = new IndexedFastaSequenceFile(new File(b37KGReference));
            final GenomeLocParser parser = new GenomeLocParser(fasta.getSequenceDictionary());

            final String base = String.format("-T HaplotypeCaller --disableDithering --pcr_indel_model NONE -R %s -I %s", REF, bam) + " -L 20:10,001,603-10,001,642 -L 20:10,001,653-10,001,742 --no_cmdline_in_header -o %s";
            final WalkerTestSpec spec = new WalkerTestSpec(base + " " + args, Arrays.asList(md5));
            for( final File vcf : executeTest("testHaplotypeCallerNearbySmallIntervals: args=" + args, spec).getFirst() ) {
                if( containsDuplicateRecord(vcf, parser) ) {
View Full Code Here


    SAMSequenceDictionary dictForFails;

    @BeforeClass
    public void setup() throws FileNotFoundException {
        // sequence
        final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37KGReference));
        final GenomeLocParser genomeLocParser = new GenomeLocParser(seq);
        dictForFails = genomeLocParser.getContigs();
    }
View Full Code Here

    @DataProvider(name = "MyDataProvider")
    public Object[][] makeMyDataProvider() throws Exception {
        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() ) {
View Full Code Here

    private SAMFileHeader header;

    @BeforeClass
    public void setup() throws FileNotFoundException {
        final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37KGReference));
        header = ArtificialSAMUtils.createArtificialSamHeader(seq.getSequenceDictionary());
    }
View Full Code Here

    private SAMFileHeader header;

    @BeforeClass
    public void setup() throws FileNotFoundException {
        final IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(b37KGReference));
        header = ArtificialSAMUtils.createArtificialSamHeader(seq.getSequenceDictionary());
    }
View Full Code Here


    @Override
    public int execute() throws IOException {
        // initialize reference
        IndexedFastaSequenceFile refReader = new IndexedFastaSequenceFile(referenceFile);
        GenomeLocParser genomeLocParser = new GenomeLocParser(refReader);       

        // initialize reads
        List<SAMReaderID> bamReaders = ListFileUtils.unpackBAMFileList(samFiles,parser);
        SAMDataSource dataSource = new SAMDataSource(bamReaders,new ThreadAllocation(),null,genomeLocParser);

        // intervals
        final GenomeLocSortedSet intervalSortedSet;
        if ( intervals != null )
            intervalSortedSet = IntervalUtils.sortAndMergeIntervals(genomeLocParser, IntervalUtils.parseIntervalArguments(genomeLocParser, intervals), IntervalMergingRule.ALL);
        else
            intervalSortedSet = GenomeLocSortedSet.createSetFromSequenceDictionary(refReader.getSequenceDictionary());

        logger.info(String.format("PROGRESS: Calculating mean and variance: Contig\tRegion.Start\tRegion.Stop\tSize"));       

        IntervalSharder sharder = IntervalSharder.shardOverIntervals(dataSource,intervalSortedSet,IntervalMergingRule.ALL);
        while(sharder.hasNext()) {
View Full Code Here

    @BeforeMethod
    public void before() {
        header = ArtificialSAMUtils.createArtificialSamHeader(numChr, startChr, chrSize);
        File referenceFile = new File(hg18Reference);
        try {
            fasta = new IndexedFastaSequenceFile(referenceFile);
        }
        catch(FileNotFoundException ex) {
            throw new UserException.CouldNotReadInputFile(referenceFile,ex);
        }
    }
View Full Code Here

            else {
                System.out.printf("Error aligning read %s%n", read.getReadName());

                mismatches++;

                IndexedFastaSequenceFile reference = new IndexedFastaSequenceFile(referenceFile);

                System.out.printf("read          = %s, position = %d, negative strand = %b%n", formatBasesBasedOnCigar(read.getReadString(),read.getCigar(),CigarOperator.DELETION),
                                                                                               read.getAlignmentStart(),
                                                                                               read.getReadNegativeStrandFlag());
                int numDeletions = numDeletionsInCigar(read.getCigar());
                String expectedRef = new String(reference.getSubsequenceAt(reference.getSequenceDictionary().getSequences().get(0).getSequenceName(),read.getAlignmentStart(),read.getAlignmentStart()+read.getReadLength()+numDeletions-1).getBases());
                System.out.printf("expected ref  = %s%n", formatBasesBasedOnCigar(expectedRef,read.getCigar(),CigarOperator.INSERTION));

                for(Alignment[] alignmentsOfQuality: alignments) {
                    for(Alignment alignment: alignmentsOfQuality) {
                        System.out.println();

                        Cigar cigar = ((BWAAlignment)alignment).getCigar();

                        System.out.printf("read          = %s%n", formatBasesBasedOnCigar(read.getReadString(),cigar,CigarOperator.DELETION));

                        int deletionCount = ((BWAAlignment)alignment).getNumberOfBasesMatchingState(AlignmentState.DELETION);
                        String alignedRef = new String(reference.getSubsequenceAt(reference.getSequenceDictionary().getSequences().get(0).getSequenceName(),alignment.getAlignmentStart(),alignment.getAlignmentStart()+read.getReadLength()+deletionCount-1).getBases());
                        System.out.printf("actual ref    = %s, position = %d, negative strand = %b%n", formatBasesBasedOnCigar(alignedRef,cigar,CigarOperator.INSERTION),
                                alignment.getAlignmentStart(),
                                alignment.isNegativeStrand());
                    }
                }
View Full Code Here

    @BeforeMethod
    public void setup() {
        File referenceFile = new File(b36KGReference);
        try {
            IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(referenceFile);
            genomeLocParser = new GenomeLocParser(seq);
            manager = new FeatureManager();
        }
        catch(FileNotFoundException ex) {
            throw new UserException.CouldNotReadInputFile(referenceFile,ex);
View Full Code Here

public class FeatureToGATKFeatureIteratorUnitTest extends BaseTest {
    @Test
    @SuppressWarnings("unchecked")
    public void testCloseFilePointers() throws IOException {
        final String chr = "20";
        IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(BaseTest.hg19Reference));
        GenomeLocParser parser = new GenomeLocParser(seq);
        File file = new File(privateTestDir + "NA12878.hg19.example1.vcf");
        VCFCodec codec = new VCFCodec();
        TestFeatureReader reader = new TestFeatureReader(file.getAbsolutePath(), codec);
        CheckableCloseableTribbleIterator<Feature> tribbleIterator = reader.query(chr, 1, 100000);
View Full Code Here

TOP

Related Classes of htsjdk.samtools.reference.IndexedFastaSequenceFile

Copyright © 2018 www.massapicom. 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.