hmmer-3.3/easel/esl_sqio.c
/* Write an uglified FASTA file to a stream.
 * Also, remember where the start of the descline and first
 * seq line are, in sq->{roff,doff}. We'll compare against
 * what the input function thinks these locations are.
 */
Write an uglified FASTA file to a stream.
Also, remember where the start of the descline and first
seq line are, in sq->{roff,doff}. We'll compare against
what the input function thinks these locations are.
Write an uglified FASTA file to a stream . Also remember where the start of the descline and first seq line are in sq - > { roff doff } . We ' ll compare against what the input function thinks these locations are .
static void
write_ugly_fasta(ESL_RANDOMNESS *r, FILE *fp, ESL_SQ *sq)
{
  char buf[61];
  int  pos;
  sq->roff = ftello(fp);
  fputc('>', fp);
  while (esl_rnd_Roll(r, 10) == 0) fputc(' ', fp);
  fprintf(fp, "%s", sq->name);
  while (esl_rnd_Roll(r, 10) == 0) fputc(' ', fp);
  if (sq->desc[0] != 0) fprintf(fp, " %s", sq->desc);
  fputc('\n', fp);
  sq->doff = ftello(fp);             
  buf[60] = '\0';
  for (pos = 1; pos <= sq->n; pos+=60)
    {
      while (esl_rnd_Roll(r, 10) == 0) fputc(' ', fp);
      esl_abc_TextizeN(sq->abc, sq->dsq+pos, 60, buf);
      fputs(buf, fp);
      fputc('\n', fp);
    }
  while (esl_rnd_Roll(r, 10) == 0) fputc('\n', fp);
  sq->eoff = ftello(fp) - 1;
  if (sq->n == 0) sq->doff = sq->eoff+1;  
}
static void write_ugly_fasta ( ESL_RANDOMNESS * r , FILE * fp , ESL_SQ * sq ) { char buf [ 61 ] ; int pos ; sq -> roff = ftello ( fp ) ; fputc ( ' ' , fp ) ; while ( esl_rnd_Roll ( r , 10 ) == 0 ) fputc ( ' ' , fp ) ; fprintf ( fp , " " , sq -> name ) ; while ( esl_rnd_Roll ( r , 10 ) == 0 ) fputc ( ' ' , fp ) ; if ( sq -> desc [ 0 ] != 0 ) fprintf ( fp , " " , sq -> desc ) ; fputc ( ' \n ' , fp ) ; sq -> doff = ftello ( fp ) ; buf [ 60 ] = ' \0 ' ; for ( pos = 1 ; pos <= sq -> n ; pos += 60 ) { while ( esl_rnd_Roll ( r , 10 ) == 0 ) fputc ( ' ' , fp ) ; esl_abc_TextizeN ( sq -> abc , sq -> dsq + pos , 60 , buf ) ; fputs ( buf , fp ) ; fputc ( ' \n ' , fp ) ; } while ( esl_rnd_Roll ( r , 10 ) == 0 ) fputc ( ' \n ' , fp ) ; sq -> eoff = ftello ( fp ) - 1 ; if ( sq -> n == 0 ) sq -> doff = sq -> eoff + 1 ; }
Write an uglified FASTA file to a stream.
Write an uglified FASTA file to a stream .
// Deals with an edge case, an L=0 seq with multiple newlines.