PrintReads writes a header when used with -BQSR
This commit is contained in:
parent
5cc5aedcd1
commit
6cb80591e3
|
|
@ -220,6 +220,7 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
" -R " + hg18Reference +
|
||||
" -I " + privateTestDir + "HiSeq.1mb.1RG.bam" +
|
||||
" -nct " + nct +
|
||||
" --no_pg_tag" +
|
||||
" -BQSR " + privateTestDir + "HiSeq.20mb.1RG.table" +
|
||||
params.args +
|
||||
" -o %s",
|
||||
|
|
@ -234,6 +235,7 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
" -R " + hg18Reference +
|
||||
" -I " + HiSeqBam +
|
||||
" -L " + HiSeqInterval +
|
||||
" --no_pg_tag" +
|
||||
" -BQSR " + privateTestDir + "HiSeq.1mb.1RG.highMaxCycle.table" +
|
||||
" -o /dev/null",
|
||||
0,
|
||||
|
|
@ -248,6 +250,7 @@ public class BQSRIntegrationTest extends WalkerTest {
|
|||
" -R " + hg18Reference +
|
||||
" -I " + HiSeqBam +
|
||||
" -L " + HiSeqInterval +
|
||||
" --no_pg_tag" +
|
||||
" -BQSR " + privateTestDir + "HiSeq.1mb.1RG.lowMaxCycle.table" +
|
||||
" -o /dev/null",
|
||||
0,
|
||||
|
|
|
|||
|
|
@ -28,15 +28,19 @@ package org.broadinstitute.sting.gatk.walkers.readutils;
|
|||
import net.sf.samtools.SAMFileWriter;
|
||||
import net.sf.samtools.SAMReadGroupRecord;
|
||||
import org.broadinstitute.sting.commandline.Argument;
|
||||
import org.broadinstitute.sting.commandline.Hidden;
|
||||
import org.broadinstitute.sting.commandline.Output;
|
||||
import org.broadinstitute.sting.gatk.CommandLineGATK;
|
||||
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||
import org.broadinstitute.sting.gatk.iterators.ReadTransformer;
|
||||
import org.broadinstitute.sting.gatk.iterators.ReadTransformersMode;
|
||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||
import org.broadinstitute.sting.gatk.walkers.*;
|
||||
import org.broadinstitute.sting.utils.GenomeLoc;
|
||||
import org.broadinstitute.sting.utils.SampleUtils;
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
|
|
@ -97,7 +101,7 @@ import java.util.*;
|
|||
public class PrintReads extends ReadWalker<GATKSAMRecord, SAMFileWriter> implements NanoSchedulable {
|
||||
|
||||
@Output(doc="Write output to this BAM filename instead of STDOUT", required = true)
|
||||
SAMFileWriter out;
|
||||
StingSAMFileWriter out;
|
||||
|
||||
@Argument(fullName = "readGroup", shortName = "readGroup", doc="Exclude all reads with this read group from the output", required = false)
|
||||
String readGroup = null;
|
||||
|
|
@ -137,18 +141,27 @@ public class PrintReads extends ReadWalker<GATKSAMRecord, SAMFileWriter> impleme
|
|||
*/
|
||||
@Argument(fullName="simplify", shortName="s", doc="Simplify all reads.", required=false)
|
||||
public boolean simplifyReads = false;
|
||||
|
||||
|
||||
@Hidden
|
||||
@Argument(fullName = "no_pg_tag", shortName = "npt", doc ="", required = false)
|
||||
private boolean NO_PG_TAG = false;
|
||||
|
||||
List<ReadTransformer> readTransformers = Collections.emptyList();
|
||||
private TreeSet<String> samplesToChoose = new TreeSet<String>();
|
||||
private boolean SAMPLES_SPECIFIED = false;
|
||||
|
||||
public static final String PROGRAM_RECORD_NAME = "GATK PrintReads"; // The name that will go in the @PG tag
|
||||
|
||||
Random random;
|
||||
|
||||
|
||||
/**
|
||||
* The initialize function.
|
||||
*/
|
||||
public void initialize() {
|
||||
final boolean keep_records = true;
|
||||
final GenomeAnalysisEngine toolkit = getToolkit();
|
||||
|
||||
if ( platform != null )
|
||||
platform = platform.toUpperCase();
|
||||
|
||||
|
|
@ -167,9 +180,14 @@ public class PrintReads extends ReadWalker<GATKSAMRecord, SAMFileWriter> impleme
|
|||
if(!samplesToChoose.isEmpty()) {
|
||||
SAMPLES_SPECIFIED = true;
|
||||
}
|
||||
|
||||
|
||||
random = GenomeAnalysisEngine.getRandomGenerator();
|
||||
|
||||
final boolean preSorted = true;
|
||||
if (getToolkit() != null && getToolkit().getArguments().BQSR_RECAL_FILE != null && !NO_PG_TAG ) {
|
||||
Utils.setupWriter(out, toolkit, toolkit.getSAMFileHeader(), !preSorted, keep_records, this, PROGRAM_RECORD_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ package org.broadinstitute.sting.utils.sam;
|
|||
import net.sf.samtools.SAMFileHeader;
|
||||
import net.sf.samtools.SAMFileWriter;
|
||||
import net.sf.samtools.SAMRecord;
|
||||
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -61,12 +62,12 @@ import java.util.List;
|
|||
/**
|
||||
* @author aaron
|
||||
* <p/>
|
||||
* Class ArtificialSAMFileWriter
|
||||
* Class ArtificialStingSAMFileWriter
|
||||
* <p/>
|
||||
* generates a fake samwriter, that you can get the output reads
|
||||
* from when you're done.
|
||||
*/
|
||||
public class ArtificialSAMFileWriter implements SAMFileWriter {
|
||||
public class ArtificialStingSAMFileWriter implements StingSAMFileWriter {
|
||||
|
||||
// are we closed
|
||||
private boolean closed = false;
|
||||
|
|
@ -106,4 +107,16 @@ public class ArtificialSAMFileWriter implements SAMFileWriter {
|
|||
public List<SAMRecord> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeHeader(SAMFileHeader header) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPresorted(boolean presorted) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMaxRecordsInRam(int maxRecordsInRam) {
|
||||
}
|
||||
}
|
||||
|
|
@ -75,6 +75,7 @@ public class PrintReadsIntegrationTest extends WalkerTest {
|
|||
" -R " + params.reference +
|
||||
" -I " + privateTestDir + params.bam +
|
||||
params.args +
|
||||
" --no_pg_tag" +
|
||||
" -o %s",
|
||||
Arrays.asList(params.md5));
|
||||
executeTest("testPrintReads-"+params.args, spec).getFirst();
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import net.sf.samtools.SAMRecord;
|
|||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialReadsTraversal;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMFileWriter;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialStingSAMFileWriter;
|
||||
import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
|
||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
|
|
@ -85,7 +85,7 @@ public class PrintReadsUnitTest extends BaseTest {
|
|||
//private ReferenceContext ref = new ReferenceContext()
|
||||
|
||||
org.broadinstitute.sting.gatk.walkers.readutils.PrintReads walker;
|
||||
ArtificialSAMFileWriter writer;
|
||||
ArtificialStingSAMFileWriter writer;
|
||||
|
||||
@BeforeMethod
|
||||
public void before() {
|
||||
|
|
@ -93,8 +93,7 @@ public class PrintReadsUnitTest extends BaseTest {
|
|||
readTotal = ( ( trav.endingChr - trav.startingChr ) + 1 ) * trav.readsPerChr + trav.unMappedReads;
|
||||
|
||||
walker = new org.broadinstitute.sting.gatk.walkers.readutils.PrintReads();
|
||||
writer = new ArtificialSAMFileWriter();
|
||||
walker.out = writer;
|
||||
writer = new ArtificialStingSAMFileWriter();
|
||||
walker.initialize();
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +120,4 @@ public class PrintReadsUnitTest extends BaseTest {
|
|||
assertTrue(ret == rec);
|
||||
assertTrue(ret.getReadName().equals(rec.getReadName()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,14 +65,14 @@ import java.util.List;
|
|||
/**
|
||||
* @author aaron
|
||||
* <p/>
|
||||
* Class ArtificialSAMFileWriter
|
||||
* Class ArtificialStingSAMFileWriter
|
||||
* <p/>
|
||||
* Test out the ArtificialSAMFileWriter class
|
||||
* Test out the ArtificialStingSAMFileWriter class
|
||||
*/
|
||||
public class ArtificialSAMFileWriterUnitTest extends BaseTest {
|
||||
|
||||
/** the artificial sam writer */
|
||||
private ArtificialSAMFileWriter writer;
|
||||
private ArtificialStingSAMFileWriter writer;
|
||||
private SAMFileHeader header;
|
||||
private final int startChr = 1;
|
||||
private final int numChr = 2;
|
||||
|
|
@ -80,7 +80,7 @@ public class ArtificialSAMFileWriterUnitTest extends BaseTest {
|
|||
|
||||
@BeforeMethod
|
||||
public void before() {
|
||||
writer = new ArtificialSAMFileWriter();
|
||||
writer = new ArtificialStingSAMFileWriter();
|
||||
header = ArtificialSAMUtils.createArtificialSamHeader(numChr, startChr, chrSize);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue