Skip to content
Commits on Source (4)
megan-ce (0.0+git20180524.24e70bf-1) UNRELEASED; urgency=medium
megan-ce (0.0+git20180801.099e956-1) UNRELEASED; urgency=medium
* Initial release (Closes: #<bug>)
TODO: Sort out issue with libsis-hdf5-java which is not (yet) ported to
hdf5 1.10
-- Andreas Tille <tille@debian.org> Fri, 19 May 2017 15:01:42 +0200
Sat Oct 24 08:42:50 CEST 2015
Please also cite: Mitchell et al (2015) NAR 43 D213-D221. The Gene Ontology Consortium (2015) NAR 43 D1049-D1056.
created: Fri Jun 22 10:41:30 CEST 2018
Cite: Mitchell et al (2015) NAR 43 D213-221. The Gene Ontology Consortium (2015) NAR 43 D1049-1056.
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
created: Thu Mar 22 13:23:29 SGT 2018
created: Thu Jun 21 10:43:25 CEST 2018
Cite: Benson et al (2005) NAR 33 D34–38.
\ No newline at end of file
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
This diff is collapsed.
......@@ -47,7 +47,7 @@ public class ActiveMatches {
for (int i = 0; i < readBlock.getNumberOfAvailableMatchBlocks(); i++) {
final IMatchBlock matchBlock = readBlock.getMatchBlock(i);
if (!matchBlock.isIgnore() && !TaxonomyData.isTaxonDisabled(matchBlock.getTaxonId()) && matchBlock.getBitScore() >= minScore && matchBlock.getExpected() <= maxExpected &&
(minPercentIdentity == 0 || matchBlock.getPercentIdentity() >= minPercentIdentity)) {
(matchBlock.getPercentIdentity() == 0 || matchBlock.getPercentIdentity() >= minPercentIdentity)) {
if (classificationName == null || matchBlock.getId(classificationName) > 0)
activeMatchesForClassification.set(i);
}
......
......@@ -150,15 +150,15 @@ public class AssignmentUsingIntervalUnionLCA implements IAssignmentAlgorithm {
}
}
// determine the top-percent threshold on the current segment:
float topPercenThreshold = 0;
float topPercentThreshold = 0;
for (Float value : taxon2BestScore.values()) {
topPercenThreshold = Math.max(topPercenThreshold, value);
topPercentThreshold = Math.max(topPercentThreshold, value);
}
topPercenThreshold = (100.0f - topPercent) / 100.0f * topPercenThreshold;
topPercentThreshold = (100.0f - topPercent) / 100.0f * topPercentThreshold;
// add the segments for all taxa whose best match exceeds the threshold:
for (Integer taxonId : taxon2BestScore.keySet()) {
if (taxon2BestScore.get(taxonId) >= topPercenThreshold) {
if (taxon2BestScore.get(taxonId) >= topPercentThreshold) {
IntervalList intervals = taxa2intervals.get(taxonId);
if (intervals == null) {
intervals = new IntervalList();
......
......@@ -31,8 +31,8 @@ import java.util.HashSet;
import java.util.Set;
/**
* assignment using best hit
* Created by huson on 1/22/16.
* assignment using multi-gene best hit
* Daniel Huson, 2017
*/
public class AssignmentUsingMultiGeneBestHit implements IMultiAssignmentAlgorithm {
private final IntervalTree<IMatchBlock> allMatches;
......
......@@ -67,7 +67,7 @@ public class DataProcessor {
if (doc.isUseContaminantFilter() && doc.getDataTable().hasContaminants()) {
contaminantManager = new ContaminantManager();
contaminantManager.parseTaxonIdsString(doc.getDataTable().getContaminants());
System.err.println(String.format("Using contaminant filter for %,d taxa", contaminantManager.size()));
System.err.println(String.format("Using contaminants profile: %,d input, %,d total", contaminantManager.inputSize(), contaminantManager.size()));
} else
contaminantManager = null;
......@@ -94,16 +94,16 @@ public class DataProcessor {
// step 0: set up classification algorithms
final double minCoveredPercent = doc.getMinPercentReadToCover();
final double minPercentReadToCover = doc.getMinPercentReadToCover();
int numberOfReadsFailedCoveredThreshold = 0;
final IntervalTree<Object> intervals;
if (minCoveredPercent > 0 && doc.isLongReads() || doc.getReadAssignmentMode() == Document.ReadAssignmentMode.alignedBases)
if (minPercentReadToCover > 0 && doc.isLongReads() || doc.getReadAssignmentMode() == Document.ReadAssignmentMode.alignedBases)
intervals = new IntervalTree<>();
else
intervals = null;
if (minCoveredPercent > 0)
System.err.println(String.format("Minimum percentage of read to be covered: %.1f%%", minCoveredPercent));
if (minPercentReadToCover > 0)
System.err.println(String.format("Minimum percentage of read to be covered: %.1f%%", minPercentReadToCover));
final boolean usingLongReadAlgorithm = (doc.getLcaAlgorithm() == Document.LCAAlgorithm.longReads);
......@@ -195,7 +195,7 @@ public class DataProcessor {
final ReadBlockRMA6 mateReadBlock;
if (doMatePairs) {
try (RMA6File RMA6File = new RMA6File(doc.getMeganFile().getFileName(), "r")) {
String[] matchClassificationNames = RMA6File.getHeaderSectionRMA6().getMatchClassNames();
final String[] matchClassificationNames = RMA6File.getHeaderSectionRMA6().getMatchClassNames();
mateReadBlock = new ReadBlockRMA6(doc.getBlastMode(), true, matchClassificationNames);
}
} else
......@@ -237,7 +237,7 @@ public class DataProcessor {
if (referenceCoverFilter != null)
referenceCoverFilter.applyFilter(readBlock, activeMatchesForTaxa);
if (minCoveredPercent == 0 || ensureCovered(minCoveredPercent, readBlock, activeMatchesForTaxa, intervals)) {
if (minPercentReadToCover == 0 || ensureCovered(minPercentReadToCover, readBlock, activeMatchesForTaxa, intervals)) {
if (doMatePairs && readBlock.getMateUId() > 0) {
mateReader.seek(readBlock.getMateUId());
mateReadBlock.read(mateReader, false, true, doc.getMinScore(), doc.getMaxExpected());
......@@ -427,7 +427,7 @@ public class DataProcessor {
for (int m = activeMatches.nextSetBit(0); m != -1; m = activeMatches.nextSetBit(m + 1)) {
final IMatchBlock matchBlock = readBlock.getMatchBlock(m);
if (Math.abs(matchBlock.getAlignedQueryStart() - matchBlock.getAlignedQueryStart()) >= lengthToCover)
if (Math.abs(matchBlock.getAlignedQueryEnd() - matchBlock.getAlignedQueryStart()) >= lengthToCover)
return true;
if (intervals != null) {
Interval<Object> interval = new Interval<>(matchBlock.getAlignedQueryStart(), matchBlock.getAlignedQueryEnd(), null);
......
......@@ -47,13 +47,13 @@ public class LoadMappingFileCommand extends CommandBase implements ICommand {
*/
@Override
public String getSyntax() {
return "load mapFile=<filename> mapType=<mapType> cName=<name> [parseTaxonNames={false|true}];";
return "load mapFile=<filename> mapType=<" + Basic.toString(IdMapper.MapType.values(), "|") + "> cName=<" + Basic.toString(ClassificationManager.getAllSupportedClassifications(), "|") + "> [parseTaxonNames={false|true}];";
}
/**
* parses the given command and executes it
*
* @param np
* @param npe
* @throws java.io.IOException
*/
@Override
......
......@@ -24,7 +24,6 @@ import jloda.graph.NodeData;
import jloda.graph.NodeSet;
import jloda.phylo.PhyloTree;
import jloda.util.Basic;
import jloda.util.ProgramProperties;
import jloda.util.ResourceManager;
import megan.algorithms.LCAAddressing;
import megan.classification.Classification;
......@@ -122,7 +121,6 @@ public class ClassificationFullTree extends PhyloTree {
}
setInfo(getANode(IdMapper.LOW_COMPLEXITY_ID), IdMapper.LOW_COMPLEXITY_ID);
if (ProgramProperties.get("enable-contaminants", false)) {
if (id2Node.get(IdMapper.CONTAMINANTS_ID) == null) {
Node v = newNode();
addId2Node(IdMapper.CONTAMINANTS_ID, v);
......@@ -131,7 +129,6 @@ public class ClassificationFullTree extends PhyloTree {
newEdge(getRoot(), v);
}
setInfo(getANode(IdMapper.CONTAMINANTS_ID), IdMapper.CONTAMINANTS_ID);
}
if (getName().equals(Classification.Taxonomy)) {
// fix Domains:
......
......@@ -40,10 +40,8 @@ import jloda.util.ProgramProperties;
import megan.classification.Classification;
import megan.classification.ClassificationManager;
import megan.clusteranalysis.gui.*;
import megan.clusteranalysis.indices.CalculateEcologicalIndices;
import megan.clusteranalysis.indices.JensenShannonDivergence;
import megan.clusteranalysis.indices.PearsonDistance;
import megan.clusteranalysis.indices.UniFrac;
import megan.clusteranalysis.indices.BrayCurtisDissimilarity;
import megan.clusteranalysis.indices.DistancesManager;
import megan.clusteranalysis.tree.Distances;
import megan.clusteranalysis.tree.Taxa;
import megan.core.Director;
......@@ -109,7 +107,7 @@ public class ClusterViewer extends JFrame implements IDirectableViewer, IViewerW
private int numberOfNodesUsed = 0;
private String dataType;
private String ecologicalIndex = CalculateEcologicalIndices.BRAYCURTIS;
private String ecologicalIndex = BrayCurtisDissimilarity.NAME;
private boolean locked = false;
private boolean uptodate = true;
......@@ -506,17 +504,7 @@ public class ClusterViewer extends JFrame implements IDirectableViewer, IViewerW
throw new IOException("Too few samples: " + taxa.size());
distances = new Distances(taxa.size());
if (ecologicalIndex.equalsIgnoreCase(UniFrac.UnweightedTaxonomicUniFrac))
numberOfNodesUsed = UniFrac.apply(getParentViewer(), UniFrac.UnweightedTaxonomicUniFrac, 1, distances);
else if (ecologicalIndex.equalsIgnoreCase(UniFrac.WeightedTaxonomicUniFrac))
numberOfNodesUsed = UniFrac.apply(getParentViewer(), UniFrac.WeightedTaxonomicUniFrac, 1, distances);
else if (ecologicalIndex.equalsIgnoreCase(JensenShannonDivergence.SqrtJensenShannonDivergence))
numberOfNodesUsed = JensenShannonDivergence.apply(getParentViewer(), JensenShannonDivergence.SqrtJensenShannonDivergence, distances);
else if (ecologicalIndex.equalsIgnoreCase(PearsonDistance.PEARSON_DISTANCE))
numberOfNodesUsed = PearsonDistance.apply(doc, getParentViewer(), ecologicalIndex, distances);
else
numberOfNodesUsed = CalculateEcologicalIndices.apply(doc, getParentViewer(), ecologicalIndex, distances, !getEcologicalIndex().contains("Goodall"));
DistancesManager.apply(ecologicalIndex, getParentViewer(), distances);
if (distances.replaceNaNByZero()) {
NotificationsInSwing.showWarning(getFrame(), "Undefined distances detected, replaced by 0");
......
......@@ -56,7 +56,7 @@ public class GUIConfiguration {
menuConfig.defineMenu("Rotate", "Rotate Left;Rotate Right;Rotate Up;Rotate Down;");
menuConfig.defineMenu("Expand/Contract", "Expand Horizontal;Contract Horizontal;Expand Vertical;Contract Vertical;");
menuConfig.defineMenu("Options", "Apply Triangulation Test...;|;PCoA Tab;UPGMA Tree Tab;NJ Tree Tab;Network Tab;Matrix Tab;|;Use JSD;Use Bray-Curtis;Use Euclidean;|;" + ProgramProperties.getIfEnabled("enable-unifrac", "Use Unweighted Uniform UniFrac;Use Weighted Uniform UniFrac;|;") + "Use Chi-Square;Use Kulczynski;Use Hellinger;|;Sync;");
menuConfig.defineMenu("Options", "Apply Triangulation Test...;|;PCoA Tab;UPGMA Tree Tab;NJ Tree Tab;Network Tab;Matrix Tab;|;Use JSD;Use Bray-Curtis;Use Euclidean;|;Use Unweighted Uniform UniFrac;Use Weighted Uniform UniFrac;|;Use Chi-Square;Use Kulczynski;Use Hellinger;Use Goodall;|;Sync;");
menuConfig.defineMenu("PCoA", "PCoA Tab;|;PC1 vs PC2;PC1 vs PC3;PC2 vs PC3;PCi vs PCj...;|;PC1 PC2 PC3;PCi PCj PCk...;|;Show Axes;|;Show BiPlot;BiPlot Size...;|;Show TriPlot;TriPlot Size...;");
......
......@@ -21,7 +21,7 @@ package megan.clusteranalysis.commands;
import jloda.gui.commands.ICheckBoxCommand;
import jloda.util.parse.NexusStreamParser;
import megan.clusteranalysis.ClusterViewer;
import megan.clusteranalysis.indices.CalculateEcologicalIndices;
import megan.clusteranalysis.indices.BrayCurtisDissimilarity;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -38,7 +38,7 @@ public class EcologicalIndexBrayCurtisCommand extends CommandBase implements ICh
*/
public boolean isSelected() {
ClusterViewer viewer = getViewer();
return viewer.getEcologicalIndex().equalsIgnoreCase(CalculateEcologicalIndices.BRAYCURTIS);
return viewer.getEcologicalIndex().equalsIgnoreCase(BrayCurtisDissimilarity.NAME);
}
/**
......@@ -56,7 +56,7 @@ public class EcologicalIndexBrayCurtisCommand extends CommandBase implements ICh
* @return description
*/
public String getDescription() {
return "Use Bray-Curtis ecological index";
return "Use Bray-Curtis ecological index (Bray and Curtis, 1957)";
}
/**
......@@ -83,7 +83,7 @@ public class EcologicalIndexBrayCurtisCommand extends CommandBase implements ICh
* @param ev
*/
public void actionPerformed(ActionEvent ev) {
execute("set index=" + CalculateEcologicalIndices.BRAYCURTIS + ";");
execute("set index=" + BrayCurtisDissimilarity.NAME + ";");
}
/**
......
......@@ -21,7 +21,7 @@ package megan.clusteranalysis.commands;
import jloda.gui.commands.ICheckBoxCommand;
import jloda.util.parse.NexusStreamParser;
import megan.clusteranalysis.ClusterViewer;
import megan.clusteranalysis.indices.CalculateEcologicalIndices;
import megan.clusteranalysis.indices.ChiSquareDistance;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -38,7 +38,7 @@ public class EcologicalIndexChiSquareCommand extends CommandBase implements IChe
*/
public boolean isSelected() {
ClusterViewer viewer = getViewer();
return viewer.getEcologicalIndex().equalsIgnoreCase(CalculateEcologicalIndices.CHISSQUARE);
return viewer.getEcologicalIndex().equalsIgnoreCase(ChiSquareDistance.NAME);
}
/**
......@@ -56,7 +56,7 @@ public class EcologicalIndexChiSquareCommand extends CommandBase implements IChe
* @return description
*/
public String getDescription() {
return "Use ChiSquare ecological index";
return "Use ChiSquare ecological index (Lebart et al, 1979)";
}
/**
......@@ -83,7 +83,7 @@ public class EcologicalIndexChiSquareCommand extends CommandBase implements IChe
* @param ev
*/
public void actionPerformed(ActionEvent ev) {
execute("set index=" + CalculateEcologicalIndices.CHISSQUARE + ";");
execute("set index=" + ChiSquareDistance.NAME + ";");
}
/**
......
......@@ -21,9 +21,7 @@ package megan.clusteranalysis.commands;
import jloda.util.ProgramProperties;
import jloda.util.parse.NexusStreamParser;
import megan.clusteranalysis.ClusterViewer;
import megan.clusteranalysis.indices.JensenShannonDivergence;
import megan.clusteranalysis.indices.PearsonDistance;
import megan.clusteranalysis.indices.UniFrac;
import megan.clusteranalysis.indices.DistancesManager;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -33,17 +31,6 @@ import java.awt.event.ActionEvent;
* Daniel Huson, 6.2010
*/
public abstract class EcologicalIndexCommand extends CommandBase {
private final String[] methods;
public EcologicalIndexCommand() {
if (ProgramProperties.get("enable-unifrac", false))
methods = new String[]{"Goodall", "Goodall-Normalized", "ChiSquare", "Kulczynski",
"BrayCurtis", "Hellinger", "Euclidean", "Euclidean-Normalized", UniFrac.UnweightedTaxonomicUniFrac, UniFrac.WeightedTaxonomicUniFrac, PearsonDistance.PEARSON_DISTANCE, JensenShannonDivergence.SqrtJensenShannonDivergence};
else
methods = new String[]{"Goodall", "Goodall-Normalized", "ChiSquare", "Kulczynski",
"BrayCurtis", "Hellinger", "Euclidean", "Euclidean-Normalized", PearsonDistance.PEARSON_DISTANCE, JensenShannonDivergence.SqrtJensenShannonDivergence};
}
/**
* parses the given command and executes it
*
......@@ -52,12 +39,12 @@ public abstract class EcologicalIndexCommand extends CommandBase {
*/
public void apply(NexusStreamParser np) throws Exception {
np.matchIgnoreCase("set index=");
String method = np.getWordMatchesIgnoringCase(methods);
String method = np.getWordMatchesIgnoringCase(DistancesManager.getAllNames());
np.matchIgnoreCase(";");
ClusterViewer viewer = getViewer();
viewer.setEcologicalIndex(method);
execute("sync;");
executeImmediately("sync;");
}
/**
......@@ -78,7 +65,7 @@ public abstract class EcologicalIndexCommand extends CommandBase {
final ClusterViewer viewer = getViewer();
final String method = (String) JOptionPane.showInputDialog(getViewer().getFrame(), "Set Ecological Index", "Set Ecological Index", JOptionPane.QUESTION_MESSAGE,
ProgramProperties.getProgramIcon(), methods, viewer.getEcologicalIndex());
ProgramProperties.getProgramIcon(), DistancesManager.getAllNames(), viewer.getEcologicalIndex());
if (method != null)
executeImmediately("set index=" + method + ";");
}
......
......@@ -21,7 +21,7 @@ package megan.clusteranalysis.commands;
import jloda.gui.commands.ICheckBoxCommand;
import jloda.util.parse.NexusStreamParser;
import megan.clusteranalysis.ClusterViewer;
import megan.clusteranalysis.indices.CalculateEcologicalIndices;
import megan.clusteranalysis.indices.EuclideanDistance;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -38,7 +38,7 @@ public class EcologicalIndexEuclideanCommand extends CommandBase implements IChe
*/
public boolean isSelected() {
ClusterViewer viewer = getViewer();
return viewer.getEcologicalIndex().equalsIgnoreCase(CalculateEcologicalIndices.EUCLIDEAN);
return viewer.getEcologicalIndex().equalsIgnoreCase(EuclideanDistance.NAME);
}
/**
......@@ -83,7 +83,7 @@ public class EcologicalIndexEuclideanCommand extends CommandBase implements IChe
* @param ev
*/
public void actionPerformed(ActionEvent ev) {
execute("set index=" + CalculateEcologicalIndices.EUCLIDEAN + ";");
execute("set index=" + EuclideanDistance.NAME + ";");
}
/**
......
......@@ -21,7 +21,7 @@ package megan.clusteranalysis.commands;
import jloda.gui.commands.ICheckBoxCommand;
import jloda.util.parse.NexusStreamParser;
import megan.clusteranalysis.ClusterViewer;
import megan.clusteranalysis.indices.CalculateEcologicalIndices;
import megan.clusteranalysis.indices.GoodallsDistance;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -38,7 +38,7 @@ public class EcologicalIndexGoodallCommand extends CommandBase implements ICheck
*/
public boolean isSelected() {
ClusterViewer viewer = getViewer();
return viewer.getEcologicalIndex().equalsIgnoreCase(CalculateEcologicalIndices.GOODALL);
return viewer.getEcologicalIndex().equalsIgnoreCase(GoodallsDistance.NAME);
}
/**
......@@ -56,7 +56,7 @@ public class EcologicalIndexGoodallCommand extends CommandBase implements ICheck
* @return description
*/
public String getDescription() {
return "Use Goodall's ecological index";
return "Use Goodall's ecological index (Goodall 1964, 1966)";
}
/**
......@@ -83,7 +83,7 @@ public class EcologicalIndexGoodallCommand extends CommandBase implements ICheck
* @param ev
*/
public void actionPerformed(ActionEvent ev) {
execute("set index=" + CalculateEcologicalIndices.GOODALL + ";");
execute("set index=" + GoodallsDistance.NAME + ";");
}
/**
......