fastq.c
/***************************************************************************
 *  Use auto-c2man to generate a man page from this comment
 *
 *  Library:
 *      #include <biolibc/fastq.h>
 *      -lbiolibc -lxtend
 *
 *  Description:
 *      Compare the read names of two FASTQ reads.  This is useful when
 *      processing paired-end data, which must be kept in-sync.  I.e.
 *      if a sequence if removed from a 5' file, the same sequence should
 *      be removed from the 3' file whether or not it meets quality
 *      minimums.
 *  
 *  Arguments:
 *      read1, read2    FASTQ reads to compare   
 *
 *  Returns:
 *      0 if read1 and read2 have the same name
 *      < 0 if read1 name is lexically less than read2 name
 *      > 0 if read1 name is lexically greater than read2 name
 *
 *  Examples:
 *      s1 = bl_fastq_read(&fastq_rec[0], tp->instream1);
 *      s2 = bl_fastq_read(&fastq_rec[1], tp->instream2);
 *      if ( (s1 == BL_READ_OK) && (s2 == BL_READ_OK) )
 *      {
 *          if ( bl_fastq_name_cmp(&fastq_rec[0], &fastq_rec[1]) != 0 )
 *          {
 *              fprintf(stderr, "fastq-trim: Paired files out of sync.\n");
 *              trim_close_files(tp);
 *              exit(EX_DATAERR);
 *          }
 *          ...
 *      }
 *
 *  See also:
 *      bl_fastq_read(3)
 *
 *  History: 
 *  Date        Name        Modification
 *  2022-01-02  Jason Bacon Begin
 ***************************************************************************/
Use auto-c2man to generate a man page from this comment
Library:
#include 
-lbiolibc -lxtend

Compare the read names of two FASTQ reads.  This is useful when
processing paired-end data, which must be kept in-sync.

read1, read2    FASTQ reads to compare

0 if read1 and read2 have the same name
< 0 if read1 name is lexically less than read2 name
> 0 if read1 name is lexically greater than read2 name





Date        Name        Modification
2022-01-02  Jason Bacon Begin
Use auto - c2man to generate a man page from this comment Library : #include - lbiolibc - lxtend Compare the read names of two FASTQ reads . This is useful when processing paired - end data which must be kept in - sync . read1 read2 FASTQ reads to compare 0 if read1 and read2 have the same name < 0 if read1 name is lexically less than read2 name > 0 if read1 name is lexically greater than read2 name Date Name Modification 2022 - 01 - 02 Jason Bacon Begin
size_t  bl_fastq_name_cmp(bl_fastq_t *read1, bl_fastq_t *read2)
{
    char    *p1 = strchr(BL_FASTQ_DESC(read1), ' ');
    char    *p2 = strchr(BL_FASTQ_DESC(read2), ' ');
    int     save_p1, save_p2, status;
    save_p1 = *p1;
    save_p2 = *p2;
    *p1 = *p2 = '\0';
    status = strcmp(BL_FASTQ_DESC(read1), BL_FASTQ_DESC(read2));
    *p1 = save_p1;
    *p2 = save_p2;
    return status;
}
size_t bl_fastq_name_cmp ( bl_fastq_t * read1 , bl_fastq_t * read2 ) { char * p1 = strchr ( BL_FASTQ_DESC ( read1 ) , ' ' ) ; char * p2 = strchr ( BL_FASTQ_DESC ( read2 ) , ' ' ) ; int save_p1 , save_p2 , status ; save_p1 = * p1 ; save_p2 = * p2 ; * p1 = * p2 = ' \0 ' ; status = strcmp ( BL_FASTQ_DESC ( read1 ) , BL_FASTQ_DESC ( read2 ) ) ; * p1 = save_p1 ; * p2 = save_p2 ; return status ; }
Use auto-c2man to generate a man page from this comment
  Library:
      #include <biolibc/fastq.h>
      -lbiolibc -lxtend
Use auto - c2man to generate a man page from this comment Library : #include <biolibc / fastq . h > - lbiolibc - lxtend
// FIXME: This is a hack based on test data.  Find out how to  // properly compare names in arbitrary FASTQ files // Description up to first space char is the same for R1 and R2 files // Temporarily null-terminate descriptions at first space char // Not thread-safe