@ Fixed issues with AnalyzePowerWalker which depended on CoverageAndPowerWalker. The latter was changed but not the former. Now fixed
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1464 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
a17dad5fa9
commit
bd1e679bc5
|
|
@ -6,6 +6,7 @@ import org.broadinstitute.sting.utils.Pair;
|
||||||
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
|
import org.broadinstitute.sting.playground.utils.PoolUtils;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
|
|
@ -13,8 +14,11 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.List;
|
||||||
import java.rmi.NoSuchObjectException;
|
import java.rmi.NoSuchObjectException;
|
||||||
|
|
||||||
|
import net.sf.samtools.SAMRecord;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA.
|
||||||
* User: chartl
|
* User: chartl
|
||||||
|
|
@ -29,8 +33,6 @@ public class AnalyzePowerWalker extends CoverageAndPowerWalker{
|
||||||
String pathToSyzygyFile = null;
|
String pathToSyzygyFile = null;
|
||||||
@Argument(fullName = "ColumnOffset", shortName = "co", doc = "Offset of column containing the power in the pf", required = true)
|
@Argument(fullName = "ColumnOffset", shortName = "co", doc = "Offset of column containing the power in the pf", required = true)
|
||||||
int colOffset = 0;
|
int colOffset = 0;
|
||||||
@Argument(fullName = "linesToClear", shortName="clr", doc = "Clear so many lines from the read file before starting (default - just the header line)", required = false)
|
|
||||||
int clrLines = 1;
|
|
||||||
|
|
||||||
BufferedReader syzyFileReader;
|
BufferedReader syzyFileReader;
|
||||||
final String pfFileDelimiter = " ";
|
final String pfFileDelimiter = " ";
|
||||||
|
|
@ -42,9 +44,7 @@ public class AnalyzePowerWalker extends CoverageAndPowerWalker{
|
||||||
super.initialize();
|
super.initialize();
|
||||||
try {
|
try {
|
||||||
syzyFileReader = new BufferedReader(new FileReader(pathToSyzygyFile));
|
syzyFileReader = new BufferedReader(new FileReader(pathToSyzygyFile));
|
||||||
for(int clear = 0; clear < clrLines; clear++) {
|
syzyFileReader.readLine();
|
||||||
syzyFileReader.readLine();
|
|
||||||
}
|
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
String newErrMsg = "Syzygy input file " + pathToSyzygyFile + " could be incorrect. File not found.";
|
String newErrMsg = "Syzygy input file " + pathToSyzygyFile + " could be incorrect. File not found.";
|
||||||
throw new StingException(newErrMsg,e);
|
throw new StingException(newErrMsg,e);
|
||||||
|
|
@ -56,11 +56,13 @@ public class AnalyzePowerWalker extends CoverageAndPowerWalker{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
|
public Pair<Integer,Integer> map(RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Pair<Pair<List<SAMRecord>, List<SAMRecord>>,Pair<List<Integer>,List<Integer>>> splitReads = PoolUtils.splitReadsByReadDirection(context.getReads(),context.getOffsets());
|
||||||
if ( !super.suppress_printing )
|
if ( !super.suppress_printing )
|
||||||
{
|
{
|
||||||
Pair<Double,Byte> powpair = super.boostrapSamplingPowerCalc(context);
|
Pair<double[],byte[]> powpair = super.calculatePower(splitReads,false,context);
|
||||||
|
|
||||||
boolean syzyFileIsReady;
|
boolean syzyFileIsReady;
|
||||||
try {
|
try {
|
||||||
|
|
@ -80,7 +82,7 @@ public class AnalyzePowerWalker extends CoverageAndPowerWalker{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return context.getReads().size();
|
return new Pair(splitReads.getFirst().getFirst().size(), splitReads.getFirst().getFirst().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<Double,String> getSyzyPowFromFile() {
|
public Pair<Double,String> getSyzyPowFromFile() {
|
||||||
|
|
@ -107,4 +109,8 @@ public class AnalyzePowerWalker extends CoverageAndPowerWalker{
|
||||||
throw new StingException(errMsg);
|
throw new StingException(errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String createHeaderString() {
|
||||||
|
return (super.createHeaderString() + " PowSyz");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,9 @@ public class CoverageAndPowerWalker extends LocusWalker<Pair<Integer, Integer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pair<Long,Long> reduceInit() {
|
public Pair<Long,Long> reduceInit() {
|
||||||
|
if ( ! suppress_printing ) { // print header
|
||||||
|
out.printf("%s%n",createHeaderString());
|
||||||
|
}
|
||||||
return new Pair(0l,0l);
|
return new Pair(0l,0l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -154,6 +157,10 @@ public class CoverageAndPowerWalker extends LocusWalker<Pair<Integer, Integer>,
|
||||||
return power;
|
return power;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String createHeaderString() {
|
||||||
|
return "Chrom:Pos CvgF CvgR CvgC QmedF QmedR QmedC PowF PowR PowC";
|
||||||
|
}
|
||||||
|
|
||||||
// class methods
|
// class methods
|
||||||
|
|
||||||
public static Pair<Pair<List<SAMRecord>,List<SAMRecord>>,Pair<List<Integer>,List<Integer>>> coinTossPartition(List<SAMRecord> reads, List<Integer> offsets, double snpProb) {
|
public static Pair<Pair<List<SAMRecord>,List<SAMRecord>>,Pair<List<Integer>,List<Integer>>> coinTossPartition(List<SAMRecord> reads, List<Integer> offsets, double snpProb) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue