diff --git a/build.xml b/build.xml
index a85e16e4a..3f7297728 100644
--- a/build.xml
+++ b/build.xml
@@ -367,6 +367,15 @@
+
+
+
+
+
+
+
+
+
@@ -450,6 +459,12 @@
+
+
+
+
+
+
diff --git a/java/src/org/broadinstitute/sting/gatk/phonehome/GATKRunReport.java b/java/src/org/broadinstitute/sting/gatk/phonehome/GATKRunReport.java
index 3a8c139fc..c8e25b01a 100644
--- a/java/src/org/broadinstitute/sting/gatk/phonehome/GATKRunReport.java
+++ b/java/src/org/broadinstitute/sting/gatk/phonehome/GATKRunReport.java
@@ -345,10 +345,10 @@ public class GATKRunReport {
// Create an S3Object based on a file, with Content-Length set automatically and
// Content-Type set based on the file's extension (using the Mimetypes utility class)
S3Object fileObject = new S3Object(localFile);
- logger.info("Created S3Object" + fileObject);
- logger.info("Uploading " + localFile + " to AWS bucket");
+ //logger.info("Created S3Object" + fileObject);
+ //logger.info("Uploading " + localFile + " to AWS bucket");
S3Object s3Object = s3Service.putObject(REPORT_BUCKET_NAME, fileObject);
- logger.info("Uploaded: " + s3Object);
+ logger.info("Uploaded to AWS: " + s3Object);
} catch ( S3ServiceException e ) {
exceptDuringRunReport("S3 exception occurred", e);
} catch ( NoSuchAlgorithmException e ) {
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/tools/CompareBAMAlignments.java b/java/src/org/broadinstitute/sting/oneoffprojects/tools/CompareBAMAlignments.java
index bd1b88dff..464967312 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/tools/CompareBAMAlignments.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/tools/CompareBAMAlignments.java
@@ -61,10 +61,12 @@ public class CompareBAMAlignments extends CommandLineProgram {
if ( ! read1.getReadName().equals(read.getReadName()) )
bad(read1, read, "Names not equal");
- if ( read1.getAlignmentStart() != read.getAlignmentStart() )
- bad(read1, read, "Alignment starts not equal");
- if ( ! read1.getCigarString().equals(read.getCigarString()) )
- bad(read1, read, "Unequal CIGAR strings");
+ else {
+ if ( read1.getAlignmentStart() != read.getAlignmentStart() )
+ bad(read1, read, "Alignment starts not equal");
+ if ( ! read1.getCigarString().equals(read.getCigarString()) )
+ bad(read1, read, "Unequal CIGAR strings");
+ }
}
}
counter++;
@@ -79,8 +81,8 @@ public class CompareBAMAlignments extends CommandLineProgram {
private void bad(SAMRecord read1, SAMRecord read2, String msg) {
System.out.printf("%nBAD: %s%n", msg);
- System.out.printf(" read1: %s %s %s%n", read1.getReadName(), read1.getAlignmentStart(), read1.getCigarString());
- System.out.printf(" read2: %s %s %s%n", read2.getReadName(), read2.getAlignmentStart(), read2.getCigarString());
+ System.out.printf(" read1: %s %s %s %s%n", read1.getReadName(), read1.getAlignmentStart(), read1.getCigarString(), read1.getInferredInsertSize());
+ System.out.printf(" read2: %s %s %s %s%n", read2.getReadName(), read2.getAlignmentStart(), read2.getCigarString(), read2.getInferredInsertSize());
// System.exit(1);
}
diff --git a/java/src/org/broadinstitute/sting/playground/tools/ReplaceReadGroups.java b/java/src/org/broadinstitute/sting/playground/tools/ReplaceReadGroups.java
new file mode 100644
index 000000000..efbd0cdb9
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/playground/tools/ReplaceReadGroups.java
@@ -0,0 +1,78 @@
+package org.broadinstitute.sting.playground.tools;
+
+import net.sf.picard.cmdline.CommandLineProgram;
+import net.sf.picard.cmdline.Option;
+import net.sf.picard.cmdline.Usage;
+import net.sf.samtools.*;
+
+import java.io.File;
+import java.util.Arrays;
+
+/**
+ * User: mdepristo
+ *
+ * Replaces read groups in a BAM file
+ */
+public class ReplaceReadGroups extends CommandLineProgram {
+ @Usage(programVersion="1.0") public String USAGE = "Creates a new read group, and assigns all reads from the I BAM file to this read group in the O BAM";
+ @Option(shortName="I", doc="Input file (bam or sam).", optional=false)
+ public File IN = null;
+ @Option(shortName="O",doc="Output file (bam or sam).", optional=false)
+ public File OUT = null;
+
+ @Option(shortName="ID",doc="Read Group ID", optional=false)
+ public String RGID = null;
+
+ @Option(shortName="LB",doc="Read Group Library", optional=false)
+ public String RGLB = null;
+
+ @Option(shortName="PL",doc="Read Group platform", optional=false)
+ public String RGPL = null;
+
+ @Option(shortName="SM",doc="Read Group sample", optional=false)
+ public String RGSM = null;
+
+ private static final String RGFIELD = "RG"; // todo -- use binary tag that's private in picard
+
+ // todo -- is it worth supporting these fields?
+ // CN Name of sequencing center producing the read.
+ // DS Description.
+ // DT Date the run was produced (ISO8601 date or date/time).
+ // PU Platform unit (e.g. flowcell-barcode.lane for Illumina or slide for SOLiD). Unique identier.
+
+ /** Required main method implementation. */
+ public static void main(final String[] argv) {
+ System.exit(new ReplaceReadGroups().instanceMain(argv));
+ }
+
+ protected int doWork() {
+ SAMFileReader inReader = new SAMFileReader(IN);
+
+ // create the read group we'll be using
+ SAMReadGroupRecord rg = new SAMReadGroupRecord(RGID);
+ rg.setLibrary(RGLB);
+ rg.setPlatform(RGPL);
+ rg.setSample(RGSM);
+ System.out.printf("Created read group ID=%s PL=%s LB=%s SM=%s%n", rg.getId(), rg.getPlatform(), rg.getLibrary(), rg.getSample());
+
+ // create the new header and output file
+ SAMFileHeader outHeader = inReader.getFileHeader().clone();
+ outHeader.setReadGroups(Arrays.asList(rg));
+ SAMFileWriter outWriter = new SAMFileWriterFactory().makeSAMOrBAMWriter(outHeader, true, OUT) ;
+
+ //
+ // write the reads in contig order
+ //
+ for ( SAMRecord read : inReader ) {
+ read.setAttribute(RGFIELD, rg.getId());
+ outWriter.addAlignment(read);
+ }
+
+ // cleanup
+ inReader.close();
+ outWriter.close();
+ return 0;
+ }
+}
+
+
diff --git a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
index 86e3d479a..b8b64eb86 100755
--- a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
+++ b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
@@ -124,7 +124,7 @@ public class UserException extends ReviewedStingException {
public static class ReadMissingReadGroup extends MalformedBam {
public ReadMissingReadGroup(SAMRecord read) {
- super(read, String.format("Read %s is either missing the read group or its read group is not defined in the BAM header, both of which are required by the GATK", read.getReadName()));
+ super(read, String.format("Read %s is either missing the read group or its read group is not defined in the BAM header, both of which are required by the GATK. Please use http://www.broadinstitute.org/gsa/wiki/index.php/ReplaceReadGroups to fix this problem", read.getReadName()));
}
}
diff --git a/testdata/exampleNORG.bam b/testdata/exampleNORG.bam
new file mode 100644
index 000000000..f59219fec
Binary files /dev/null and b/testdata/exampleNORG.bam differ
diff --git a/testdata/exampleNORG.bam.bai b/testdata/exampleNORG.bam.bai
new file mode 100644
index 000000000..26cfe74e7
Binary files /dev/null and b/testdata/exampleNORG.bam.bai differ