sam.c
/***************************************************************************
 *  Use auto-c2man to generate a man page from this comment
 *
 *  Library:
 *      #include <sam.h>
 *      -lbiolibc -lxtend
 *
 *  Description:
 *      Compare the positions of a SAM alignment and a GFF feature and
 *      return a status value much like strcmp().  0 is returned if the
 *      alignment and feature overlap.  A value < 0 is returned if the
 *      alignment is entirely "before" the feature, i.e. it is on an
 *      earlier chromosome according to bl_chrom_name_cmp(3), or on the
 *      same chromosome at a lower position.  A value > 0 is returned
 *      if the alignment is entirely "after" the feature, i.e. on a later
 *      chromosome or same chromosome and higher position.
 *
 *      This function is mainly intended for programs that sweep properly
 *      sorted GFF and SAM files locating overlaps in a single pass.
 *  
 *      A converse function, bl_gff_sam_cmp(3) is also provided so that
 *      the programmer can choose the more intuitive interface.
 *  
 *  Arguments:
 *      alignment   Pointer to a bl_sam_t object
 *      feature     Pointer to a bl_gff_t object
 *
 *  Returns:
 *      A value < 0 if the the alignment is entirely before the feature
 *      A value > 0 if the the alignment is entirely after the feature
 *      0 if the alignment and the feature overlap
 *
 *  See also:
 *      bl_gff_sam_cmp(3), bl_chrom_name_cmp(3)
 *
 *  History: 
 *  Date        Name        Modification
 *  2022-04-06  Jason Bacon Begin
 ***************************************************************************/
Use auto-c2man to generate a man page from this comment
Library:
#include 
-lbiolibc -lxtend

Compare the positions of a SAM alignment and a GFF feature and
return a status value much like strcmp().  0 is returned if the
alignment and feature overlap.  A value < 0 is returned if the
alignment is entirely "before" the feature, i.e. it is on an
earlier chromosome according to bl_chrom_name_cmp(3), or on the
same chromosome at a lower position.  A value > 0 is returned
if the alignment is entirely "after" the feature, i.e. on a later
chromosome or same chromosome and higher position.

This function is mainly intended for programs that sweep properly
sorted GFF and SAM files locating overlaps in a single pass.

A converse function, bl_gff_sam_cmp(3) is also provided so that
the programmer can choose the more intuitive interface.

alignment   Pointer to a bl_sam_t object
feature     Pointer to a bl_gff_t object

A value < 0 if the the alignment is entirely before the feature
A value > 0 if the the alignment is entirely after the feature
0 if the alignment and the feature overlap



Date        Name        Modification
2022-04-06  Jason Bacon Begin
Use auto - c2man to generate a man page from this comment Library : #include - lbiolibc - lxtend Compare the positions of a SAM alignment and a GFF feature and return a status value much like strcmp () . 0 is returned if the alignment and feature overlap . A value < 0 is returned if the alignment is entirely " before " the feature i . e . it is on an earlier chromosome according to bl_chrom_name_cmp ( 3 ) or on the same chromosome at a lower position . A value > 0 is returned if the alignment is entirely " after " the feature i . e . on a later chromosome or same chromosome and higher position . This function is mainly intended for programs that sweep properly sorted GFF and SAM files locating overlaps in a single pass . A converse function bl_gff_sam_cmp ( 3 ) is also provided so that the programmer can choose the more intuitive interface . alignment Pointer to a bl_sam_t object feature Pointer to a bl_gff_t object A value < 0 if the the alignment is entirely before the feature A value > 0 if the the alignment is entirely after the feature 0 if the alignment and the feature overlap Date Name Modification 2022 - 04 - 06 Jason Bacon Begin
int     bl_sam_gff_cmp(bl_sam_t *alignment, bl_gff_t *feature)
{
    int     status = bl_chrom_name_cmp(BL_SAM_RNAME(alignment),
					    BL_GFF_SEQID(feature));
    if ( status != 0 )
	return status;
    else if ( BL_SAM_POS(alignment) + BL_SAM_SEQ_LEN(alignment) - 1
		< BL_GFF_START(feature) )
	return -1;
    else if ( BL_SAM_POS(alignment) > BL_GFF_END(feature) )
	return 1;
    else
	return 0;
}
int bl_sam_gff_cmp ( bl_sam_t * alignment , bl_gff_t * feature ) { int status = bl_chrom_name_cmp ( BL_SAM_RNAME ( alignment ) , BL_GFF_SEQID ( feature ) ) ; if ( status != 0 ) return status ; else if ( BL_SAM_POS ( alignment ) + BL_SAM_SEQ_LEN ( alignment ) - 1 < BL_GFF_START ( feature ) ) return -1 ; else if ( BL_SAM_POS ( alignment ) > BL_GFF_END ( feature ) ) return 1 ; else return 0 ; }
Use auto-c2man to generate a man page from this comment
  Library:
      #include <sam.h>
      -lbiolibc -lxtend
Use auto - c2man to generate a man page from this comment Library : #include <sam . h > - lbiolibc - lxtend
// Different chromosomes // Alignment ends before the start of feature // Alignment starts after the end of feature // Overlap