Examples of addAlignment()


Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

        } catch ( final Exception e ) {
            // Capture any exception that might be thrown, and write out the assembly failure BAM if requested
            if ( captureAssemblyFailureBAM ) {
                final SAMFileWriter writer = ReadUtils.createSAMFileWriter("assemblyFailure.bam", getToolkit());
                for ( final GATKSAMRecord read : activeRegion.getReads() ) {
                    writer.addAlignment(read);
                }
                writer.close();
            }
            throw e;
        }
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

            if(value != null) {
                read.setAttribute(sourceTagName,null);
                read.setAttribute(targetTagName,value);
                readsAltered++;
            }
            writer.addAlignment(read);
            readsWritten++;
            if(readsWritten % 1000000 == 0)
                System.out.printf("%d reads written.  %d tag names updated from %s to %s.%n",readsWritten,readsAltered,sourceTagName,targetTagName);
        }
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

        long numReads = 0;
        for(SAMRecord read: fullInputFile) {
            if(numReads++ >= getMaxReads())
                break;
            writer.addAlignment(read);
        }

        writer.close();

        inputFile = tempFile;
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

    public Map<String, SAMFileWriter> reduce(SAMRecord read, Map<String, SAMFileWriter> outputs) {
        final String sample = read.getReadGroup().getSample();
        SAMFileWriter output = outputs.get(sample);

        if ( output != null ) {
            output.addAlignment(read);
        } else {
            throw new RuntimeException(String.format("Read group %s not present in header but found in read %s", read.getReadGroup().getReadGroupId(), read.getReadName()));
        }

        return outputs;
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

                // check the read's mapping quality
                if (rec.getReadUnmappedFlag() && 0 != rec.getMappingQuality()) {
                    rec.setMappingQuality(0);
                }

                writer.addAlignment(rec);
                progress.record(rec);
            }

            writer.close();
            it.close();
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

            else {
                keeper = previous;
            }

            if (keeper) {
                out.addAlignment(rec);
                ++kept;
            }

            progress.record(rec);
        }
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

            // Actually to the reverting of the remaining records
            revertSamRecord(rec);

            if (sanitizing) sorter.add(rec);
            else out.addAlignment(rec);
            progress.record(rec);
        }

        ////////////////////////////////////////////////////////////////////////////
        // Now if we're sanitizing, clean up the records and write them to the output
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

                        for (int i = 0; i < quals.length; i++) {
                            quals[i] -= SolexaQualityConverter.ILLUMINA_TO_PHRED_SUBTRAHEND;
                        }
                        rec.setBaseQualities(quals);
                    }
                    out.addAlignment(rec);
                    sanitizerProgress.record(rec);
                }
            }

            out.close();
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

        final SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(replacementHeader, true, OUTPUT);

        final ProgressLogger progress = new ProgressLogger(Log.getInstance(ReplaceSamHeader.class));
        for (final SAMRecord rec : recordReader) {
            rec.setHeader(replacementHeader);
            writer.addAlignment(rec);
            progress.record(rec);
        }
        writer.close();
        recordReader.close();
    }
View Full Code Here

Examples of htsjdk.samtools.SAMFileWriter.addAlignment()

        final ProgressLogger progress = new ProgressLogger(LOG);
        for ( ; freader.hasNext()  ; readCount++) {
            final FastqRecord frec = freader.next();
            final SAMRecord srec = createSamRecord(header, getReadName(frec.getReadHeader(), false) , frec, false) ;
            srec.setReadPairedFlag(false);
            writer.addAlignment(srec);
            progress.record(srec);
        }

        writer.close();
        return readCount;
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.