Skip to content
Commits on Source (2)
<img src="logo.png" alt="phyx logo" width=150px/>
**phyx** performs phylogenetics analyses on trees and sequences. See installation instructions for Linux and Mac including any dependencies on the wiki [here](https://github.com/FePhyFoFum/phyx/wiki/Installation) or below. A list of the current programs with examples can be found [here](https://github.com/FePhyFoFum/phyx/wiki/Program-list).
**phyx** performs phylogenetics analyses on trees and sequences. See installation instructions for Linux and Mac including any dependencies on the wiki [here](https://github.com/FePhyFoFum/phyx/wiki/Installation) or below. A list of the current programs with examples can be found [here](https://github.com/FePhyFoFum/phyx/wiki/Program-list). See a brief overview [here](https://twitter.com/i/moments/1067839564927008769).
Authors: Joseph W. Brown, Joseph F. Walker, and Stephen A. Smith
......@@ -62,6 +62,7 @@ If you want to install it so it is available anywhere in your system, do:
### Install with HPC GCC (advanced instructions)
1. Install gcc and gfortran. Download gcc-6.2-bin.tar.gz or more recent from http://hpc.sourceforge.net/. Install with:
sudo tar -xvf gcc-6.2-bin.tar -C /
......@@ -105,7 +106,7 @@ These instructions work for most ubuntu versions as well as debian.
1. Install general dependencies:
sudo apt-get install git autotools-dev autoconf automake cmake libtool liblapack-dev libatlas-cpp-0.6-dev libnlopt-dev libnlopt0
sudo apt-get install git autotools-dev autoconf automake cmake libtool liblapack-dev libatlas-cpp-0.6-dev libnlopt-cxx-dev libnlopt-dev libnlopt0
2. Clone the phyx repo (if you haven't already):
......
......@@ -48,18 +48,18 @@
\@writefile{toc}{\contentsline {subsection}{pxmrcaname}{6}{section*.23}}
\@writefile{toc}{\contentsline {subsection}{pxnj}{6}{section*.24}}
\@writefile{toc}{\contentsline {subsection}{pxnw}{6}{section*.25}}
\@writefile{toc}{\contentsline {subsection}{pxrecode}{6}{section*.26}}
\@writefile{toc}{\contentsline {subsection}{pxrecode}{7}{section*.26}}
\@writefile{toc}{\contentsline {subsection}{pxrevcomp}{7}{section*.27}}
\@writefile{toc}{\contentsline {subsection}{pxrls}{7}{section*.28}}
\@writefile{toc}{\contentsline {subsection}{pxrlt}{7}{section*.29}}
\@writefile{toc}{\contentsline {subsection}{pxrms}{7}{section*.30}}
\@writefile{toc}{\contentsline {subsection}{pxrmt}{7}{section*.31}}
\@writefile{toc}{\contentsline {subsection}{pxrmt}{8}{section*.31}}
\@writefile{toc}{\contentsline {subsection}{pxrr}{8}{section*.32}}
\@writefile{toc}{\contentsline {subsection}{pxs2fa and pxs2phy and pxs2nex}{8}{section*.33}}
\@writefile{toc}{\contentsline {subsection}{pxseqgen}{8}{section*.34}}
\@writefile{toc}{\contentsline {subsection}{pxsstat}{9}{section*.35}}
\@writefile{toc}{\contentsline {subsection}{pxstrec}{9}{section*.36}}
\@writefile{toc}{\contentsline {subsection}{pxsw}{9}{section*.37}}
\@writefile{toc}{\contentsline {subsection}{pxsw}{10}{section*.37}}
\@writefile{toc}{\contentsline {subsection}{pxt2new}{10}{section*.38}}
\@writefile{toc}{\contentsline {subsection}{pxtlate}{10}{section*.39}}
\@writefile{toc}{\contentsline {subsection}{pxtscale}{10}{section*.40}}
......
......@@ -78,8 +78,8 @@ Phyx will track the programs and commands input to a file called ``phyx.logfile'
By optionally reading from \texttt{stdin} and writing to \texttt{stout}, Phyx provides the ability of programs to pipe the output of one into another, allowing for an efficient processing of data. An example of this would be to if someone wanted to perform a codon alignment, then remove all columns with missing data, and finally make a rough neighbor-joining tree.
\begin{flushleft}
\begin{verbatim}
pxaa2cdn -a amino_acid_alignment -n nucleotide_alignment || pxclsq -p 1.0
|| pxnj -n 3 -o output_tree_file
pxaa2cdn -a amino_acid_alignment -n nucleotide_alignment | pxclsq -p 1.0
| pxnj -n 3 -o output_tree_file
\end{verbatim}
\end{flushleft}
......@@ -284,11 +284,11 @@ pxnw -s Alignment.aln
\subsection{pxrecode}
This program will recode a DNA alignment to specify only transitions/tranversions (RY-coding).
This program will recode a nucleotide alignment using any combination of the recognized recoding schemes: R (A$|$G), Y (C$|$T), S (C$|$G), W (A$|$T), M (A$|$C), K (G$|$T), B (C$|$G$|$T), D (A$|$G$|$T), H (A$|$C$|$T), V (A$|$C$|$G). Recoding schemes (e.g., `RY', `SW', `MK', etc.) are specified with the \texttt{-r} argument. If no scheme is provided, RY-coding is used by default.
\begin{flushleft}
\begin{verbatim}
pxrecode -s Nucleotide.fa
pxrecode -r ry -s Nucleotide.fa
\end{verbatim}
\end{flushleft}
......
......@@ -141,9 +141,13 @@ BP_DEP = main_bp.d
#BPSEQ_OBJ = main_bpseq.o
#BPSEQ_DEP = main_bpseq.d
2NEW_SRC = main_t2new.cpp
2NEW_OBJ = main_t2new.o
2NEW_DEP = main_t2new.d
T2NEW_SRC = main_t2new.cpp
T2NEW_OBJ = main_t2new.o
T2NEW_DEP = main_t2new.d
T2NEX_SRC = main_t2nex.cpp
T2NEX_OBJ = main_t2nex.o
T2NEX_DEP = main_t2nex.d
RR_SRC = main_rr.cpp
RR_OBJ = main_rr.o
......@@ -331,7 +335,7 @@ RATE_DEPS += \
# $(CXX) $(OPT_FLAGS) -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
PROGS := pxmrca pxmrcacut pxmrcaname pxconsq pxbdsim pxlstr pxlssq pxupgma pxclsq pxcltr pxs2fa pxs2phy pxs2nex pxfqfilt pxrevcomp pxnw pxsw pxboot pxcat pxsstat pxrecode pxbp pxt2new pxrr pxaa2cdn pxtlate pxrms pxrmt pxtrt pxrmk pxnj pxlog pxvcf2fa pxrlt pxrls pxtscale pxstrec pxseqgen pxssort pxcontrates pxtcol pxtcomb pxssort pxcolt $(NLOPT_PROGRAMS)
PROGS := pxmrca pxmrcacut pxmrcaname pxconsq pxbdsim pxlstr pxlssq pxupgma pxclsq pxcltr pxs2fa pxs2phy pxs2nex pxfqfilt pxrevcomp pxnw pxsw pxboot pxcat pxsstat pxrecode pxbp pxt2new pxt2nex pxrr pxaa2cdn pxtlate pxrms pxrmt pxtrt pxrmk pxnj pxlog pxvcf2fa pxrlt pxrls pxtscale pxstrec pxseqgen pxssort pxcontrates pxtcol pxtcomb pxssort pxcolt $(NLOPT_PROGRAMS)
# All Target
# pxnni not included for now
......@@ -477,9 +481,13 @@ pxbp: $(CPP_OBJS) $(BP_OBJ)
# @echo 'building pxbpsq'
# $(CXX) -o "pxbpsq" $(OPT_FLAGS) $(BPSEQ_OBJ) $(CPP_OBJS)
pxt2new: $(CPP_OBJS) $(2NEW_OBJ)
pxt2new: $(CPP_OBJS) $(T2NEW_OBJ)
@echo 'building pxt2new'
$(CXX) -o "pxt2new" $(OPT_FLAGS) $(2NEW_OBJ) $(CPP_OBJS)
$(CXX) -o "pxt2new" $(OPT_FLAGS) $(T2NEW_OBJ) $(CPP_OBJS)
pxt2nex: $(CPP_OBJS) $(T2NEX_OBJ)
@echo 'building pxt2nex'
$(CXX) -o "pxt2nex" $(OPT_FLAGS) $(T2NEX_OBJ) $(CPP_OBJS)
pxrr: $(CPP_OBJS) $(RR_OBJ)
@echo 'building pxrr'
......
......@@ -59,7 +59,7 @@ void CompTest::read_seqs () {
// count occurrences of each valid character state in current sequence
void CompTest::count_chars (string& seq) {
int sum = 0;
std::transform(seq.begin(), seq.end(), seq.begin(), ::toupper);
seq = string_to_upper(seq);
vector <int> icounts(seq_chars_.length(), 0);
for (unsigned int i = 0; i < seq_chars_.length(); i++) {
......
......@@ -17,14 +17,14 @@ using namespace std;
#include "seq_reader.h"
#include "concat.h"
SequenceConcatenater::SequenceConcatenater (string & seqf):num_partitions_(0),
SequenceConcatenater::SequenceConcatenater (string & seqf, bool & toupcase):num_partitions_(0),
num_char_(0), num_taxa_(0), ft_(0) {
toupcase_ = toupcase;
read_sequences(seqf);
}
SequenceConcatenater::SequenceConcatenater ():num_partitions_(0), num_char_(0),
num_taxa_(0), ft_(0) {
num_taxa_(0), ft_(0), interleave_(false) {
}
void SequenceConcatenater::read_sequences (string & seqf) {
......@@ -43,8 +43,9 @@ void SequenceConcatenater::read_sequences (string & seqf) {
num_taxa_ = stoi(fileDim[0]);
num_char_ = stoi(fileDim[1]);
} else {
get_nexus_dimensions(seqf, num_taxa_, num_char_);
get_nexus_dimensions_file(seqf, num_taxa_, num_char_, interleave_);
}
if (!interleave_) {
while (read_next_seq_from_stream(*pios, ft_, retstring, seq)) {
length = (int)seq.get_sequence().size();
if (length != num_char_) {
......@@ -53,6 +54,9 @@ void SequenceConcatenater::read_sequences (string & seqf) {
delete pios;
exit(1);
}
if (toupcase_) {
seq.set_sequence(seq.seq_to_upper());
}
seqs_.push_back(seq);
counter++;
}
......@@ -62,6 +66,15 @@ void SequenceConcatenater::read_sequences (string & seqf) {
delete pios;
exit(1);
}
} else {
seqs_ = read_interleaved_nexus_file(seqf, num_taxa_, num_char_);
if (toupcase_) {
for (int i = 0; i < num_taxa_; i++) {
seqs_[i].set_sequence(seqs_[i].seq_to_upper());
}
}
}
} else if (ft_ == 2) { // fasta
bool first = true;
while (read_next_seq_from_stream(*pios, ft_, retstring, seq)) {
......@@ -77,10 +90,16 @@ void SequenceConcatenater::read_sequences (string & seqf) {
length = curr;
first = false;
}
if (toupcase_) {
seq.set_sequence(seq.seq_to_upper());
}
seqs_.push_back(seq);
counter++;
}
// fasta has a trailing one
if (toupcase_) {
seq.set_sequence(seq.seq_to_upper());
}
seqs_.push_back(seq);
counter++;
num_taxa_ = counter;
......
......@@ -14,6 +14,8 @@ private:
int num_char_;
int num_taxa_;
int ft_;
bool toupcase_;
bool interleave_;
string filename_;
vector <int> partition_sizes_;
......@@ -22,7 +24,7 @@ private:
public:
SequenceConcatenater ();
SequenceConcatenater (string & seqf);
SequenceConcatenater (string & seqf, bool & toupcase);
void concatenate (SequenceConcatenater & newSeqs);
int get_sequence_length ();
int get_num_taxa ();
......
......@@ -220,6 +220,14 @@ void LogManipulator::delete_columns (vector <int> const& col_ids) {
parm_columns_ = header;
cols_to_retain.resize(num_cols_);
// check that right end of col_ids is valid (0 already checked upstream)
// vector has been sorted
if (col_ids.back() > num_cols_) {
cout << "Warning: column numbers are 1-indexed. Exiting." << endl;
exit (0);
}
iota(cols_to_retain.begin(), cols_to_retain.end(), 0);
// remove unwanted column indices (reverse order)
......@@ -281,6 +289,14 @@ void LogManipulator::retain_columns (vector <int> const& col_ids) {
vector <string> header = tokenize(line);
int curpars = header.size();
num_cols_ = curpars;
// check that right end of col_ids is valid (0 already checked upstream)
// vector has been sorted
if (col_ids.back() > num_cols_) {
cout << "Warning: column numbers are 1-indexed. Exiting." << endl;
exit (0);
}
parm_columns_ = header;
for (int i=0; i < num_cols_retain_; i++) {
(*poos_) << header[cols_to_retain[i]];
......@@ -311,6 +327,7 @@ void LogManipulator::retain_columns (vector <int> const& col_ids) {
}
}
// not yet used?
void LogManipulator::sample_parameters () {
if (!files_.empty()) {
ntotal_samples_ = 0;
......
......@@ -434,7 +434,6 @@ int main(int argc, char * argv[]) {
matrix[i][index] = 1;
if(unrooted==true && trees[i]->getInternalNode(j)->getParent()==trees[i]->getRoot()){
vector<string> rt_nms = trees[i]->getRoot()->get_leave_names();
cout << rt_nms.size() << endl;
set<string> rt_nms_set;
copy(rt_nms.begin(),rt_nms.end(),inserter(rt_nms_set,rt_nms_set.begin()));
set<string> nms_s;
......
......@@ -40,6 +40,7 @@ void print_help() {
cout << " -f, --flistFILE file listing input files (one per line)" << endl;
cout << " -o, --outf=FILE output sequence file, stout otherwise" << endl;
cout << " -p, --partf=FILE output partition file, none otherwise" << endl;
cout << " -u, --uppercase export characters in uppercase" << endl;
cout << " -h, --help display this help and exit" << endl;
cout << " -V, --version display version and exit" << endl;
cout << endl;
......@@ -47,7 +48,7 @@ void print_help() {
cout << "phyx home page: <https://github.com/FePhyFoFum/phyx>" << endl;
}
string versionline("pxcat 0.1\nCopyright (C) 2015 FePhyFoFum\nLicense GPLv3\nwritten by Joseph F. Walker, Joseph W. Brown, Stephen A. Smith (blackrim)");
string versionline("pxcat 0.9\nCopyright (C) 2019 FePhyFoFum\nLicense GPLv3\nwritten by Joseph F. Walker, Joseph W. Brown, Stephen A. Smith (blackrim)");
static struct option const long_options[] =
{
......@@ -55,6 +56,7 @@ static struct option const long_options[] =
{"flist", required_argument, NULL, 'f'},
{"outf", required_argument, NULL, 'o'},
{"partf", required_argument, NULL, 'p'},
{"uppercase", no_argument, NULL, 'u'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
......@@ -67,8 +69,8 @@ int main(int argc, char * argv[]) {
bool outfileset = false;
bool fileset = false;
bool logparts = false;
bool toupcase = false;
vector <string> inputFiles;
SequenceConcatenater result;
char * outf = NULL;
string partf = "";
string listf = "";
......@@ -76,7 +78,7 @@ int main(int argc, char * argv[]) {
while (1) {
int oi = -1;
int curind = optind;
int c = getopt_long(argc, argv, "s:f:o:p:hV", long_options, &oi);
int c = getopt_long(argc, argv, "s:f:o:p:uhV", long_options, &oi);
if (c == -1) {
break;
}
......@@ -114,6 +116,9 @@ int main(int argc, char * argv[]) {
logparts = true;
partf = strdup(optarg);
break;
case 'u':
toupcase = true;
break;
case 'h':
print_help();
exit(0);
......@@ -151,10 +156,11 @@ int main(int argc, char * argv[]) {
poos = &cout;
}
SequenceConcatenater result;
bool first = true;
for (unsigned int i = 0; i < inputFiles.size(); i++) {
SequenceConcatenater curr(inputFiles[i]);
SequenceConcatenater curr(inputFiles[i], toupcase);
if (!first) {
result.concatenate(curr);
} else {
......
......@@ -31,7 +31,7 @@ void print_help() {
cout << "phyx home page: <https://github.com/FePhyFoFum/phyx>" << endl;
}
string versionline("pxconsq 0.1\nCopyright (C) 2013 FePhyFoFum\nLicense GPLv3\nwritten by Stephen A. Smith (blackrim)");
string versionline("pxconsq 0.1\nCopyright (C) 2013 FePhyFoFum\nLicense GPLv3\nwritten by Stephen A. Smith (blackrim), Joseph W. Brown");
static struct option const long_options[] =
{
......
......@@ -30,8 +30,8 @@ void print_help() {
cout << " -r, --rand=INT number of random samples (without replacement) not yet implemented!" << endl;
cout << " -i, --info calculate log file attributes and exit" << endl;
cout << " -c, --columns print out column names (parameter logs only)" << endl;
cout << " -d, --delete=CSL delete columns by index sep by commas (NO SPACES!) (parameter logs only)" << endl;
cout << " -k, --keep=CSL keep only columns by index sep by commas (NO SPACES!) (parameter logs only)" << endl;
cout << " -d, --delete=CSL delete columns by 1-index sep by commas (NO SPACES!) (parameter logs only)" << endl;
cout << " -k, --keep=CSL keep only columns by 1-index sep by commas (NO SPACES!) (parameter logs only)" << endl;
cout << " -x, --seed=INT random number seed, clock otherwise" << endl;
cout << " -v, --verbose make the output more verbose" << endl;
cout << " -h, --help display this help and exit" << endl;
......@@ -195,11 +195,9 @@ int main(int argc, char * argv[]) {
//istream * pios = NULL;
//ifstream * fstr = NULL;
if (outfileset == true) {
ofstr = new ofstream(outf);
poos = ofstr;
} else {
poos = &cout;
if (!tfileset && !pfileset) {
cout << "Must specify a tree file or parameter file. Exiting." << endl;
exit (0);
}
if (tfileset == true && pfileset == true) {
......@@ -207,10 +205,28 @@ int main(int argc, char * argv[]) {
exit (0);
}
if (get_columns && tfileset) {
cout << "Argument 'columns' is not applicable for tree files. Exiting." << endl;
// abort if invalid args
if (tfileset) {
if (get_columns || delete_columns || keep_columns) {
cout << "Column arguments are not applicable for tree files. Exiting." << endl;
exit (0);
}
}
// exit if not 1-indexed (just check first column
if (delete_columns || keep_columns) {
if (col_indices[0] < 1) {
cout << "Warning: column numbers are 1-indexed. Exiting." << endl;
exit (0);
}
}
if (outfileset == true) {
ofstr = new ofstream(outf);
poos = ofstr;
} else {
poos = &cout;
}
//LogManipulator lm (logtype, input_files, pios, poos);
LogManipulator lm (logtype, input_files, poos, verbose);
......@@ -219,22 +235,10 @@ int main(int argc, char * argv[]) {
lm.count();
lm.get_sample_counts();
} else if (get_columns) {
if (tfileset) {
cout << "Argument 'columns' is not applicable for tree files. Exiting." << endl;
exit (0);
}
lm.get_column_names();
} else if (delete_columns) {
if (tfileset) {
cout << "Argument 'delete columns' is not applicable for tree files. Exiting." << endl;
exit (0);
}
lm.delete_columns(col_indices);
} else if (keep_columns) {
if (tfileset) {
cout << "Argument 'keep columns' is not applicable for tree files. Exiting." << endl;
exit (0);
}
lm.retain_columns(col_indices);
} else {
lm.sample(burnin, nthin, nrandom, seed);
......
......@@ -30,7 +30,7 @@ void print_help() {
cout << " -l, --length return the length of the tree" << endl;
cout << " -i, --tiplabels return all tip labels (one per line)" << endl;
cout << " -v, --rtvar return root-to-tip variance" << endl;
cout << " -o, --outf=FILE output tree file, stout otherwise" << endl;
cout << " -o, --outf=FILE output tree stats file, stout otherwise" << endl;
cout << " -h, --help display this help and exit" << endl;
cout << " -V, --version display version and exit" << endl;
cout << endl;
......
......@@ -20,12 +20,24 @@ using namespace std;
#include "log.h"
void print_help() {
cout << "Sequence recoding. Currently only to RY, but more coming." << endl;
cout << "Nucleotide sequence recoding." << endl;
cout << "This will take fasta, fastq, phylip, and nexus inputs." << endl;
cout << endl;
cout << "Usage: pxrecode [OPTION]... " << endl;
cout << endl;
cout << " -s, --seqf=FILE input sequence file, stdin otherwise" << endl;
cout << " -r, --recode=STRING string identifying recoding scheme (default: RY)" << endl;
cout << " Supported recodings (use any valid combination):" << endl;
cout << " R = A|G" << endl;
cout << " Y = C|T" << endl;
cout << " S = C|G" << endl;
cout << " W = A|T" << endl;
cout << " M = A|C" << endl;
cout << " K = G|T" << endl;
cout << " B = C|G|T" << endl;
cout << " D = A|G|T" << endl;
cout << " H = A|C|T" << endl;
cout << " V = A|C|G" << endl;
cout << " -o, --outf=FILE output sequence file, stout otherwise" << endl;
cout << " -h, --help display this help and exit" << endl;
cout << " -V, --version display version and exit" << endl;
......@@ -39,6 +51,7 @@ string versionline("pxrecode 0.1\nCopyright (C) 2013 FePhyFoFum\nLicense GPLv3\n
static struct option const long_options[] =
{
{"seqf", required_argument, NULL, 's'},
{"recode", required_argument, NULL, 'r'},
{"outf", required_argument, NULL, 'o'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
......@@ -51,11 +64,12 @@ int main(int argc, char * argv[]) {
bool outfileset = false;
bool fileset = false;
string recodescheme = "";
char * outf = NULL;
char * seqf = NULL;
while (1) {
int oi = -1;
int c = getopt_long(argc, argv, "s:o:hV", long_options, &oi);
int c = getopt_long(argc, argv, "s:r:o:hV", long_options, &oi);
if (c == -1) {
break;
}
......@@ -65,6 +79,9 @@ int main(int argc, char * argv[]) {
seqf = strdup(optarg);
check_file_exists(seqf);
break;
case 'r':
recodescheme = strdup(optarg);
break;
case 'o':
outfileset = true;
outf = strdup(optarg);
......@@ -85,6 +102,11 @@ int main(int argc, char * argv[]) {
check_inout_streams_identical(seqf, outf);
}
// set default if arg not provided
if (recodescheme == "") {
recodescheme = "RY";
}
istream * pios = NULL;
ostream * poos = NULL;
ifstream * fstr = NULL;
......@@ -108,11 +130,10 @@ int main(int argc, char * argv[]) {
}
}
SequenceRecoder sr;
SequenceRecoder sr (recodescheme);
Sequence seq;
string retstring;
//bool first = true;
int ft = test_seq_filetype_stream(*pios, retstring);
......
......@@ -25,7 +25,7 @@ void print_help() {
cout << endl;
cout << " -t, --treef=FILE input tree file, stdin otherwise" << endl;
cout << " -g, --outgroups=CSL outgroup sep by commas (NO SPACES!)" << endl;
cout << " -r, --ranked outgroups are ordered. root on first one present" << endl;
cout << " -r, --ranked turn on ordering of outgroups. will root on first one present" << endl;
cout << " -u, --unroot unroot the tree" << endl;
cout << " -o, --outf=FILE output tree file, stout otherwise" << endl;
cout << " -s, --silent do not error if outgroup(s) not found" << endl;
......
......@@ -114,6 +114,23 @@ int main(int argc, char * argv[]) {
}
int ft = test_seq_filetype_stream(*pios, retstring);
// extra stuff to deal with possible interleaved nexus
if (ft == 0) {
int ntax, nchar = 0;
bool interleave = false;
get_nexus_dimensions(*pios, ntax, nchar, interleave);
retstring = ""; // ugh hacky
if (!interleave) {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
(*poos) << seq.get_fasta(toupcase);
}
} else {
vector <Sequence> seqs = read_interleaved_nexus (*pios, ntax, nchar);
for (int i = 0; i < seqs.size(); i++) {
(*poos) << seqs[i].get_fasta(toupcase);
}
}
} else {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
(*poos) << seq.get_fasta(toupcase);
}
......@@ -121,6 +138,8 @@ int main(int argc, char * argv[]) {
if (ft == 2) {
(*poos) << seq.get_fasta(toupcase);
}
}
if (fileset) {
fstr->close();
delete pios;
......
......@@ -116,15 +116,30 @@ int main(int argc, char * argv[]) {
}
int ft = test_seq_filetype_stream(*pios, retstring);
// extra stuff to deal with possible interleaved nexus
// yes, nexus to nexus conversion is silly. ut could go from interleaved to non-interleaved
if (ft == 0) {
int ntax, nchar = 0;
bool interleave = false;
get_nexus_dimensions(*pios, ntax, nchar, interleave);
retstring = ""; // ugh hacky
if (!interleave) {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
seqs.push_back(seq);
}
} else {
seqs = read_interleaved_nexus (*pios, ntax, nchar);
}
} else {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
seqs.push_back(seq);
}
// fasta has a trailing one
if (ft == 2) {
seqs.push_back(seq);
}
}
write_nexus_alignment(seqs, toupcase, poos);
if (fileset == true) {
......
......@@ -116,6 +116,20 @@ int main(int argc, char * argv[]) {
}
int ft = test_seq_filetype_stream(*pios, retstring);
// extra stuff to deal with possible interleaved nexus
if (ft == 0) {
int ntax, nchar = 0;
bool interleave = false;
get_nexus_dimensions(*pios, ntax, nchar, interleave);
retstring = ""; // ugh hacky
if (!interleave) {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
seqs.push_back(seq);
}
} else {
seqs = read_interleaved_nexus (*pios, ntax, nchar);
}
} else {
while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
seqs.push_back(seq);
}
......@@ -123,6 +137,8 @@ int main(int argc, char * argv[]) {
if (ft == 2) {
seqs.push_back(seq);
}
}
write_phylip_alignment(seqs, toupcase, poos);
if (fileset) {
fstr->close();
......