From: TZVanaalten Date: Thu, 20 Jul 2017 11:42:48 +0000 (+0100) Subject: JAL-2616 remove statistical analysis from AlignFrame X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6aba8db32fcc88b6263b4dd8cd305a0bb3fa1ae5;p=jalview.git JAL-2616 remove statistical analysis from AlignFrame --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 44d96ca..74e7652 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -87,9 +87,7 @@ import jalview.jbgui.GAlignFrame; import jalview.schemes.ColourSchemeI; import jalview.schemes.ColourSchemes; import jalview.schemes.ResidueColourScheme; -import jalview.schemes.ResidueProperties; import jalview.schemes.TCoffeeColourScheme; -import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.ViewportRanges; @@ -125,9 +123,7 @@ import java.awt.event.MouseEvent; import java.awt.print.PageFormat; import java.awt.print.PrinterJob; import java.beans.PropertyChangeEvent; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.FileWriter; import java.io.PrintWriter; import java.net.URL; @@ -139,7 +135,6 @@ import java.util.HashMap; import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.Scanner; import java.util.Vector; import javax.swing.JCheckBoxMenuItem; @@ -4680,159 +4675,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, annotation.setHMM(hmm); isAnnotation = true; - BufferedReader input = new BufferedReader(new FileReader( - "H:/Desktop/Distributions/BadAlignment-8.csv")); - String line = input.readLine(); - - while (!("".equals(line)) && line != null) - { - Scanner scanner = new Scanner(line); - if (scanner.hasNext()) - { - scanner.useDelimiter(","); - String value = scanner.next(); - - distribution.put(value, scanner.nextFloat()); - line = input.readLine(); - } - } - - - AlignmentI alignment = getViewport().getAlignment(); - Integer alpha = 0; - final int AMINO = 0; - final int DNA = 1; - final int RNA = 2; - if ("amino".equals(hmm.getAlphabetType())) - { - alpha = AMINO; - } - else if ("DNA".equals(hmm.getAlphabetType())) - { - alpha = DNA; - } - else if ("RNA".equals(hmm.getAlphabetType())) - { - alpha = RNA; - } - - - int size = 0; - - for (int l = 1; l < hmm.getLength() + 1; l++) - { - for (int n = 0; n < alignment.getHeight(); n++) - { - - char character = alignment.getSequenceAt(n) - .getCharAt(hmm.getNodeAlignmentColumn(l)); - character = Character.toUpperCase(character); - - boolean containedD; - boolean containedR; - boolean containedA; - - containedD = ResidueProperties.dnaBackgroundFrequencies - .containsKey(character); - containedA = ResidueProperties.aminoBackgroundFrequencies - .containsKey(character); - containedR = ResidueProperties.rnaBackgroundFrequencies - .containsKey(character); - - if (!Comparison.isGap(character) - && ((alpha == DNA && containedD) - || (alpha == AMINO && containedA))) - { - size++; - } - - } - } - - for (int l = 1; l < hmm.getLength() + 1; l++) - { - for (int n = 0; n < alignment.getHeight(); n++) - { - Double prob; - char character; - character = alignment.getSequenceAt(n) - .getCharAt(hmm.getNodeAlignmentColumn(l)); - character = Character.toUpperCase(character); - boolean containedN; - boolean containedA; - boolean containedR; - - containedN = ResidueProperties.dnaBackgroundFrequencies - .containsKey(character); - containedA = ResidueProperties.aminoBackgroundFrequencies - .containsKey(character); - containedR = ResidueProperties.rnaBackgroundFrequencies - .containsKey(character); - - if (!Comparison.isGap(character) - && ((alpha == DNA && containedN) - || (alpha == AMINO && containedA))) - { - prob = hmm.getMatchEmissionProbability( - hmm.getNodeAlignmentColumn(l), character); - if (prob == 0d) - { - System.out.println("?"); - } - - double freq = 0; - if (alpha == AMINO) - { - freq = ResidueProperties.aminoBackgroundFrequencies - .get(character); - } - if (alpha == DNA) - { - freq = ResidueProperties.dnaBackgroundFrequencies - .get(character); - } - if (alpha == RNA) - { - freq = ResidueProperties.rnaBackgroundFrequencies - .get(character); - } - Double doubleValue = Math.log(prob / freq); - - String value = String.format("%.1f", doubleValue); - if ("-0.0".equals(value)) - { - value = "0.0"; - } - if (distribution.containsKey(value)) - { - float prev = distribution.get(value); - prev = prev + (10000f / size); - distribution.put(value, prev); - } - else - { - distribution.put(value, 10000f / size); - } - - - } - - } - } - - PrintWriter writer = new PrintWriter( - new File( - "H:/Desktop/Distributions/BadAlignment-8.csv")); - for (Map.Entry entry : distribution - .entrySet()) - { - writer.println(entry.getKey() + "," + entry.getValue()); - - } - - writer.close(); - - } else if (FileFormat.Jnet.equals(format)) {