init
This commit is contained in:
parent
7e4aab7d0a
commit
6c0681f97c
1 changed files with 36 additions and 8 deletions
44
main.cpp
44
main.cpp
|
@ -7,13 +7,13 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int datatype=0, ntax, nseq;
|
int intype=0, outype=0, ntax, nseq;
|
||||||
char * fn;
|
char * fn;
|
||||||
|
|
||||||
void show_help(int help_num);
|
void show_help(int help_num);
|
||||||
void read_input(void);
|
void read_input(void);
|
||||||
|
|
||||||
int readPhy(){
|
void readPhy(){
|
||||||
int num=0;
|
int num=0;
|
||||||
cout << "readphy is working, filename is " << fn << endl;
|
cout << "readphy is working, filename is " << fn << endl;
|
||||||
//read file
|
//read file
|
||||||
|
@ -28,9 +28,22 @@ int readPhy(){
|
||||||
ntax = stoi (sntax); nseq = stoi (snseq); // string to int
|
ntax = stoi (sntax); nseq = stoi (snseq); // string to int
|
||||||
cout << "ntax=" << ntax << " nseq=" << nseq << endl;
|
cout << "ntax=" << ntax << " nseq=" << nseq << endl;
|
||||||
//read sequence
|
//read sequence
|
||||||
|
string taxa[ntax], sequ[ntax];
|
||||||
|
//taxa[ntax] = new string*[];
|
||||||
|
int lennum;
|
||||||
|
for(lennum=0;lennum<ntax;lennum++){
|
||||||
|
getline(seqfile,snall);
|
||||||
|
istringstream istr(snall);
|
||||||
|
istr >> taxa[lennum]; istr >> sequ[lennum];
|
||||||
|
cout << "tax" << lennum << " is " << taxa << "; seq" << lennum << " is " << sequ << endl;
|
||||||
|
}
|
||||||
seqfile.close();
|
seqfile.close();
|
||||||
return num;
|
// return taxa;
|
||||||
|
// return sequ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void writeFas(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void procargs (int nargs, char ** arg){ //*arg 视为整体,是字符串指针
|
void procargs (int nargs, char ** arg){ //*arg 视为整体,是字符串指针
|
||||||
|
@ -54,12 +67,18 @@ void procargs (int nargs, char ** arg){ //*arg 视为整体,是字符串指针
|
||||||
switch (*++cp){//先++
|
switch (*++cp){//先++
|
||||||
case 'f':
|
case 'f':
|
||||||
cp++;
|
cp++;
|
||||||
if (*cp=='f') datatype=1;
|
if (*cp=='f') intype=1;
|
||||||
if (*cp=='n') datatype=2;
|
if (*cp=='n') intype=2;
|
||||||
if (*cp=='p') {datatype=3; cout << "datatype is phylip, " << datatype << endl;}
|
if (*cp=='p') {intype=3; cout << "intype is phylip, " << intype << endl;}
|
||||||
break;
|
break;
|
||||||
case 'h': show_help(1); break;
|
case 'h': show_help(1); break;
|
||||||
case 'i': cp++; fn = cp; break;
|
case 'i': cp++; fn = cp; break;
|
||||||
|
case 't':
|
||||||
|
cp++;
|
||||||
|
if (*cp=='f') outype=1;
|
||||||
|
if (*cp=='n') outype=2;
|
||||||
|
if (*cp=='p') {outype=3; cout << "intype is phylip, " << intype << endl;}
|
||||||
|
break;
|
||||||
default: cout << "Unrecognized agruments " << *(arg+i) << endl; exit(0);
|
default: cout << "Unrecognized agruments " << *(arg+i) << endl; exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,12 +94,21 @@ void show_help (int help_num){
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_input (void){
|
void read_input (void){
|
||||||
if (datatype==3) readPhy();
|
if (intype==3) readPhy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_output (void){
|
||||||
|
switch(outype){
|
||||||
|
case '1': ; break;
|
||||||
|
case '2': ; break;
|
||||||
|
case '3': ; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
procargs (argc, argv);
|
procargs (argc, argv);
|
||||||
read_input();
|
read_input();
|
||||||
|
write_output();
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; i++) cout << "argument "<< i << " is " << *(argv+i) << endl;
|
for (i = 0; i < argc; i++) cout << "argument "<< i << " is " << *(argv+i) << endl;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue