Stop building obsolete VCFTools and CGUtilities

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4030 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
ebanks 2010-08-13 19:28:36 +00:00
parent 8e46d5de04
commit f36c0ed613
2 changed files with 0 additions and 151 deletions

View File

@ -293,23 +293,6 @@
</manifest>
</jar>
<jar jarfile="${dist.dir}/CGUtilities.jar" whenmanifestonly="skip">
<fileset dir="${java.classes}">
<include name="**/*.class" />
</fileset>
<manifest>
<attribute name="Main-Class" value="org.broadinstitute.sting.playground.tools.CGUtilities" />
</manifest>
</jar>
<jar jarfile="${dist.dir}/VCFTool.jar" whenmanifestonly="skip">
<fileset dir="${java.classes}">
<include name="**/*.class"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="org.broadinstitute.sting.playground.tools.vcf.VCFTool" />
</manifest>
</jar>
</target>
<target name="queue.jar" depends="queue.compile, queue-gatk-extensions.compile, init.jar" if="queue.include">
@ -349,12 +332,6 @@
<target name="gatk.manifests" depends="gatk.jar, init.manifests">
<jar jarfile="${dist.dir}/VCFTool.jar" update="true" >
<manifest>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar" update="true">
<manifest>
<attribute name="Class-Path" value="${jar.classpath}"/>
@ -367,12 +344,6 @@
</manifest>
</jar>
<jar jarfile="${dist.dir}/CGUtilities.jar" update="true" whenmanifestonly="skip">
<manifest>
<attribute name="Class-Path" value="${jar.classpath}" />
</manifest>
</jar>
</target>
<target name="queue.manifests" depends="queue.jar, init.manifests" if="queue.include">

View File

@ -1,122 +0,0 @@
package org.broadinstitute.sting.playground.tools;
import net.sf.picard.cmdline.CommandLineProgram;
import net.sf.picard.cmdline.Usage;
import net.sf.picard.cmdline.Option;
import net.sf.samtools.*;
import java.io.*;
import java.util.List;
import java.util.ArrayList;
public class CGUtilities extends CommandLineProgram {
@Usage(programVersion="1.0") public String USAGE = "Mark, document me";
@Option(shortName="I", doc="Input file (bam or sam) to mark primary alignments in. Must be sorted by name",
optional=false) public File IN = null;
@Option(shortName="O",doc="Output file (BAM). If not specified, output is printed to stdout.",
optional=false) public File OUT = null;
@Option(shortName="M",doc="Maximum number of reasd to process.",
optional=true) public int MAX_READS = -1;
public static void main(final String[] argv) {
System.exit(new CGUtilities().instanceMain(argv));
}
protected int doWork() {
InputStream ins;
try {
ins = new FileInputStream(IN);
} catch ( FileNotFoundException ie ) {
System.out.println("Failed to open input file "+IN+": "+ie.getCause());
return 1;
}
SAMFileReader inReader = new SAMFileReader(ins);
SAMFileHeader header = inReader.getFileHeader();
header.setSortOrder(SAMFileHeader.SortOrder.unsorted);
SAMFileWriter out = new SAMFileWriterFactory().makeSAMOrBAMWriter(header, false, OUT);
int i = 0;
String currentReadName = null;
List<SAMRecord> possibleAlignments = new ArrayList<SAMRecord>();
for ( SAMRecord read : inReader ) {
String readName = read.getReadName();
//System.out.println("@" + readName);
if ( currentReadName == null )
currentReadName = readName;
if ( ! currentReadName.equals(readName) ) {
List<SAMRecord> firsts = subsetByPair(possibleAlignments, true);
List<SAMRecord> seconds = subsetByPair(possibleAlignments, false);
if ( firsts.size() + seconds.size() != possibleAlignments.size() ) {
throw new RuntimeException(String.format("Dropped reads %d + %d != %d at %s%n", firsts.size(), seconds.size(), possibleAlignments.size(), currentReadName));
}
if ( firsts.size() > 0 ) out.addAlignment(selectBestAlignment(firsts));
if ( seconds.size() > 0 ) out.addAlignment(selectBestAlignment(seconds));
possibleAlignments.clear();
currentReadName = readName;
}
possibleAlignments.add(read);
//out.addAlignment(read);
if ( i++ > MAX_READS && MAX_READS != -1 ) break;
}
inReader.close();
out.close();
return 0;
}
protected SAMRecord selectBestAlignment(List<SAMRecord> possibleAlignments) {
SAMRecord best = null;
for ( SAMRecord possible : possibleAlignments ) {
if ( best == null || isBetterAlignment(best, possible) )
best = possible;
}
if ( best != null ) {
best.setNotPrimaryAlignmentFlag(false); // we're the primary alignment!
}
return best;
}
protected List<SAMRecord> subsetByPair(List<SAMRecord> reads, boolean getFirst) {
List<SAMRecord> sub = new ArrayList<SAMRecord>();
for ( SAMRecord read : reads ) {
boolean add = read.getFirstOfPairFlag() ? getFirst : ! getFirst;
if ( ! read.getReadPairedFlag() )
throw new RuntimeException("Read is unpaired! " + read.format());
if ( add ) sub.add(read);
}
return sub;
}
protected boolean isBetterAlignment(SAMRecord champ, SAMRecord contender) {
boolean replace = false;
if ( contender.getMappingQuality() >= champ.getMappingQuality() ) {
if ( contender.getMappingQuality() > champ.getMappingQuality() ) {
replace = true;
} else if ( contender.getReadLength() > champ.getReadLength() ) {
replace = true;
} else {
;
//System.out.printf("Equivalent reads%n %s%n %s%n", champ.format(), contender.format());
}
}
//if ( replace )
// System.out.printf("Better read %n %s%n %s%n", contender.format(), champ.format());
//System.out.printf("Comparing %s vs. %s => contender is better? %s%n", champ, contender, replace);
return replace;
}
}