add comment
This commit is contained in:
parent
a533f12f7c
commit
e2cd563a78
1 changed files with 20 additions and 20 deletions
40
oblong.c
40
oblong.c
|
@ -680,26 +680,26 @@ void get_fasta_dims ( int * mync , int * mynt )
|
|||
char c ;
|
||||
int curnt = 0 , curnc = 0 , atnc ;
|
||||
char * nampt = strsp ;
|
||||
while ( !feof ( inp ) && i != '>' ) i = getc ( inp ) ;
|
||||
if ( i != '>' ) {
|
||||
while ( !feof ( inp ) && i != '>' ) i = getc ( inp ) ; //没读到 EOF 并且不是 > 继续,直到读到 >
|
||||
if ( i != '>' ) { //读到最后没有 > 报错
|
||||
fprintf ( stderr , "\nError reading fasta file --expected taxon name\n" ) ;
|
||||
errout ( 1 , NULL ) ; }
|
||||
while ( !feof ( inp ) ) {
|
||||
fscanf ( inp , " %s" , nampt ) ;
|
||||
while ( !feof ( inp ) ) { //没读到 EOF 不停
|
||||
fscanf ( inp , " %s" , nampt ) ; //从 inp 读到 nampt
|
||||
i = 0 ;
|
||||
++ curnt ;
|
||||
if ( curnt == 1)
|
||||
if ( curnt == 1) //第一次
|
||||
while ( 1 ) {
|
||||
fscanf ( inp , " %c" , &c ) ;
|
||||
if ( c == '>' || feof ( inp ) ) break ;
|
||||
++ curnc ; }
|
||||
else {
|
||||
if ( c == '>' || feof ( inp ) ) break ; //读到 > 或者 EOF
|
||||
++ curnc ; } // 读到 > 或者 EOF curnc ++
|
||||
else { //第二次及之后
|
||||
atnc = 0 ;
|
||||
while ( 1 ) {
|
||||
fscanf ( inp , " %c" , &c ) ;
|
||||
if ( c == '>' || feof ( inp ) ) break ;
|
||||
++ atnc ; }
|
||||
if ( atnc != curnc ) {
|
||||
if ( atnc != curnc ) { //到最后比较
|
||||
fprintf ( stderr , "\nError reading fasta file --it seems not to be aligned\n" ) ;
|
||||
errout ( 1 , NULL ) ; }}}
|
||||
* mync = curnc ;
|
||||
|
@ -715,22 +715,22 @@ void read_multifiles ( void )
|
|||
int atfile = 0 , numfiles = 0 ;
|
||||
char ** taxnam ;
|
||||
double prop , secs , prevprop ;
|
||||
clock_t beg , end ;
|
||||
beg = clock () ;
|
||||
clock_t beg , end ; // 定义起始时间
|
||||
beg = clock () ; //计算时间
|
||||
errout ( ( tmpp = fopen ( "oblong.tmp" , "wb" ) ) == NULL , "Cannot open temporary file, \"oblong.tmp\"" ) ;
|
||||
// Find out total NT and total NC
|
||||
multinp = inp ;
|
||||
maskinit ( ) ;
|
||||
taxnam = ( char ** ) myalloc ( MAXMULTITAXA * sizeof ( char * ) ) ;
|
||||
fscanf ( inp , " %s" , nampt ) ;
|
||||
while ( !feof ( multinp ) ) {
|
||||
++ numfiles ;
|
||||
if ( ( inp = fopen ( nampt , "rb" ) ) == NULL ) {
|
||||
maskinit ( ) ; //maskinit 函数
|
||||
taxnam = ( char ** ) myalloc ( MAXMULTITAXA * sizeof ( char * ) ) ; //default MAXMULTITAXA 1000 L32
|
||||
fscanf ( inp , " %s" , nampt ) ; //FILE * inp = NULL 读入文件到 nampt
|
||||
while ( !feof ( multinp ) ) { //feof 如果 EOF 返回非 0,没有EOF 返回 0,
|
||||
++ numfiles ; //numfiles 初始为 0
|
||||
if ( ( inp = fopen ( nampt , "rb" ) ) == NULL ) { // r readbale b binary 二进制可以防止 Windows下文件问题
|
||||
fprintf ( stderr , "\nCannot open file %s (from list of multiple files)\n" , nampt ) ;
|
||||
exit ( 0 ) ; }
|
||||
if ( reporttoscreen )
|
||||
if ( reporttoscreen ) // L60: default 1 L309:0
|
||||
fprintf ( stderr , "%cChecking input file %3i %-40s" , reportheader , numfiles , nampt ) ;
|
||||
if ( fasta ) get_fasta_dims ( &nc , &nt ) ;
|
||||
if ( fasta ) get_fasta_dims ( &nc , &nt ) ; //get nc and nt
|
||||
else {
|
||||
i = fscanf ( inp , " %i %i" , &nt , &nc ) ;
|
||||
if ( i < 2 ) {
|
||||
|
@ -750,7 +750,7 @@ void read_multifiles ( void )
|
|||
if ( !strcmp ( nampt , taxnam[ i ] ) ) matched = i ;
|
||||
if ( matched < 0 ) {
|
||||
errout( curnt >= MAXMULTITAXA , "Sorry, cannot deal with so many distinct taxon names (change MAXMULTITAXA and recompile)" ) ;
|
||||
taxnam [ curnt ] = ( char * ) myalloc ( MAXNAMELEN * sizeof ( char ) ) ;
|
||||
taxnam [ curnt ] = ( char * ) myalloc ( MAXNAMELEN * sizeof ( char ) ) ; //MAXNAMELEN = 1000 default
|
||||
strcpy ( taxnam [ curnt ++ ] , nampt ) ; }
|
||||
if ( fasta ) -- nampt ;
|
||||
for ( b = 0 ; b < nc ; ++ b ) {
|
||||
|
|
Loading…
Reference in a new issue