Search in sources :

Example 31 with Chromosome

use of uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome in project SeqMonk by s-andrews.

the class CodonBiasPipeline method startPipeline.

protected void startPipeline() {
    // We first need to generate probes over all of the features listed in
    // the feature types.  The probes should cover the whole area of the
    // feature regardless of where it splices.
    Vector<Probe> probes = new Vector<Probe>();
    double pValue = optionsPanel.pValue();
    String libraryType = optionsPanel.libraryType();
    Chromosome[] chrs = collection().genome().getAllChromosomes();
    for (int c = 0; c < chrs.length; c++) {
        if (cancel) {
            progressCancelled();
            return;
        }
        progressUpdated("Making probes for chr" + chrs[c].name(), c, chrs.length * 2);
        Feature[] features = collection().genome().annotationCollection().getFeaturesForType(chrs[c], optionsPanel.getSelectedFeatureType());
        for (int f = 0; f < features.length; f++) {
            if (cancel) {
                progressCancelled();
                return;
            }
            Probe p = new Probe(chrs[c], features[f].location().start(), features[f].location().end(), features[f].location().strand(), features[f].name());
            probes.add(p);
        }
    }
    allProbes = probes.toArray(new Probe[0]);
    collection().setProbeSet(new ProbeSet("Features over " + optionsPanel.getSelectedFeatureType(), allProbes));
    // Now we can quantitate each individual feature and test for whether it is significantly
    // showing codon bias
    ArrayList<Vector<ProbeTTestValue>> significantProbes = new ArrayList<Vector<ProbeTTestValue>>();
    // data contains the data stores that this pipeline is going to use. We need to test each data store.
    for (int d = 0; d < data.length; d++) {
        significantProbes.add(new Vector<ProbeTTestValue>());
    }
    int probeCounter = 0;
    for (int c = 0; c < chrs.length; c++) {
        if (cancel) {
            progressCancelled();
            return;
        }
        progressUpdated("Quantitating features on chr" + chrs[c].name(), chrs.length + c, chrs.length * 2);
        Feature[] features = collection().genome().annotationCollection().getFeaturesForType(chrs[c], optionsPanel.getSelectedFeatureType());
        for (int p = 0; p < features.length; p++) {
            // Get the corresponding feature and work out the mapping between genomic position and codon sub position.
            int[] mappingArray = createGenomeMappingArray(features[p]);
            DATASTORE_LOOP: for (int d = 0; d < data.length; d++) {
                if (cancel) {
                    progressCancelled();
                    return;
                }
                long[] reads = data[d].getReadsForProbe(allProbes[probeCounter]);
                // TODO: make this configurable
                if (reads.length < 5) {
                    data[d].setValueForProbe(allProbes[probeCounter], Float.NaN);
                    continue DATASTORE_LOOP;
                }
                int pos1Count = 0;
                int pos2Count = 0;
                int pos3Count = 0;
                READ_LOOP: for (int r = 0; r < reads.length; r++) {
                    int genomicReadStart = SequenceRead.start(reads[r]);
                    int genomicReadEnd = SequenceRead.end(reads[r]);
                    int readStrand = SequenceRead.strand(reads[r]);
                    int relativeReadStart = -1;
                    // forward reads
                    if (readStrand == 1) {
                        if (libraryType == "Same strand specific") {
                            if (features[p].location().strand() == Location.FORWARD) {
                                // The start of the read needs to be within the feature
                                if (genomicReadStart - features[p].location().start() < 0) {
                                    continue READ_LOOP;
                                } else {
                                    // look up the read start pos in the mapping array
                                    relativeReadStart = mappingArray[genomicReadStart - features[p].location().start()];
                                }
                            }
                        } else if (libraryType == "Opposing strand specific") {
                            if (features[p].location().strand() == Location.REVERSE) {
                                // The "start" of a reverse read/probe is actually the end
                                if (features[p].location().end() - genomicReadEnd < 0) {
                                    continue READ_LOOP;
                                } else {
                                    relativeReadStart = mappingArray[features[p].location().end() - genomicReadEnd];
                                }
                            }
                        }
                    }
                    // reverse reads
                    if (readStrand == -1) {
                        if (libraryType == "Same strand specific") {
                            if (features[p].location().strand() == Location.REVERSE) {
                                if (features[p].location().end() - genomicReadEnd < 0) {
                                    continue READ_LOOP;
                                } else {
                                    // System.out.println("features[p].location().end() is " + features[p].location().end() + ", genomicReadEnd is " + genomicReadEnd);
                                    // System.out.println("mapping array[0] is " + mappingArray[0]);
                                    relativeReadStart = mappingArray[features[p].location().end() - genomicReadEnd];
                                }
                            }
                        } else if (libraryType == "Opposing strand specific") {
                            if (features[p].location().strand() == Location.FORWARD) {
                                // The start of the read needs to be within the feature
                                if (genomicReadStart - features[p].location().start() < 0) {
                                    continue READ_LOOP;
                                } else {
                                    // look up the read start position in the mapping array
                                    relativeReadStart = mappingArray[genomicReadStart - features[p].location().start()];
                                }
                            }
                        }
                    }
                    // find out which position the read is in
                    if (relativeReadStart == -1) {
                        continue READ_LOOP;
                    } else if (relativeReadStart % 3 == 0) {
                        pos3Count++;
                        continue READ_LOOP;
                    } else if ((relativeReadStart + 1) % 3 == 0) {
                        pos2Count++;
                        continue READ_LOOP;
                    } else if ((relativeReadStart + 2) % 3 == 0) {
                        pos1Count++;
                    }
                }
                // closing bracket for read loop
                // System.out.println("pos1Count for "+ features[p].name() + " is " + pos1Count);
                // System.out.println("pos2Count for "+ features[p].name() + " is " + pos2Count);
                // System.out.println("pos3Count for "+ features[p].name() + " is " + pos3Count);
                int interestingCodonCount = 0;
                int otherCodonCount = 0;
                if (optionsPanel.codonSubPosition() == 1) {
                    interestingCodonCount = pos1Count;
                    otherCodonCount = pos2Count + pos3Count;
                } else if (optionsPanel.codonSubPosition() == 2) {
                    interestingCodonCount = pos2Count;
                    otherCodonCount = pos1Count + pos3Count;
                } else if (optionsPanel.codonSubPosition() == 3) {
                    interestingCodonCount = pos3Count;
                    otherCodonCount = pos1Count + pos2Count;
                }
                int totalCount = interestingCodonCount + otherCodonCount;
                // BinomialDistribution bd = new BinomialDistribution(interestingCodonCount+otherCodonCount, 1/3d);
                BinomialDistribution bd = new BinomialDistribution(totalCount, 1 / 3d);
                // Since the binomial distribution gives the probability of getting a value higher than
                // this we need to subtract one so we get the probability of this or higher.
                double thisPValue = 1 - bd.cumulativeProbability(interestingCodonCount - 1);
                if (interestingCodonCount == 0)
                    thisPValue = 1;
                // We have to add all results at this stage so we don't mess up the multiple
                // testing correction later on.
                significantProbes.get(d).add(new ProbeTTestValue(allProbes[probeCounter], thisPValue));
                float percentageCount;
                if (totalCount == 0) {
                    percentageCount = 0;
                } else {
                    percentageCount = ((float) interestingCodonCount / (float) totalCount) * 100;
                }
                data[d].setValueForProbe(allProbes[probeCounter], percentageCount);
            // System.out.println("totalCount = " + totalCount);
            // System.out.println("interestingCodonCount " + interestingCodonCount);
            // System.out.println("pValue = " + thisPValue);
            // System.out.println("percentageCount = " + percentageCount);
            // System.out.println("");
            }
            probeCounter++;
        }
    }
    // filtering those which pass our p-value cutoff
    for (int d = 0; d < data.length; d++) {
        ProbeTTestValue[] ttestResults = significantProbes.get(d).toArray(new ProbeTTestValue[0]);
        BenjHochFDR.calculateQValues(ttestResults);
        ProbeList newList = new ProbeList(collection().probeSet(), "Codon bias < " + pValue + " in " + data[d].name(), "Probes showing significant codon bias for position " + optionsPanel.codonSubPosition() + " with a cutoff of " + pValue, "FDR");
        for (int i = 0; i < ttestResults.length; i++) {
            if (ttestResults[i].q < pValue) {
                newList.addProbe(ttestResults[i].probe, (float) ttestResults[i].q);
            }
        }
    }
    StringBuffer quantitationDescription = new StringBuffer();
    quantitationDescription.append("Codon bias pipeline using codon position " + optionsPanel.codonSubPosition() + " for " + optionsPanel.libraryType() + " library.");
    collection().probeSet().setCurrentQuantitation(quantitationDescription.toString());
    quantitatonComplete();
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) ArrayList(java.util.ArrayList) Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome) Probe(uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe) Feature(uk.ac.babraham.SeqMonk.DataTypes.Genome.Feature) ProbeSet(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeSet) ProbeTTestValue(uk.ac.babraham.SeqMonk.Analysis.Statistics.ProbeTTestValue) BinomialDistribution(org.apache.commons.math3.distribution.BinomialDistribution) Vector(java.util.Vector)

Example 32 with Chromosome

use of uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome in project SeqMonk by s-andrews.

the class TranscriptionTerminationPipeline method startPipeline.

protected void startPipeline() {
    // We first need to generate probes over all of the features listed in
    // the feature types.  The probes should cover the whole area of the
    // feature regardless of where it splices.
    Vector<Probe> probes = new Vector<Probe>();
    int minCount = optionsPanel.minCount();
    int measurementLength = optionsPanel.measurementLength();
    QuantitationStrandType readFilter = optionsPanel.readFilter();
    Chromosome[] chrs = collection().genome().getAllChromosomes();
    for (int c = 0; c < chrs.length; c++) {
        if (cancel) {
            progressCancelled();
            return;
        }
        progressUpdated("Creating Probes" + chrs[c].name(), c, chrs.length * 2);
        Feature[] features = getValidFeatures(chrs[c], measurementLength);
        for (int f = 0; f < features.length; f++) {
            if (cancel) {
                progressCancelled();
                return;
            }
            if (features[f].location().strand() == Location.REVERSE) {
                Probe p = new Probe(chrs[c], features[f].location().start() - measurementLength, features[f].location().start() + measurementLength, features[f].location().strand(), features[f].name());
                probes.add(p);
            } else {
                Probe p = new Probe(chrs[c], features[f].location().end() - measurementLength, features[f].location().end() + measurementLength, features[f].location().strand(), features[f].name());
                probes.add(p);
            }
        }
    }
    Probe[] allProbes = probes.toArray(new Probe[0]);
    collection().setProbeSet(new ProbeSet("Features " + measurementLength + "bp around the end of " + optionsPanel.getSelectedFeatureType(), allProbes));
    int probeIndex = 0;
    for (int c = 0; c < chrs.length; c++) {
        if (cancel) {
            progressCancelled();
            return;
        }
        progressUpdated("Quantitating features on chr" + chrs[c].name(), chrs.length + c, chrs.length * 2);
        Feature[] features = getValidFeatures(chrs[c], measurementLength);
        for (int f = 0; f < features.length; f++) {
            if (cancel) {
                progressCancelled();
                return;
            }
            for (int d = 0; d < data.length; d++) {
                if (allProbes[probeIndex].strand() == Location.REVERSE) {
                    Probe downstreamProbe = new Probe(chrs[c], features[f].location().start() - measurementLength, features[f].location().start(), features[f].location().strand(), features[f].name());
                    Probe upstreamProbe = new Probe(chrs[c], features[f].location().start(), features[f].location().start() + measurementLength, features[f].location().strand(), features[f].name());
                    long[] upstreamReads = data[d].getReadsForProbe(upstreamProbe);
                    long[] downstreamReads = data[d].getReadsForProbe(downstreamProbe);
                    int upstreamCount = 0;
                    for (int i = 0; i < upstreamReads.length; i++) {
                        if (readFilter.useRead(allProbes[probeIndex], upstreamReads[i]))
                            ++upstreamCount;
                    }
                    int downstreamCount = 0;
                    for (int i = 0; i < downstreamReads.length; i++) {
                        if (readFilter.useRead(allProbes[probeIndex], downstreamReads[i]))
                            ++downstreamCount;
                    }
                    float percentage = ((upstreamCount - downstreamCount) / (float) upstreamCount) * 100f;
                    if (upstreamCount >= minCount) {
                        data[d].setValueForProbe(allProbes[probeIndex], percentage);
                    } else {
                        data[d].setValueForProbe(allProbes[probeIndex], Float.NaN);
                    }
                } else {
                    Probe upstreamProbe = new Probe(chrs[c], features[f].location().end() - measurementLength, features[f].location().end(), features[f].location().strand(), features[f].name());
                    Probe downstreamProbe = new Probe(chrs[c], features[f].location().end(), features[f].location().end() + measurementLength, features[f].location().strand(), features[f].name());
                    long[] upstreamReads = data[d].getReadsForProbe(upstreamProbe);
                    long[] downstreamReads = data[d].getReadsForProbe(downstreamProbe);
                    int upstreamCount = 0;
                    for (int i = 0; i < upstreamReads.length; i++) {
                        if (readFilter.useRead(allProbes[probeIndex], upstreamReads[i]))
                            ++upstreamCount;
                    }
                    int downstreamCount = 0;
                    for (int i = 0; i < downstreamReads.length; i++) {
                        if (readFilter.useRead(allProbes[probeIndex], downstreamReads[i]))
                            ++downstreamCount;
                    }
                    float percentage = ((upstreamCount - downstreamCount) / (float) upstreamCount) * 100f;
                    if (upstreamCount >= minCount) {
                        data[d].setValueForProbe(allProbes[probeIndex], percentage);
                    } else {
                        data[d].setValueForProbe(allProbes[probeIndex], Float.NaN);
                    }
                }
            }
            ++probeIndex;
        }
    }
    StringBuffer quantitationDescription = new StringBuffer();
    quantitationDescription.append("Transcription termination pipeline quantitation ");
    quantitationDescription.append(". Directionality was ");
    quantitationDescription.append(optionsPanel.libraryTypeBox.getSelectedItem());
    quantitationDescription.append(". Measurement length was ");
    quantitationDescription.append(optionsPanel.measurementLength());
    quantitationDescription.append(". Min count was ");
    quantitationDescription.append(optionsPanel.minCount());
    collection().probeSet().setCurrentQuantitation(quantitationDescription.toString());
    quantitatonComplete();
}
Also used : Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome) Probe(uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe) Feature(uk.ac.babraham.SeqMonk.DataTypes.Genome.Feature) ProbeSet(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeSet) QuantitationStrandType(uk.ac.babraham.SeqMonk.DataTypes.Sequence.QuantitationStrandType) Vector(java.util.Vector)

Example 33 with Chromosome

use of uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome in project SeqMonk by s-andrews.

the class FeatureNameFilter method generateProbeList.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Filters.ProbeFilter#generateProbeList()
	 */
@Override
protected void generateProbeList() {
    annotationType = optionsPanel.annotationTypeBox.getSelectedItem().toString();
    stripSuffixes = optionsPanel.stripSuffixesBox.isSelected();
    stripTranscriptSuffixes = optionsPanel.stripTranscriptSuffixesBox.isSelected();
    ProbeList passedProbes = new ProbeList(startingList, "", "", startingList.getValueName());
    // Since we're going to be making the annotations on the
    // basis of position we should go through all probes one
    // chromosome at a time.  We therefore make a stipulation that
    // not only do the feature names have to match, so do the
    // chromosomes.
    Chromosome[] chrs = collection.genome().getAllChromosomes();
    for (int c = 0; c < chrs.length; c++) {
        // We start by building a list of the feature names we're going to
        // check against.
        HashSet<String> featureNames = new HashSet<String>();
        progressUpdated("Processing features on Chr " + chrs[c].name(), c, chrs.length);
        Probe[] probes = startingList.getProbesForChromosome(chrs[c]);
        Feature[] features = collection.genome().annotationCollection().getFeaturesForType(chrs[c], annotationType);
        for (int f = 0; f < features.length; f++) {
            String name = features[f].name();
            if (stripSuffixes) {
                name = name.replaceFirst("_upstream$", "").replaceAll("_downstream$", "").replaceAll("_gene$", "");
            }
            if (stripTranscriptSuffixes) {
                name = name.replaceAll("-\\d\\d\\d$", "");
            }
            featureNames.add(name);
        }
        // We can now step through the probes looking for a match to the stored feature names
        for (int p = 0; p < probes.length; p++) {
            if (cancel) {
                cancel = false;
                progressCancelled();
                return;
            }
            String name = probes[p].name();
            if (stripSuffixes) {
                name = name.replaceFirst("_upstream$", "").replaceAll("_downstream$", "").replaceAll("_gene$", "");
            }
            if (stripTranscriptSuffixes) {
                name = name.replaceAll("-\\d\\d\\d$", "");
            }
            if (featureNames.contains(name)) {
                passedProbes.addProbe(probes[p], startingList.getValueForProbe(probes[p]));
            }
        }
    }
    filterFinished(passedProbes);
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome) Probe(uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe) Feature(uk.ac.babraham.SeqMonk.DataTypes.Genome.Feature) HashSet(java.util.HashSet)

Example 34 with Chromosome

use of uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome in project SeqMonk by s-andrews.

the class WindowedDifferencesFilter method generateProbeList.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Filters.ProbeFilter#generateProbeList()
	 */
@Override
protected void generateProbeList() {
    // We need to check that we don't add any probes more than once
    // so we need to keep a hash of the probes we've added to the
    // filtered list.
    Hashtable<Probe, Float> goingToAdd = new Hashtable<Probe, Float>();
    ProbeList newList = new ProbeList(startingList, "Filtered Probes", "", "Difference");
    Chromosome[] chromosomes = collection.genome().getAllChromosomes();
    for (int c = 0; c < chromosomes.length; c++) {
        progressUpdated("Processing windows on Chr" + chromosomes[c].name(), c, chromosomes.length);
        Probe[] probes = startingList.getProbesForChromosome(chromosomes[c]);
        ProbeGroupGenerator gen = null;
        if (windowType == DISTANCE_WINDOW) {
            gen = new ProbeWindowGenerator(probes, windowSize);
        } else if (windowType == CONSECUTIVE_WINDOW) {
            gen = new ConsecutiveProbeGenerator(probes, windowSize);
        } else if (windowType == FEATURE_WINDOW) {
            gen = new FeatureProbeGroupGenerator(probes, collection.genome().annotationCollection().getFeaturesForType(optionPanel.featureTypeBox.getSelectedItem().toString()));
        }
        while (true) {
            if (cancel) {
                cancel = false;
                progressCancelled();
                return;
            }
            Probe[] theseProbes = gen.nextSet();
            if (theseProbes == null) {
                break;
            }
            int count = 0;
            float d = 0;
            for (int s1 = 0; s1 < fromStores.length; s1++) {
                for (int s2 = 0; s2 < toStores.length; s2++) {
                    switch(combineType) {
                        case DifferencesFilter.AVERAGE:
                            d += getDifferenceValue(toStores[s2], fromStores[s1], theseProbes);
                            count++;
                            break;
                        case DifferencesFilter.MAXIMUM:
                            float dt1 = getDifferenceValue(toStores[s2], fromStores[s1], theseProbes);
                            if (count == 0 || dt1 > d)
                                d = dt1;
                            count++;
                            break;
                        case DifferencesFilter.MINIMUM:
                            float dt2 = getDifferenceValue(toStores[s2], fromStores[s1], theseProbes);
                            if (count == 0 || dt2 < d)
                                d = dt2;
                            count++;
                            break;
                    }
                }
            }
            if (combineType == DifferencesFilter.AVERAGE) {
                d /= count;
            }
            // Now we have the value we need to know if it passes the test
            if (upperLimit != null)
                if (d > upperLimit.doubleValue())
                    continue;
            if (lowerLimit != null)
                if (d < lowerLimit.doubleValue())
                    continue;
            for (int i = 0; i < theseProbes.length; i++) {
                if (goingToAdd.containsKey(theseProbes[i])) {
                    // Don't do anything if this probe is already there with a bigger difference
                    continue;
                // if (Math.abs(goingToAdd.get(theseProbes[i])) > Math.abs(d)) continue;
                }
                goingToAdd.put(theseProbes[i], d);
            }
        }
    }
    // Finally add all of the cached probes to the actual probe list
    Enumeration<Probe> en = goingToAdd.keys();
    while (en.hasMoreElements()) {
        Probe p = en.nextElement();
        newList.addProbe(p, goingToAdd.get(p));
    }
    filterFinished(newList);
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) Hashtable(java.util.Hashtable) ProbeWindowGenerator(uk.ac.babraham.SeqMonk.Filters.ProbeGroupGenerator.ProbeWindowGenerator) Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome) Probe(uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe) FeatureProbeGroupGenerator(uk.ac.babraham.SeqMonk.Filters.ProbeGroupGenerator.FeatureProbeGroupGenerator) ConsecutiveProbeGenerator(uk.ac.babraham.SeqMonk.Filters.ProbeGroupGenerator.ConsecutiveProbeGenerator) ProbeGroupGenerator(uk.ac.babraham.SeqMonk.Filters.ProbeGroupGenerator.ProbeGroupGenerator) FeatureProbeGroupGenerator(uk.ac.babraham.SeqMonk.Filters.ProbeGroupGenerator.FeatureProbeGroupGenerator)

Example 35 with Chromosome

use of uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome in project SeqMonk by s-andrews.

the class ReplicateSetStatsFilter method generateProbeList.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Filters.ProbeFilter#generateProbeList()
	 */
@Override
protected void generateProbeList() {
    Chromosome[] chromosomes = collection.genome().getAllChromosomes();
    // Make up the list of DataStores in each replicate set
    DataStore[][] stores = new DataStore[replicateSets.length][];
    for (int i = 0; i < replicateSets.length; i++) {
        stores[i] = replicateSets[i].dataStores();
    }
    Vector<ProbeTTestValue> newListProbesVector = new Vector<ProbeTTestValue>();
    for (int c = 0; c < chromosomes.length; c++) {
        progressUpdated("Processing probes on Chr" + chromosomes[c].name(), c, chromosomes.length);
        Probe[] probes = startingList.getProbesForChromosome(chromosomes[c]);
        for (int p = 0; p < probes.length; p++) {
            if (cancel) {
                cancel = false;
                progressCancelled();
                return;
            }
            double[][] values = new double[replicateSets.length][];
            for (int i = 0; i < replicateSets.length; i++) {
                values[i] = new double[stores[i].length];
                for (int j = 0; j < stores[i].length; j++) {
                    try {
                        values[i][j] = stores[i][j].getValueForProbe(probes[p]);
                    } catch (SeqMonkException e) {
                    }
                }
            }
            double pValue = 0;
            try {
                if (replicateSets.length == 1) {
                    pValue = TTest.calculatePValue(values[0], 0);
                } else if (replicateSets.length == 2) {
                    pValue = TTest.calculatePValue(values[0], values[1]);
                } else {
                    pValue = AnovaTest.calculatePValue(values);
                }
            } catch (SeqMonkException e) {
                throw new IllegalStateException(e);
            }
            newListProbesVector.add(new ProbeTTestValue(probes[p], pValue));
        }
    }
    ProbeTTestValue[] newListProbes = newListProbesVector.toArray(new ProbeTTestValue[0]);
    // Do the multi-testing correction if necessary
    if (multiTest) {
        BenjHochFDR.calculateQValues(newListProbes);
    }
    ProbeList newList;
    if (multiTest) {
        newList = new ProbeList(startingList, "", "", "Q-value");
        for (int i = 0; i < newListProbes.length; i++) {
            if (newListProbes[i].q <= cutoff) {
                newList.addProbe(newListProbes[i].probe, new Float(newListProbes[i].q));
            }
        }
    } else {
        newList = new ProbeList(startingList, "", "", "P-value");
        for (int i = 0; i < newListProbes.length; i++) {
            if (newListProbes[i].p <= cutoff) {
                newList.addProbe(newListProbes[i].probe, new Float(newListProbes[i].p));
            }
        }
    }
    filterFinished(newList);
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) Chromosome(uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome) Probe(uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe) ProbeTTestValue(uk.ac.babraham.SeqMonk.Analysis.Statistics.ProbeTTestValue) DataStore(uk.ac.babraham.SeqMonk.DataTypes.DataStore) SeqMonkException(uk.ac.babraham.SeqMonk.SeqMonkException) Vector(java.util.Vector)

Aggregations

Chromosome (uk.ac.babraham.SeqMonk.DataTypes.Genome.Chromosome)78 Probe (uk.ac.babraham.SeqMonk.DataTypes.Probes.Probe)47 Vector (java.util.Vector)36 Feature (uk.ac.babraham.SeqMonk.DataTypes.Genome.Feature)23 SeqMonkException (uk.ac.babraham.SeqMonk.SeqMonkException)23 ProbeSet (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeSet)22 ProbeList (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList)12 DataStore (uk.ac.babraham.SeqMonk.DataTypes.DataStore)11 DataSet (uk.ac.babraham.SeqMonk.DataTypes.DataSet)8 ReadsWithCounts (uk.ac.babraham.SeqMonk.DataTypes.Sequence.ReadsWithCounts)8 Location (uk.ac.babraham.SeqMonk.DataTypes.Genome.Location)7 SplitLocation (uk.ac.babraham.SeqMonk.DataTypes.Genome.SplitLocation)7 ProgressListener (uk.ac.babraham.SeqMonk.DataTypes.ProgressListener)7 HiCHitCollection (uk.ac.babraham.SeqMonk.DataTypes.Sequence.HiCHitCollection)7 IOException (java.io.IOException)6 File (java.io.File)5 Hashtable (java.util.Hashtable)5 HiCDataStore (uk.ac.babraham.SeqMonk.DataTypes.HiCDataStore)5 QuantitationStrandType (uk.ac.babraham.SeqMonk.DataTypes.Sequence.QuantitationStrandType)5 PairedDataSet (uk.ac.babraham.SeqMonk.DataTypes.PairedDataSet)4