# HG changeset patch # User greg # Date 1458305302 14400 # Node ID 147e2974b7110c8784bc673a531ff11bf9ac120d Uploaded diff -r 000000000000 -r 147e2974b711 TagPileup.jar Binary file TagPileup.jar has changed diff -r 000000000000 -r 147e2974b711 src/PileupObjects/BEDCoord.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/PileupObjects/BEDCoord.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,138 @@ +package PileupObjects; + +import java.util.Comparator; + +public class BEDCoord { + private String CHROM = ""; + private int START = 0; + private int STOP = 0; + private String DIR = "+"; + + private String NAME = "."; + private double SCORE = 0; + + private double[] Fstrand = null; + private double[] Rstrand = null; + + private boolean VALIDCHROM = true; + + public BEDCoord() { + + } + + public BEDCoord(String c, int sta, int sto, String di, String na) { + CHROM = c; + START = sta; + STOP = sto; + DIR = di; + NAME = na; + } + + public BEDCoord(String na, double sco) { + NAME = na; + SCORE = sco; + } + + public boolean getStatus() { + return VALIDCHROM; + } + + public void setStatus(boolean stat) { + VALIDCHROM = stat; + } + + public double[] getFStrand() { + return Fstrand; + } + + public double[] getRStrand() { + return Rstrand; + } + + public void setFstrand(double[] f) { + Fstrand = f; + } + + public void setRstrand(double[] r) { + Rstrand = r; + } + + public String getChrom() { + return CHROM; + } + + public void setChrom(String chr) { + CHROM = chr; + } + + public int getStart() { + return START; + } + + public void setStart(int sta) { + START = sta; + } + + public int getStop() { + return STOP; + } + + public void setStop(int sto) { + STOP = sto; + } + + public String getDir() { + return DIR; + } + + public void setDir(String di) { + DIR = di; + } + + public String getName() { + return NAME; + } + + public void setName(String na) { + NAME = na; + } + + public double getScore() { + return SCORE; + } + + public void setScore(double sco) { + SCORE = sco; + } + + public String toString() { + String line = CHROM + "\t" + START + "\t" + STOP + "\t" + NAME + "\t" + SCORE + "\t" + DIR; + return line; + } + + public static Comparator PeakChromComparator = new Comparator() { + public int compare(BEDCoord node1, BEDCoord node2) { + return node1.getChrom().compareTo(node2.getChrom()); + } + }; + + public static Comparator PeakPositionComparator = new Comparator() { + public int compare(BEDCoord node1, BEDCoord node2) { + int PeakStart1 = node1.getStart(); + int PeakStart2 = node2.getStart(); + if (PeakStart1 > PeakStart2) return 1; + else if (PeakStart1 < PeakStart2) return -1; + else return 0; + } + }; + + public static Comparator ScoreComparator = new Comparator() { + public int compare(BEDCoord node1, BEDCoord node2) { + double PeakStart1 = node1.getScore(); + double PeakStart2 = node2.getScore(); + if (PeakStart1 < PeakStart2) return 1; + else if (PeakStart1 > PeakStart2) return -1; + else return 0; + } + }; +} diff -r 000000000000 -r 147e2974b711 src/PileupObjects/PileupParameters.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/PileupObjects/PileupParameters.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,193 @@ +package PileupObjects; + +import java.awt.Color; +import java.io.File; +import java.util.ArrayList; + +public class PileupParameters { + private File OUTPUT = null; + private String COMPOSITE = null; + private int READ = 0; + private int STRAND = 0; + private int TRANS = 0; + private int SHIFT = 0; + private int BIN = 1; + private int SMOOTH = 0; + private int STDSIZE = 0; + private int STDNUM = 0; + private int CPU = 1; + private int OUTTYPE = 0; + private boolean STANDARD = false; + private boolean outputCOMPOSITE = false; + private boolean requirePE = false; + private double STANDRATIO = 1; + + private Color Sense = null; + private Color Anti = null; + private Color Combined = null; + + public PileupParameters() { + + } + + public boolean getPErequire() { + return requirePE; + } + + public void setPErequire(boolean status) { + requirePE = status; + } + + public String getCompositeFile() { + return COMPOSITE; + } + + public void setCompositeFile(String comp) { + COMPOSITE = comp; + } + + public boolean getOutputCompositeStatus() { + return outputCOMPOSITE; + } + + public void setOutputCompositeStatus(boolean out) { + outputCOMPOSITE = out; + } + + public ArrayList getColors() { + ArrayList ALL = new ArrayList(); + if(Sense != null) ALL.add(Sense); + if(Anti != null) ALL.add(Anti); + if(Combined != null) ALL.add(Combined); + return ALL; + } + + public void setSenseColor(Color s) { + Sense = s; + } + + public Color getSenseColor() { + return Sense; + } + + public void setAntiColor(Color a) { + Anti = a; + } + + public Color getAntiColor() { + return Anti; + } + + public void setCombinedColor(Color c) { + Combined = c; + } + + public Color getCombinedColor() { + return Combined; + } + + public void setRatio(double rat) { + STANDRATIO = rat; + } + + public double getRatio() { + return STANDRATIO; + } + + public void setStandard(boolean stand) { + STANDARD = stand; + } + + public boolean getStandard() { + return STANDARD; + } + + public void setOutputType(int newtype) { + OUTTYPE = newtype; + } + + public int getOutputType() { + return OUTTYPE; + } + + public File getOutput() { + return OUTPUT; + } + + public void setOutput(File oUTPUT) { + OUTPUT = oUTPUT; + } + + public int getRead() { + return READ; + } + + public void setRead(int rEAD) { + READ = rEAD; + } + + public int getStrand() { + return STRAND; + } + + public void setStrand(int sTRAND) { + STRAND = sTRAND; + } + + public int getTrans() { + return TRANS; + } + + public void setTrans(int tRANS) { + TRANS = tRANS; + } + + public int getShift() { + return SHIFT; + } + + public void setShift(int sHIFT) { + SHIFT = sHIFT; + } + + public int getBin() { + return BIN; + } + + public void setBin(int bIN) { + BIN = bIN; + } + + public int getSmooth() { + return SMOOTH; + } + + public void setSmooth(int sMOOTH) { + SMOOTH = sMOOTH; + } + + public int getStdSize() { + return STDSIZE; + } + + public void setStdSize(int sTDSIZE) { + STDSIZE = sTDSIZE; + } + + public int getStdNum() { + return STDNUM; + } + + public void setStdNum(int sTDNUM) { + STDNUM = sTDNUM; + } + + public int getCPU() { + return CPU; + } + + public void setCPU(int cPU) { + CPU = cPU; + } + +} diff -r 000000000000 -r 147e2974b711 src/PileupScripts/BAMUtilities.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/PileupScripts/BAMUtilities.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,42 @@ +package PileupScripts; + +import java.io.File; +import java.io.IOException; + +import htsjdk.samtools.AbstractBAMFileIndex; +import htsjdk.samtools.SAMRecord; +import htsjdk.samtools.SAMSequenceRecord; +import htsjdk.samtools.SamReader; +import htsjdk.samtools.SamReaderFactory; +import htsjdk.samtools.util.CloseableIterator; + +public class BAMUtilities { + public static double calculateStandardizationRatio(File BAM) throws IOException { + SamReader inputSam = SamReaderFactory.makeDefault().open(BAM); + AbstractBAMFileIndex bai = (AbstractBAMFileIndex) inputSam.indexing().getIndex(); + double counter = 0; + double totalAligned = 0; + double totalGenome = 0; + + for (int x = 0; x < bai.getNumberOfReferences(); x++) { + SAMSequenceRecord seq = inputSam.getFileHeader().getSequence(x); + totalAligned += inputSam.indexing().getIndex().getMetaData(x).getAlignedRecordCount(); + totalGenome += seq.getSequenceLength(); + } + CloseableIterator iter = inputSam.iterator(); + while (iter.hasNext()) { + SAMRecord sr = iter.next(); + if(sr.getReadPairedFlag()) { + if(sr.getSecondOfPairFlag()) { counter++; } //count read 2 to remove from aligned reads + } + } + inputSam.close(); + bai.close(); + iter.close(); + + totalAligned -= counter; + if(totalAligned > 0) { return (totalAligned / totalGenome); } + else { return 1; } + } + +} diff -r 000000000000 -r 147e2974b711 src/PileupScripts/PileupExtract.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/PileupScripts/PileupExtract.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,160 @@ +package PileupScripts; + +import htsjdk.samtools.SAMRecord; +import htsjdk.samtools.SamReader; +import htsjdk.samtools.SamReaderFactory; +import htsjdk.samtools.util.CloseableIterator; + +import java.io.File; +import java.util.Vector; + +import PileupObjects.BEDCoord; +import PileupObjects.PileupParameters; + +public class PileupExtract implements Runnable{ + PileupParameters param; + File BAM; + Vector INPUT; + int index; + int subsetsize; + SamReader inputSam; + + public void run() { + inputSam = SamReaderFactory.makeDefault().open(BAM); + for(int x = index; x < index + subsetsize; x++) { + if(INPUT.get(x).getStatus()) { extract(INPUT.get(x)); } + } + } + + public PileupExtract(PileupParameters p, File b, Vector i, int current, int length) { + param = p; + BAM = b; + INPUT = i; + index = current; + subsetsize = length; + } + + public void extract(BEDCoord read) { + double[] TAG_S1 = null; + double[] TAG_S2 = null; + int SHIFT = param.getShift(); + int STRAND = param.getStrand(); + + int BEDSTART = read.getStart(); + int BEDSTOP = read.getStop(); + //Correct for '-' strand BED coord so they align with '+' strand + if(read.getDir().equals("-")) { + BEDSTART++; + BEDSTOP++; + } + + //Correct Window Size for proper transformations + int WINDOW = (BEDSTOP - BEDSTART) + ((param.getBin() / 2) * 2); + int QUERYWINDOW = 0; + if(param.getTrans() == 1) { + WINDOW = (BEDSTOP - BEDSTART) + (param.getBin() * param.getSmooth() * 2); + QUERYWINDOW = (param.getBin() * param.getSmooth()); + } + else if(param.getTrans() == 2) { + WINDOW = (BEDSTOP - BEDSTART) + (param.getBin() * param.getStdSize() * param.getStdNum() * 2); + QUERYWINDOW = (param.getBin() * param.getStdSize() * param.getStdNum()); + } + TAG_S1 = new double[WINDOW]; + if(STRAND == 0) TAG_S2 = new double[WINDOW]; + + //SAMRecords are 1-based + CloseableIterator iter = inputSam.query(read.getChrom(), BEDSTART - QUERYWINDOW - SHIFT - 1, BEDSTOP + QUERYWINDOW + SHIFT + 1, false); + while (iter.hasNext()) { + //Create the record object + //SAMRecord is 1-based + SAMRecord sr = iter.next(); + + //Must be PAIRED-END mapped, mate must be mapped, must be read1 + if(sr.getReadPairedFlag()) { + if((sr.getProperPairFlag() && param.getPErequire()) || !param.getPErequire()) { + if((sr.getFirstOfPairFlag() && param.getRead() == 0) || (!sr.getFirstOfPairFlag() && param.getRead() == 1) || param.getRead() == 2) { + int FivePrime = sr.getUnclippedStart() - 1; + if(sr.getReadNegativeStrandFlag()) { + FivePrime = sr.getUnclippedEnd(); + FivePrime -= SHIFT; //SHIFT DATA HERE IF NECCESSARY + } else { FivePrime += SHIFT; } + FivePrime -= (BEDSTART - QUERYWINDOW); + + //Increment Final Array keeping track of pileup + if(FivePrime >= 0 && FivePrime < TAG_S1.length) { + if(STRAND == 0) { + if(!sr.getReadNegativeStrandFlag() && read.getDir().equals("-")) { TAG_S2[FivePrime] += 1; } + else if(sr.getReadNegativeStrandFlag() && read.getDir().equals("+")) { TAG_S2[FivePrime] += 1; } + else if(!sr.getReadNegativeStrandFlag() && read.getDir().equals("+")) { TAG_S1[FivePrime] += 1; } + else if(sr.getReadNegativeStrandFlag() && read.getDir().equals("-")) { TAG_S1[FivePrime] += 1;} + } else { + TAG_S1[FivePrime] += 1; + } + } + } + } + } else if(param.getRead() == 0 || param.getRead() == 2) { + //Also outputs if not paired-end since by default it is read-1 + int FivePrime = sr.getUnclippedStart() - 1; + if(sr.getReadNegativeStrandFlag()) { + FivePrime = sr.getUnclippedEnd(); + FivePrime -= SHIFT; //SHIFT DATA HERE IF NECCESSARY + } else { FivePrime += SHIFT; } + FivePrime -= (BEDSTART - QUERYWINDOW); + + //Increment Final Array keeping track of pileup + if(FivePrime >= 0 && FivePrime < TAG_S1.length) { + if(STRAND == 0) { + if(!sr.getReadNegativeStrandFlag() && read.getDir().equals("-")) { TAG_S2[FivePrime] += 1; } + else if(sr.getReadNegativeStrandFlag() && read.getDir().equals("+")) { TAG_S2[FivePrime] += 1; } + else if(!sr.getReadNegativeStrandFlag() && read.getDir().equals("+")) { TAG_S1[FivePrime] += 1; } + else if(sr.getReadNegativeStrandFlag() && read.getDir().equals("-")) { TAG_S1[FivePrime] += 1;} + } else { + TAG_S1[FivePrime] += 1; + } + } + } + } + iter.close(); + + if(read.getDir().equals("-")) { + TAG_S1 = TransformArray.reverseTran(TAG_S1); + TAG_S2 = TransformArray.reverseTran(TAG_S2); + } + + //Perform Binning here + double[] binF = new double[TAG_S1.length]; + double[] binR = null; + if(TAG_S2 != null) binR = new double[TAG_S2.length]; + + for(int j = 0; j < TAG_S1.length; j++) { + for(int k = j - (param.getBin() / 2); k <= j + (param.getBin() / 2); k++) { + if(k < 0) k = 0; + if(k >= TAG_S1.length) k = j + (param.getBin() / 2) + 1; + else { + binF[k] += TAG_S1[j]; + if(binR != null) binR[k] += TAG_S2[j]; + } + } + } + double[] finalF = new double[TAG_S1.length / param.getBin()]; + double[] finalR = null; + if(TAG_S2 != null) finalR = new double[TAG_S2.length / param.getBin()]; + + for(int x = (param.getBin() / 2); x < TAG_S1.length - (param.getBin() / 2); x += param.getBin()) { + finalF[(x - (param.getBin() / 2)) / param.getBin()] = TAG_S1[x]; + if(TAG_S2 != null) finalR[(x - (param.getBin() / 2)) / param.getBin()] = TAG_S2[x]; + } + + //Perform Tag Standardization Here + if(param.getStandard()) { + for(int i = 0; i < finalF.length; i++) { + if(finalF != null) finalF[i] /= param.getRatio(); + if(finalR != null) finalR[i] /= param.getRatio(); + } + } + + read.setFstrand(finalF); + read.setRstrand(finalR); + } +} diff -r 000000000000 -r 147e2974b711 src/PileupScripts/TransformArray.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/PileupScripts/TransformArray.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,53 @@ +package PileupScripts; + +public class TransformArray { + + public static double[] reverseTran(double[] orig) { + if(orig != null) { + double[] reverse = new double[orig.length]; + for(int x = orig.length - 1; x >= 0; x--) { + reverse[orig.length - 1 - x] = orig[x]; + } + return reverse; + } + return null; + } + + public static double[] smoothTran(double[] orig, int win) { + int window = win / 2; + double[] Sarray = new double[orig.length]; + for(int x = 0; x < orig.length; x++) { + double score = 0; + double weight = 0; + for(int y = x - window; y <= x + window; y++) { + if(y < 0) y = -1; + else if(y < orig.length) { + score += orig[y]; + weight++; + } else y = x + window + 1; + } + if(weight != 0) Sarray[x] = score / weight; + } + return Sarray; + } + + public static double[] gaussTran(double[] orig, int size, int num) { + double[] Garray = new double[orig.length]; + int window = size * num; + double SDSize = (double)size; + for(int x = 0; x < orig.length; x++) { + double score = 0; + double weight = 0; + for(int y = x - window; y <= x + window; y++) { + if(y < 0) y = -1; + else if(y < orig.length) { + double HEIGHT = Math.exp(-1 * Math.pow((y - x), 2) / (2 * Math.pow(SDSize, 2))); + score += (HEIGHT * orig[y]); + weight += HEIGHT; + } else y = x + window + 1; + } + if(weight != 0) Garray[x] = score / weight; + } + return Garray; + } +} diff -r 000000000000 -r 147e2974b711 src/TagPileup.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/TagPileup.java Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,508 @@ +import java.awt.Color; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.PrintStream; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.Scanner; +import java.util.Vector; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import PileupObjects.BEDCoord; +import PileupObjects.PileupParameters; +import PileupScripts.BAMUtilities; +import PileupScripts.PileupExtract; +import PileupScripts.TransformArray; +import htsjdk.samtools.AbstractBAMFileIndex; +import htsjdk.samtools.SamReader; +import htsjdk.samtools.SamReaderFactory; + +public class TagPileup { + //Global Transformations + private static boolean TAGSEQUAL = false; //set tags to be equal + private static int SHIFT = 0; //shift from 5' to 3' + private static int BINSIZE = 1; //bin tags, useful for mammalian or larger windows + + //Composite Transformations + private static int SMOOTHWINDOW = 0; + + //Read parameters + private static int STRAND = 0; //0 - strand sep, 1 - strand combined + private static int READ = 0; //0 - read 1, 1 - read 2, 2 - combined + private static boolean PE_STATUS = false; //require read 1 and 2 to be properly paired + + //Run parameters + private static int CPU = 1; + private static boolean OUTPUT_HEATMAP = true; + private static boolean OUTPUT_COMP = true; + + private static File BAM = null; + private static File BAI = null; + private static File BED = null; + private static Vector INPUT = null; + + private static String HPATH = null; + private static String CNAME = null; + private static PileupParameters PARAM = null; + private static PrintStream COMPOSITE = null; + private static PrintStream OUT_S1 = null; + private static PrintStream OUT_S2 = null; + + public static void main(String[] args) throws IOException { + loadConfig(args); + + System.out.println("\n" + getTimeStamp() + "\nLoading BED Coordinates.."); + INPUT = loadCoord(BED); + System.out.println("BED Coordinates Loaded\n" + getTimeStamp()); + + //Validate BED coordinates exist in BAM file + validateBED(); + + System.out.println("\n" + getTimeStamp() + "\nParsing Tags..."); + run(); + System.out.println("Tags Parsed\n" + getTimeStamp()); + } + + //Get size of largest array for composite generation + public static int getMaxBEDSize(Vector sites) { + int maxSize = 0; + for(int x = 0; x < sites.size(); x++) { + int SIZE = sites.get(x).getFStrand().length; + if(SIZE > maxSize) { + maxSize = SIZE; + } + } + return maxSize; + } + + //Validate BED coordinates exist within BAM file and satisfy BED format + public static void validateBED() throws IOException { + //Get chromosome IDs + SamReader inputSam = SamReaderFactory.makeDefault().open(BAM); + AbstractBAMFileIndex bai = (AbstractBAMFileIndex) inputSam.indexing().getIndex(); + ArrayList chrom = new ArrayList(); + for(int x = 0; x < bai.getNumberOfReferences(); x++) { + chrom.add(inputSam.getFileHeader().getSequence(x).getSequenceName()); + } + inputSam.close(); + bai.close(); + + ArrayList indexFail = new ArrayList(); + int FAILcount = 0; + for(int x = 0; x < INPUT.size(); x++) { + //check for existence of chromosome in BAM file + if(!chrom.contains(INPUT.get(x).getChrom())) { + INPUT.get(x).setStatus(false); + indexFail.add(new Integer(x)); + FAILcount++; + } + //check that the start is smaller than the stop + if(INPUT.get(x).getStart() > INPUT.get(x).getStop()) { + INPUT.get(x).setStatus(false); + indexFail.add(new Integer(x)); + FAILcount++; + } + } + if(FAILcount == INPUT.size()) { + System.err.println("No BED Coordinates exist within BAM file!!!"); + printUsage(); + System.exit(1); + } + //Remove failed indexes to more efficiently use CPUs + for(int x = indexFail.size() - 1; x >= 0; x--) { + INPUT.remove(indexFail.get(x).intValue()); + } + } + + public static void run() throws IOException { + if(PARAM.getOutputCompositeStatus()) { + try { + if(CNAME != null) { COMPOSITE = new PrintStream(CNAME); } + else { COMPOSITE = new PrintStream("composite.out"); } + } catch (FileNotFoundException e) { e.printStackTrace(); } + } + + //Code to standardize tags sequenced to genome size (1 tag / 1 bp) + if(PARAM.getStandard()) { PARAM.setRatio(BAMUtilities.calculateStandardizationRatio(BAM)); } + + if(PARAM.getOutputType() != 0) { + if(STRAND == 0) { + try { + if(HPATH != null) { + OUT_S1 = new PrintStream(HPATH + File.separator + generateFileName(BED.getName(), BAM.getName(), 0)); + OUT_S2 = new PrintStream(HPATH + File.separator + generateFileName(BED.getName(), BAM.getName(), 1)); + } else { + OUT_S1 = new PrintStream(generateFileName(BED.getName(), BAM.getName(), 0)); + OUT_S2 = new PrintStream(generateFileName(BED.getName(), BAM.getName(), 1)); + } + } catch (FileNotFoundException e) { e.printStackTrace(); } + } else { + try { + if(HPATH != null) { OUT_S1 = new PrintStream(HPATH + File.separator + generateFileName(BED.getName(), BAM.getName(), 2)); } + else { OUT_S1 = new PrintStream(generateFileName(BED.getName(), BAM.getName(), 2)); } + } catch (FileNotFoundException e) { e.printStackTrace(); } + } + } + + //Split up job and send out to threads to process + ExecutorService parseMaster = Executors.newFixedThreadPool(CPU); + if(INPUT.size() < CPU) CPU = INPUT.size(); + int subset = 0; + int currentindex = 0; + for(int x = 0; x < CPU; x++) { + currentindex += subset; + if(CPU == 1) subset = INPUT.size(); + else if(INPUT.size() % CPU == 0) subset = INPUT.size() / CPU; + else { + int remainder = INPUT.size() % CPU; + if(x < remainder ) subset = (int)(((double)INPUT.size() / (double)CPU) + 1); + else subset = (int)(((double)INPUT.size() / (double)CPU)); + } + PileupExtract extract = new PileupExtract(PARAM, BAM, INPUT, currentindex, subset); + parseMaster.execute(extract); + } + parseMaster.shutdown(); + while (!parseMaster.isTerminated()) { + } + + //double[] AVG_S1 = new double[INPUT.get(0).getFStrand().length]; + double[] AVG_S1 = new double[getMaxBEDSize(INPUT)]; + double[] AVG_S2 = null; + if(STRAND == 0) AVG_S2 = new double[AVG_S1.length]; + double[] DOMAIN = new double[AVG_S1.length]; + + //Account for the shifted oversized window produced by binning and smoothing + int OUTSTART = 0; + if(PARAM.getTrans() == 1) { OUTSTART = PARAM.getSmooth(); } + else if(PARAM.getTrans() == 2) { OUTSTART = (PARAM.getStdSize() * PARAM.getStdNum()); } + + if(PARAM.getOutputType() == 2) { + if(OUT_S1 != null) OUT_S1.print("YORF\tNAME"); + if(OUT_S2 != null) OUT_S2.print("YORF\tNAME"); + + for(int i = OUTSTART; i < AVG_S1.length - OUTSTART; i++) { + int index = i - OUTSTART; + if(OUT_S1 != null) OUT_S1.print("\t" + index); + if(OUT_S2 != null) OUT_S2.print("\t" + index); + } + if(OUT_S1 != null) OUT_S1.println(); + if(OUT_S2 != null) OUT_S2.println(); + } + + //Output individual sites + for(int i = 0; i < INPUT.size(); i++) { + double[] tempF = INPUT.get(i).getFStrand(); + double[] tempR = INPUT.get(i).getRStrand(); + if(OUT_S1 != null) OUT_S1.print(INPUT.get(i).getName()); + if(OUT_S2 != null) OUT_S2.print(INPUT.get(i).getName()); + + if(PARAM.getOutputType() == 2) { + if(OUT_S1 != null) OUT_S1.print("\t" + INPUT.get(i).getName()); + if(OUT_S2 != null) OUT_S2.print("\t" + INPUT.get(i).getName()); + } + + for(int j = 0; j < tempF.length; j++) { + if(j >= OUTSTART && j < tempF.length - OUTSTART) { + if(OUT_S1 != null) OUT_S1.print("\t" + tempF[j]); + if(OUT_S2 != null) OUT_S2.print("\t" + tempR[j]); + } + AVG_S1[j] += tempF[j]; + if(AVG_S2 != null) AVG_S2[j] += tempR[j]; + } + if(OUT_S1 != null) OUT_S1.println(); + if(OUT_S2 != null) OUT_S2.println(); + } + + //Calculate average and domain here + int temp = (int) (((double)AVG_S1.length / 2.0) + 0.5); + for(int i = 0; i < AVG_S1.length; i++) { + DOMAIN[i] = (double)((temp - (AVG_S1.length - i)) * PARAM.getBin()) + 1; + AVG_S1[i] /= INPUT.size(); + if(AVG_S2 != null) AVG_S2[i] /= INPUT.size(); + } + + //Transform average given transformation parameters + if(PARAM.getTrans() == 1) { + AVG_S1 = TransformArray.smoothTran(AVG_S1, PARAM.getSmooth()); + if(AVG_S2 != null) AVG_S2 = TransformArray.smoothTran(AVG_S2, PARAM.getSmooth()); + } else if(PARAM.getTrans() == 2) { + AVG_S1 = TransformArray.gaussTran(AVG_S1, PARAM.getStdSize(), PARAM.getStdNum()); + if(AVG_S2 != null) AVG_S2 = TransformArray.gaussTran(AVG_S2, PARAM.getStdSize(), PARAM.getStdNum()); + } + + //Trim average here and output to statistics pane + double[] AVG_S1_trim = new double[AVG_S1.length - (OUTSTART * 2)]; + double[] AVG_S2_trim = null; + if(STRAND == 0) AVG_S2_trim = new double[AVG_S1_trim.length]; + double[] DOMAIN_trim = new double[AVG_S1_trim.length]; + for(int i = OUTSTART; i < AVG_S1.length - OUTSTART; i++) { + if(AVG_S2 != null) { + AVG_S2_trim[i - OUTSTART] = AVG_S2[i]; + } + AVG_S1_trim[i - OUTSTART] = AVG_S1[i]; + DOMAIN_trim[i - OUTSTART] = DOMAIN[i]; + } + AVG_S1 = AVG_S1_trim; + AVG_S2 = AVG_S2_trim; + DOMAIN = DOMAIN_trim; + + //Output composite data to tab-delimited file + if(COMPOSITE != null) { + for(int a = 0; a < DOMAIN.length; a++) { + COMPOSITE.print("\t" + DOMAIN[a]); + } + COMPOSITE.println(); + if(STRAND == 0) { + COMPOSITE.print(generateFileName(BED.getName(), BAM.getName(), 0)); + for(int a = 0; a < AVG_S1.length; a++) { + COMPOSITE.print("\t" + AVG_S1[a]); + } + COMPOSITE.println(); + COMPOSITE.print(generateFileName(BED.getName(), BAM.getName(), 1)); + for(int a = 0; a < AVG_S2.length; a++) { + COMPOSITE.print("\t" + AVG_S2[a]); + } + COMPOSITE.println(); + } else { + COMPOSITE.print(generateFileName(BED.getName(), BAM.getName(), 2)); + for(int a = 0; a < AVG_S1.length; a++) { + COMPOSITE.print("\t" + AVG_S1[a]); + } + COMPOSITE.println(); + } + } + + if(OUT_S1 != null && PARAM.getOutputType() == 2) { OUT_S1.close(); } + if(OUT_S2 != null && PARAM.getOutputType() == 2) { OUT_S2.close(); } + } + + public static String generateFileName(String bed, String bam, int strandnum) { + String[] bedname = bed.split("\\."); + String[] bamname = bam.split("\\."); + + String strand = "sense"; + if(strandnum == 1) strand = "anti"; + else if(strandnum == 2) strand = "combined"; + String read = "read1"; + if(PARAM.getRead() == 1) read = "read2"; + else if(PARAM.getRead() == 2) read = "readc"; + + String filename = bedname[0] + "_" + bamname[0] + "_" + read + "_" + strand + ".tabular"; + return filename; + } + + public static Vector loadCoord(File INPUT) throws FileNotFoundException { + Scanner scan = new Scanner(INPUT); + Vector c = new Vector(); + while (scan.hasNextLine()) { + String[] temp = scan.nextLine().split("\t"); + if(temp.length > 2) { + if(!temp[0].contains("track") && !temp[0].contains("#")) { + String name = ""; + if(temp.length > 3) { name = temp[3]; } + else { name = temp[0] + "_" + temp[1] + "_" + temp[2]; } + if(Integer.parseInt(temp[1]) >= 0) { + if(temp.length > 4) { + if(temp[5].equals("+")) { c.add(new BEDCoord(temp[0], Integer.parseInt(temp[1]), Integer.parseInt(temp[2]), "+", name)); } + else { c.add(new BEDCoord(temp[0], Integer.parseInt(temp[1]), Integer.parseInt(temp[2]), "-", name)); } + } else { c.add(new BEDCoord(temp[0], Integer.parseInt(temp[1]), Integer.parseInt(temp[2]), "+", name)); } + + } else { + System.out.println("Invalid Coordinate in File!!!\n" + Arrays.toString(temp)); + } + } + } + } + scan.close(); + return c; + } + + public static void loadConfig(String[] command){ + for (int i = 0; i < command.length; i++) { + switch (command[i].charAt((1))) { + case 'b': + BAM = new File(command[i + 1]); + i++; + break; + case 'i': + BAI = new File(command[i + 1]); + i++; + break; + case 'c': + BED = new File(command[i + 1]); + i++; + break; + case 's': + SHIFT = Integer.parseInt(command[i + 1]); + i++; + break; + case 'n': + BINSIZE = Integer.parseInt(command[i + 1]); + i++; + break; + case 'e': + TAGSEQUAL = Boolean.parseBoolean(command[i + 1]); + i++; + break; + case 'r': + READ = Integer.parseInt(command[i + 1]); + i++; + break; + case 'a': + STRAND = Integer.parseInt(command[i + 1]); + i++; + break; + case 'p': + PE_STATUS = Boolean.parseBoolean(command[i + 1]); + i++; + break; + case 't': + CPU = Integer.parseInt(command[i + 1]); + i++; + break; + case 'w': + SMOOTHWINDOW = Integer.parseInt(command[i + 1]); + i++; + break; + case 'h': + OUTPUT_HEATMAP = Boolean.parseBoolean(command[i + 1]); + i++; + break; + case 'm': + OUTPUT_COMP = Boolean.parseBoolean(command[i + 1]); + i++; + break; + case 'o': + HPATH = command[i + 1]; + i++; + break; + case 'x': + CNAME = command[i + 1]; + i++; + break; + } + } + if(BAM == null) { + System.err.println("No BAM File loaded!!!\n"); + printUsage(); + System.exit(1); + } else if(BAI == null) { + System.err.println("No BAI Index File loaded!!!\n"); + printUsage(); + System.exit(1); + }else if(BED == null) { + System.err.println("No BED File loaded!!!\n"); + printUsage(); + System.exit(1); + } + + if(BINSIZE < 1) { + System.err.println("Invalid Bin Size!!! Must be larger than 0 bp"); + printUsage(); + System.exit(1); + } else if(READ < 0 || READ > 2) { + System.err.println("Invalid Read to Examine!!! Select 0-2"); + printUsage(); + System.exit(1); + } else if(CPU < 1) { + System.err.println("Invalid Number of CPU's!!! Must use at least 1"); + printUsage(); + System.exit(1); + } else if(SMOOTHWINDOW < 0) { + System.err.println("Invalid Smoothing Window Size!!! Must be larger than 0 bp"); + printUsage(); + System.exit(1); + } + + //Load up parameters for the pileup into single object + PARAM = new PileupParameters(); + + //Initialize global transformation parameters + PARAM.setShift(SHIFT); //SHIFT can be negative + PARAM.setBin(BINSIZE); + PARAM.setStandard(TAGSEQUAL); + + //Initialize read parameters + PARAM.setRead(READ); + PARAM.setPErequire(PE_STATUS); + if(STRAND == 0) { + PARAM.setStrand(0); + PARAM.setSenseColor(Color.BLUE); + PARAM.setAntiColor(Color.RED); + } else { + PARAM.setStrand(1); + PARAM.setCombinedColor(new Color(0, 100, 0)); + } + + //Initialize run parameters + PARAM.setCPU(CPU); + if(SMOOTHWINDOW > 0) { + PARAM.setTrans(1); + PARAM.setSmooth(SMOOTHWINDOW); + } else { PARAM.setTrans(0); } + + if(!OUTPUT_HEATMAP) { PARAM.setOutputType(0); } + else { PARAM.setOutputType(2); } + if(!OUTPUT_HEATMAP && !OUTPUT_COMP) { PARAM.setOutput(null); } + else { PARAM.setOutput(new File(System.getProperty("user.dir"))); } + + PARAM.setOutputCompositeStatus(OUTPUT_COMP); + + System.out.println("-----------------------------------------\nCommand Line Arguments:"); + System.out.println("BAM file: " + BAM); + System.out.println("BAI file: " + BAI); + System.out.println("BED file: " + BED); + + System.out.println("\nGlobal transformations:"); + System.out.println("5' to 3' Tag Shift (bp):\t" + SHIFT); + System.out.println("Bin Size (bp):\t\t\t" + BINSIZE); + System.out.println("Set Tags to be equal:\t\t" + TAGSEQUAL); + System.out.println("\nRead parameters:"); + System.out.println("Reads to Examine:\t\t" + READ); + System.out.println("Require Proper PE:\t\t" + PE_STATUS); + System.out.println("Combine Strands:\t\t" + STRAND); + System.out.println("\nRun parameters:"); + System.out.println("CPUs to use:\t\t\t" + CPU); + System.out.println("Composite smoothing window (bp):" + SMOOTHWINDOW); + System.out.println("Output heatmap:\t\t\t" + OUTPUT_HEATMAP); + System.out.println("Output path for heatmap:\t" + HPATH); + System.out.println("Output composite:\t\t" + OUTPUT_COMP); + System.out.println("Output filename for composite:\t" + CNAME); + + } + + public static void printUsage() { + System.err.println("Usage: java -jar TagPileup.jar -b [BAMFile] -c [BEDFile] [Options]"); + System.err.println("-----------------------------------------"); + System.err.println("\nRequired Parameter:"); + System.err.println("BAM File:\t\t\t-b\tBAM file"); + System.err.println("BAI File:\t\t\t-i\tBAI file"); + System.err.println("BED File:\t\t\t-c\tBED file"); + System.err.println("\nOptional Parameters:"); + System.err.println("\nGlobal transformations:"); + System.err.println("5' to 3' Tag Shift (bp):\t-s\t0 (default)"); + System.err.println("Bin Size (bp):\t\t\t-n\t1 (default)"); + System.err.println("Set Tags to be equal:\t\t-e\tfalse (default), true"); + System.err.println("\nRead parameters:"); + System.err.println("Reads to Examine:\t\t-r\t0 - Read 1 (default), 1 - Read 2, 2 - Combined"); + System.err.println("Require Proper PE:\t\t-p\tfalse (default), true"); + System.err.println("Combine Strands:\t\t-a\t0 - Strand seperate (default), 1 - Strand combined"); + System.err.println("\nRun parameters:"); + System.err.println("CPUs to use:\t\t\t-t\t1 (default)"); + System.err.println("Composite smoothing window (bp):-w\t0 (default)"); + System.err.println("Output heatmap:\t\t\t-h\ttrue (default), false"); + System.err.println("Output composite:\t\t-m\ttrue (default), false"); + System.err.println("Output path for heatmap:\t-o\tDefault local path"); + System.err.println("Output filename for composite:\t-x\tcomposite.out (default)"); + } + + private static String getTimeStamp() { + Date date= new Date(); + String time = new Timestamp(date.getTime()).toString(); + return time; + } +} diff -r 000000000000 -r 147e2974b711 tag_pileup_frequency.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tag_pileup_frequency.xml Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,111 @@ + + + + /dev/null + ]]> + + + + + + + + + + + + + + + + + + + + + + + + output_heatmap == true + + + + + + + + + + + + + + + + + + + + + + + + +**What it does** + +Generates a frequency pileup of the 5' ends of aligned reads in a BAM file relative to reference points in a BED file. + +----- + +**Options** + +**Global transformations** + + - **5' to 3' tag shift (bp)** - moves all tags from the 5' to the 3' direction given a specified distance in base pairs. + - **Bin Size (bp)** - bins tags together into specified size, useful for lower resolution data or for especially wide reference windows. + - **Set Tags to be equal** - standardizes tag count to be equal to genome size, useful for replicate comparisons. + +**Read parameters** + + - **Reads to Examine** - output data for Read1, Read2, or combined (only for paired end BAM files). + - **Require Proper PE** - require output reads to be properly paired (only for paired end BAM files). + - **Combine Strands** - examine reads on a forward/reverse basis (strand separate) or ignoring read orientation (strand combined). + +**Run parameters** + + - **Composite smoothing window (bp)** - sliding window to smooth composite frequencies. + - **Output frequencies for heatmap** - generate an additional dataset collection containing frequencies that can be used to generate a heatmap plot. + + + + + @unpublished{None, + author = {Lai, William}, + title = {None}, + year = {None}, + eprint = {None}, + url = {http://www.huck.psu.edu/content/research/independent-centers-excellence/center-for-eukaryotic-gene-regulation} + } + + diff -r 000000000000 -r 147e2974b711 test-data/input.bam Binary file test-data/input.bam has changed diff -r 000000000000 -r 147e2974b711 test-data/input.bed --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input.bed Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,41 @@ +chr17 958782 958824 chr17_951114_951309_1:0:0_1:0:0_d50af/2 37 + +chr17 1820041 1820100 chr17_1810548_1810721_1:0:0_0:0:0_519fb/1 37 - +chr17 1849174 1849232 chr17_1839787_1839971_1:0:0_0:0:0_4c72d/1 37 + +chr17 2778100 2778159 chr17_2768150_2768389_2:0:0_0:0:0_d422b/1 37 - +chr17 3205460 3205518 chr17_3195095_3195290_2:0:0_1:0:0_b31e3/1 37 - +chr17 4509384 4509441 chr17_4498414_4498642_2:0:0_1:1:0_f20f8/2 37 + +chr17 9677386 9677444 chr17_9676629_9676795_2:0:0_2:0:0_e997/2 37 + +chr17 10089099 10089157 chr17_10088345_10088511_1:0:0_0:0:0_3a7a2/2 37 + +chr17 12974352 12974399 chr17_51669566_51669767_1:0:0_4:0:0_4fa93/1 23 + +chr17 13430901 13430960 chr17_13429910_13430116_0:0:0_1:1:0_7c74f/2 37 + +chr17 15885434 15885477 chr17_15882376_15882562_3:0:0_1:0:0_8ca48/2 37 + +chr17 20624853 20624912 chr17_20622248_20622418_1:0:0_1:0:0_9f20f/1 37 - +chr17 27071126 27071171 chr17_75470822_75470987_3:0:0_2:0:0_4c20e/1 23 - +chr17 27913463 27913508 chr17_27909785_27909976_3:0:0_4:0:0_7f1ea/2 25 - +chr17 34920830 34920869 chr17_33286571_33286762_2:0:0_3:0:0_dc02a/1 25 + +chr17 39322684 39322742 chr17_39321131_39321340_1:0:0_1:0:0_db376/2 37 - +chr17 39810522 39810581 chr17_39810082_39810271_0:0:0_0:0:0_7eb08/2 37 + +chr17 39810524 39810583 chr17_39809904_39810133_1:0:0_0:0:0_8c2b/1 37 - +chr17 39960509 39960568 chr17_39959909_39960118_2:0:0_0:0:0_36d84/2 37 - +chr17 43542321 43542379 chr17_43542841_43543044_0:0:0_1:0:0_bda98/1 37 - +chr17 45800655 45800713 chr17_45803004_45803206_2:0:0_0:0:2_41429/1 37 + +chr17 46313026 46313081 chr17_46315776_46315986_1:0:0_0:0:0_e4beb/2 23 + +chr17 47124773 47124830 chr17_47127410_47127618_0:0:0_3:0:0_768f2/1 37 - +chr17 48697937 48697995 chr17_48708043_48708274_1:0:0_1:0:0_1a6/1 37 - +chr17 48697939 48697997 chr17_48708227_48708422_1:0:0_1:0:0_d70c1/2 37 + +chr17 52847681 52847739 chr17_52851082_52851314_1:0:0_1:0:0_6a280/2 37 - +chr17 54474562 54474618 chr17_54477683_54477878_2:0:0_1:0:0_c9f4/1 37 - +chr17 56652426 56652468 chr17_56655628_56655799_1:0:0_1:0:0_28a86/2 37 - +chr17 60951987 60952045 chr17_60960117_60960339_0:1:0_1:0:0_ea16c/2 37 + +chr17 61271205 61271247 chr17_61279152_61279329_1:0:0_1:0:0_477ec/2 37 - +chr17 64901295 64901353 chr17_64907182_64907353_0:0:0_1:0:0_188c2/1 37 - +chr17 64901313 64901371 chr17_64907182_64907371_0:0:0_1:0:0_50fa5/2 37 - +chr17 65065434 65065475 chr17_65071347_65071553_0:0:0_1:0:0_5e8bb/2 37 - +chr17 66772270 66772328 chr17_66777686_66777888_1:0:0_1:0:0_fcea/2 37 - +chr17 68614271 68614328 chr17_68621038_68621213_0:0:0_1:1:0_3ebaf/2 37 - +chr17 69072334 69072383 chr17_1119124_1119366_1:0:0_1:0:0_736b9/1 25 + +chr17 74122686 74122743 chr17_74128589_74128844_1:0:0_1:0:0_b61d8/2 37 + +chr17 76184542 76184601 chr17_76191086_76191297_0:0:0_2:0:0_5f28c/1 37 + +chr17 76518424 76518474 chr17_76526501_76526684_2:0:0_0:0:0_95fe3/2 25 + +chr17 76518826 76518878 chr17_76524679_76524888_0:0:0_0:0:0_8f754/1 37 - +chr17 76941019 76941064 chr17_55336589_55336803_2:0:0_5:0:0_4a6cb/1 23 + diff -r 000000000000 -r 147e2974b711 test-data/input2_input1_read1_anti.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input2_input1_read1_anti.tabular Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,15 @@ +YORF NAME 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 +chr17_951114_951309_1:0:0_1:0:0_d50af/2 chr17_951114_951309_1:0:0_1:0:0_d50af/2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_1810548_1810721_1:0:0_0:0:0_519fb/1 chr17_1810548_1810721_1:0:0_0:0:0_519fb/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_1839787_1839971_1:0:0_0:0:0_4c72d/1 chr17_1839787_1839971_1:0:0_0:0:0_4c72d/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_2768150_2768389_2:0:0_0:0:0_d422b/1 chr17_2768150_2768389_2:0:0_0:0:0_d422b/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 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.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_20622248_20622418_1:0:0_1:0:0_9f20f/1 chr17_20622248_20622418_1:0:0_1:0:0_9f20f/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_75470822_75470987_3:0:0_2:0:0_4c20e/1 chr17_75470822_75470987_3:0:0_2:0:0_4c20e/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_27909785_27909976_3:0:0_4:0:0_7f1ea/2 chr17_27909785_27909976_3:0:0_4:0:0_7f1ea/2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 diff -r 000000000000 -r 147e2974b711 test-data/input2_input1_read1_sense.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/input2_input1_read1_sense.tabular Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,15 @@ +YORF NAME 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 +chr17_951114_951309_1:0:0_1:0:0_d50af/2 chr17_951114_951309_1:0:0_1:0:0_d50af/2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_1810548_1810721_1:0:0_0:0:0_519fb/1 chr17_1810548_1810721_1:0:0_0:0:0_519fb/1 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_1839787_1839971_1:0:0_0:0:0_4c72d/1 chr17_1839787_1839971_1:0:0_0:0:0_4c72d/1 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_2768150_2768389_2:0:0_0:0:0_d422b/1 chr17_2768150_2768389_2:0:0_0:0:0_d422b/1 1.0 0.0 0.0 0.0 0.0 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.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_20622248_20622418_1:0:0_1:0:0_9f20f/1 chr17_20622248_20622418_1:0:0_1:0:0_9f20f/1 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_75470822_75470987_3:0:0_2:0:0_4c20e/1 chr17_75470822_75470987_3:0:0_2:0:0_4c20e/1 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +chr17_27909785_27909976_3:0:0_4:0:0_7f1ea/2 chr17_27909785_27909976_3:0:0_4:0:0_7f1ea/2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 diff -r 000000000000 -r 147e2974b711 test-data/output1.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/output1.tabular Fri Mar 18 08:48:22 2016 -0400 @@ -0,0 +1,3 @@ + -28.0 -27.0 -26.0 -25.0 -24.0 -23.0 -22.0 -21.0 -20.0 -19.0 -18.0 -17.0 -16.0 -15.0 -14.0 -13.0 -12.0 -11.0 -10.0 -9.0 -8.0 -7.0 -6.0 -5.0 -4.0 -3.0 -2.0 -1.0 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0 20.0 21.0 22.0 23.0 24.0 25.0 26.0 27.0 28.0 29.0 30.0 +dataset_2_dataset_1_read1_sense.tabular 0.3170731707317073 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.024390243902439025 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 +dataset_2_dataset_1_read1_anti.tabular 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.024390243902439025 0.0 0.0