home | help
bl_sam_fopen(3) 	    Library Functions Manual		 bl_sam_fopen(3)

NAME
     bl_sam_fopen() - Open a SAM/BAM/CRAM file

LIBRARY
     #include <xtend/file.h>
     -lxtend

SYNOPSIS
     FILE    *bl_sam_fopen(const char *filename, const char *mode,
     char *samtools_args)

ARGUMENTS
     filename:	     Name of the file to be opened
     mode:	     "r" or "w", passed to fopen() or popen()
     samtools_args   Flags to pass to samtools view

DESCRIPTION
     Open  a raw SAM file using fopen() or a compressed SAM file, or BAM or CRAM
     file using popen().  If the file  extension  is  .bam  or	.cram,	or  sam-
     tools_args  is  not  NULL or "", data will be piped through "samtools view"
     with the given samtools_args as arguments.  The flag --with-header  is  al-
     ways  added for consistency with the case of reading a raw SAM file without
     piping through samtools.  Programs that don't want the header can filter it
     out by other means, such as bl_sam_skip_header(3).

     bl_sam_fopen() must be used in conjunction with bl_sam_fclose()  to  ensure
     that fclose() or pclose() is called where appropriate.

RETURN VALUES
     A pointer to the FILE structure or NULL if open failed

SEE ALSO
     fopen(3), popen(3), gzip(1), bzip2(1), xz(1)

								 bl_sam_fopen(3)

home | help