Merge branch 'master' of ssh://gsa2.broadinstitute.org/humgen/gsa-scr1/gsa-engineering/git/stable
This commit is contained in:
commit
eb63221875
|
|
@ -318,6 +318,7 @@ public class LocusIteratorByState extends LocusIterator {
|
|||
continue;
|
||||
|
||||
if (op == CigarOperator.D) {
|
||||
// TODO -- LIBS is totally busted for deletions so that reads with Ds right before Is in their CIGAR are broken; must fix
|
||||
if (readInfo.includeReadsWithDeletionAtLoci()) { // only add deletions to the pileup if we are authorized to do so
|
||||
pile.add(new PileupElement(read, readOffset, true, isBeforeDeletion, isAfterDeletion, isBeforeInsertion, isAfterInsertion, isNextToSoftClip, null, nextOp == CigarOperator.D ? nextElementLength : -1));
|
||||
size++;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,11 @@ public class DepthPerAlleleBySample extends GenotypeAnnotation implements Standa
|
|||
for ( PileupElement p : pileup ) {
|
||||
if ( p.isBeforeInsertion() ) {
|
||||
|
||||
final Allele insertion = Allele.create((char)refBase + p.getEventBases(), false);
|
||||
final String eventBases = p.getEventBases();
|
||||
if ( eventBases == null )
|
||||
continue;
|
||||
|
||||
final Allele insertion = Allele.create((char)refBase + eventBases, false);
|
||||
if ( alleleCounts.containsKey(insertion) ) {
|
||||
alleleCounts.put(insertion, alleleCounts.get(insertion)+1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1181,10 +1181,10 @@ public class SomaticIndelDetector extends ReadWalker<Integer,Integer> {
|
|||
if ( event_length == 0 ) { // insertion
|
||||
|
||||
l.add( Allele.create(referencePaddingBase,true) );
|
||||
l.add( Allele.create(referencePaddingBase + call.getVariant().getBases(), false ));
|
||||
l.add( Allele.create((char)referencePaddingBase + new String(call.getVariant().getBases()), false ));
|
||||
|
||||
} else { //deletion:
|
||||
l.add( Allele.create(referencePaddingBase + call.getVariant().getBases(), true ));
|
||||
l.add( Allele.create((char)referencePaddingBase + new String(call.getVariant().getBases()), true ));
|
||||
l.add( Allele.create(referencePaddingBase,false) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@
|
|||
|
||||
package org.broadinstitute.sting.utils.classloader;
|
||||
|
||||
import org.broadinstitute.sting.utils.Utils;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
import org.broadinstitute.sting.utils.exceptions.StingException;
|
||||
import org.reflections.util.ClasspathHelper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.*;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
|
@ -234,4 +236,17 @@ public class JVMUtils {
|
|||
} else
|
||||
throw new ReviewedStingException("BUG: could not find generic type on class " + t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a comma-separated list of the names of the interfaces implemented by this class
|
||||
*
|
||||
* @param covClass
|
||||
* @return
|
||||
*/
|
||||
public static String classInterfaces(final Class covClass) {
|
||||
final List<String> interfaces = new ArrayList<String>();
|
||||
for ( final Class interfaceClass : covClass.getInterfaces() )
|
||||
interfaces.add(interfaceClass.getSimpleName());
|
||||
return Utils.join(", ", interfaces);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.apache.log4j.Logger;
|
|||
import org.broadinstitute.sting.gatk.report.GATKReport;
|
||||
import org.broadinstitute.sting.gatk.report.GATKReportTable;
|
||||
import org.broadinstitute.sting.gatk.walkers.bqsr.RecalibrationArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.classloader.JVMUtils;
|
||||
import org.broadinstitute.sting.utils.recalibration.covariates.*;
|
||||
import org.broadinstitute.sting.utils.BaseUtils;
|
||||
import org.broadinstitute.sting.utils.R.RScriptExecutor;
|
||||
|
|
@ -117,6 +118,12 @@ public class RecalUtils {
|
|||
|
||||
if (argumentCollection.COVARIATES != null) { // parse the -cov arguments that were provided, skipping over the ones already specified
|
||||
for (String requestedCovariateString : argumentCollection.COVARIATES) {
|
||||
// help the transition from BQSR v1 to BQSR v2
|
||||
if ( requestedCovariateString.equals("DinucCovariate") )
|
||||
throw new UserException.CommandLineException("DinucCovariate has been retired. Please use its successor covariate " +
|
||||
"ContextCovariate instead, which includes the 2 bp (dinuc) substitution model of the retired DinucCovariate " +
|
||||
"as well as an indel context to model the indel error rates");
|
||||
|
||||
boolean foundClass = false;
|
||||
for (Class<? extends Covariate> covClass : covariateClasses) {
|
||||
if (requestedCovariateString.equalsIgnoreCase(covClass.getSimpleName())) { // -cov argument matches the class name for an implementing class
|
||||
|
|
@ -178,18 +185,18 @@ public class RecalUtils {
|
|||
return dest;
|
||||
}
|
||||
|
||||
public static void listAvailableCovariates(Logger logger) {
|
||||
// Get a list of all available covariates
|
||||
final List<Class<? extends Covariate>> covariateClasses = new PluginManager<Covariate>(Covariate.class).getPlugins();
|
||||
|
||||
// Print and exit if that's what was requested
|
||||
/**
|
||||
* Print a list of all available covariates to logger as info
|
||||
*
|
||||
* @param logger
|
||||
*/
|
||||
public static void listAvailableCovariates(final Logger logger) {
|
||||
logger.info("Available covariates:");
|
||||
for (Class<?> covClass : covariateClasses)
|
||||
logger.info(covClass.getSimpleName());
|
||||
logger.info("");
|
||||
for (final Class<? extends Covariate> covClass : new PluginManager<Covariate>(Covariate.class).getPlugins()) {
|
||||
logger.info(String.format("\t%30s\t%s", covClass.getSimpleName(), JVMUtils.classInterfaces(covClass)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum SOLID_RECAL_MODE {
|
||||
/**
|
||||
* Treat reference inserted bases as reference matching bases. Very unsafe!
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
package org.broadinstitute.sting.utils.recalibration.covariates;
|
||||
|
||||
import org.broadinstitute.sting.utils.recalibration.ReadCovariates;
|
||||
import org.broadinstitute.sting.gatk.walkers.bqsr.RecalibrationArgumentCollection;
|
||||
import org.broadinstitute.sting.utils.exceptions.UserException;
|
||||
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
|
||||
|
||||
/**
|
||||
* Binary covariate allows BQSR to recalibrate based on a binary covariate in the BAM file. This covariate should assume values of 1 and 0.
|
||||
*
|
||||
* @author Mauricio Carneiro
|
||||
* @since 7/6/12
|
||||
*/
|
||||
public class BinaryTagCovariate implements ExperimentalCovariate {
|
||||
|
||||
private String tag;
|
||||
|
||||
@Override
|
||||
public void initialize(RecalibrationArgumentCollection RAC) {
|
||||
tag = RAC.BINARY_TAG_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordValues(GATKSAMRecord read, ReadCovariates values) {
|
||||
final Object tagObject = read.getAttribute(tag);
|
||||
|
||||
byte[] binaryTag;
|
||||
if (tagObject instanceof byte[])
|
||||
binaryTag = (byte[]) tagObject;
|
||||
else if (tagObject instanceof String) {
|
||||
int readLength = ((String) tagObject).length();
|
||||
binaryTag = new byte[readLength];
|
||||
for (int i = 0; i<readLength; i++)
|
||||
binaryTag[i] = Byte.decode(((String) tagObject).substring(i, i+1));
|
||||
}
|
||||
else
|
||||
throw new UserException("Binary tag is not a byte array (fast) or a string (slow). Type not supported");
|
||||
|
||||
for (int i = 0; i < read.getReadLength(); i++) {
|
||||
values.addCovariate((int) binaryTag[i], (int) binaryTag[i], (int) binaryTag[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(String str) {
|
||||
return Integer.decode(str);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatKey(int key) {
|
||||
return String.format("%d", key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int keyFromValue(Object value) {
|
||||
return Integer.decode((String) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int maximumKeyValue() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue