[med-svn] [Git][med-team/libncl][upstream] New upstream version 2.1.21+git20180827.c71b264

Andreas Tille gitlab at salsa.debian.org
Tue Dec 4 18:17:12 GMT 2018


Andreas Tille pushed to branch upstream at Debian Med / libncl


Commits:
e20e24f0 by Andreas Tille at 2018-12-04T18:10:33Z
New upstream version 2.1.21+git20180827.c71b264
- - - - -


3 changed files:

- example/normalizer/normalizer.cpp
- example/normalizer/normalizer.h
- example/normalizer/us2ml.cpp


Changes:

=====================================
example/normalizer/normalizer.cpp
=====================================
@@ -67,6 +67,7 @@ std::ostream * gCommonOstream = 0L;
 		RELAXED_PHYLIP_EXPORT_FORMAT,
 		FASTA_EXPORT_FORMAT,
 		NEXML_EXPORT_FORMAT,
+		TREE_NEXML_EXPORT_FORMAT,
 		UNSUPPORTED_EXPORT_FORMAT
 		};
 	ExportFormatEnum gExportFormat = NEXML_EXPORT_FORMAT;
@@ -81,9 +82,10 @@ std::ostream * gCommonOstream = 0L;
 												"phylip",
 												"relaxedphylip",
 												"fasta",
-												"nexml"
+												"nexml",
+												"treenexml"
 												};
-		const unsigned gNumExportFormats = 5;
+		const unsigned gNumExportFormats = 6;
 	
 		NxsString l(s.c_str());
 		NxsString::to_lower(l);
@@ -274,8 +276,12 @@ void processContent(PublicNexusReader & nexusReader, ostream *os, ProcessActions
 			MultiFormatReader::DataFormatType f = MultiFormatReader::NEXUS_FORMAT;
 			if (gExportFormat == NEXUS_EXPORT_FORMAT)
 				exportData(nexusReader, MultiFormatReader::NEXUS_FORMAT, gInterleaveLen, gExportPrefix, gCommonOstream, gTranslatingConventions);
-			else if (gExportFormat == NEXML_EXPORT_FORMAT)
+			else if (gExportFormat == NEXML_EXPORT_FORMAT || gExportFormat == TREE_NEXML_EXPORT_FORMAT ) {
+				if (gExportFormat == TREE_NEXML_EXPORT_FORMAT) {
+					gTranslatingConventions.emitTreesAndTaxaOnly = true;
+				}
 				exportData(nexusReader, MultiFormatReader::NEXML_FORMAT, gInterleaveLen, gExportPrefix, gCommonOstream, gTranslatingConventions);
+			}
 			else if (gExportFormat == PHYLIP_EXPORT_FORMAT) {
 				fullExportPrefix = gExportPrefix;
 				fullExportPrefix.append(".dna");
@@ -550,6 +556,7 @@ void printHelp(ostream & out)
 	out << "            -ephylip  Trees and character data in phylip (could result in multiple output files)\n";
 	out << "            -erelaxedphylip  Trees and character data in relaxed phylip (could result in multiple output files)\n";
 	out << "            -enexml  nexml output (this is also the default)\n";
+	out << "            -etreenexml  nexml output of trees and taxa only\n";
 #endif
 	out << "    -f<format> specifies the input file format expected:\n";
 	out << "            -fnexus     NEXUS (this is also the default)\n";


=====================================
example/normalizer/normalizer.h
=====================================
@@ -22,7 +22,8 @@ class TranslatingConventions {
 			currentTreeIndex(0),
 			currentNodeIndex(0),
 			currentEdgeIndex(0),
-			treatNodeLabelsAsStrings(false) {
+			treatNodeLabelsAsStrings(false),
+			emitTreesAndTaxaOnly(false) {
 			}
 	std::string idPrefix;
 	bool globalIncrementingIDs;
@@ -38,6 +39,7 @@ class TranslatingConventions {
 	unsigned currentNodeIndex;
 	unsigned currentEdgeIndex;
 	bool treatNodeLabelsAsStrings;
+	bool emitTreesAndTaxaOnly;
 };
 
 #endif
\ No newline at end of file


=====================================
example/normalizer/us2ml.cpp
=====================================
@@ -505,32 +505,37 @@ void writeAsNexml(PublicNexusReader & nexusReader, ostream & os, TranslatingConv
 		const NxsTaxaBlock * tb = nexusReader.GetTaxaBlock(t);
 
 		std::vector<const NxsAssumptionsBlock *> assumps;
-		for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(tb); ++j)
-			assumps.push_back(nexusReader.GetAssumptionsBlock(tb, j));
-
+		if (!transConv.emitTreesAndTaxaOnly)
+			{
+			for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(tb); ++j)
+				assumps.push_back(nexusReader.GetAssumptionsBlock(tb, j));
+			}
 		writeOTUS(os, tb, assumps, memo, t);
-
-		const unsigned nCharBlocks = nexusReader.GetNumCharactersBlocks(tb);
-		for (unsigned i = 0; i < nCharBlocks; ++i)
+		if (!transConv.emitTreesAndTaxaOnly)
 			{
-			NxsCharactersBlock * cb = nexusReader.GetCharactersBlock(tb, i);
+			const unsigned nCharBlocks = nexusReader.GetNumCharactersBlocks(tb);
+			for (unsigned i = 0; i < nCharBlocks; ++i)
+				{
+				NxsCharactersBlock * cb = nexusReader.GetCharactersBlock(tb, i);
 
-			assumps.clear();
-			for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(cb); ++j)
-				assumps.push_back(nexusReader.GetAssumptionsBlock(cb, j));
+				assumps.clear();
+				for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(cb); ++j)
+					assumps.push_back(nexusReader.GetAssumptionsBlock(cb, j));
 
-			writeCharacters(os, cb, assumps, memo, nCharBlocksRead++);
+				writeCharacters(os, cb, assumps, memo, nCharBlocksRead++);
+				}
 			}
-
 		const unsigned nTreesBlocks = nexusReader.GetNumTreesBlocks(tb);
 		for (unsigned i = 0; i < nTreesBlocks; ++i)
 			{
 			NxsTreesBlock * cb = nexusReader.GetTreesBlock(tb, i);
 
 			assumps.clear();
-			for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(cb); ++j)
-				assumps.push_back(nexusReader.GetAssumptionsBlock(cb, j));
-
+			if (!transConv.emitTreesAndTaxaOnly)
+				{
+				for (unsigned j= 0; j < nexusReader.GetNumAssumptionsBlocks(cb); ++j)
+					assumps.push_back(nexusReader.GetAssumptionsBlock(cb, j));
+				}
 			writeTrees(os, cb, assumps, memo, nTreeBlocksRead++, transConv.treatNodeLabelsAsStrings);
 			}
 		}



View it on GitLab: https://salsa.debian.org/med-team/libncl/commit/e20e24f0f8c7f8afbc76866ef760a9a3f57719ee

-- 
View it on GitLab: https://salsa.debian.org/med-team/libncl/commit/e20e24f0f8c7f8afbc76866ef760a9a3f57719ee
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20181204/0453b647/attachment-0001.html>


More information about the debian-med-commit mailing list