vcf.c
/***************************************************************************
 *  Library:
 *      #include <biolibc/vcf.h>
 *      -lbiolibc -lxtend
 *
 *  Description:
 *      Read a single-sample VCF call (static fields and one sample column).
 *      This should only be used with VCF inputs that have exactly one
 *      sample column.  For multisample VCFs, use bl_vcf_read_static_fields()
 *      followed by a loop to read the sample data.
 *
 *      If field_mask is not BL_VCF_FIELD_ALL, fields not indicated by a 1
 *      in the bit mask are discarded rather than stored in bed_feature.
 *      Possible mask values are:
 *
 *      BL_VCF_FIELD_ALL
 *      BL_VCF_FIELD_CHROM
 *      BL_VCF_FIELD_POS
 *      BL_VCF_FIELD_ID
 *      BL_VCF_FIELD_REF
 *      BL_VCF_FIELD_ALT
 *      BL_VCF_FIELD_QUAL
 *      BL_VCF_FIELD_FILTER
 *      BL_VCF_FIELD_INFO
 *      BL_VCF_FIELD_FORMAT
 *
 *  Arguments:
 *      vcf_stream  FILE pointer to VCF input stream
 *      vcf_call    bl_vcf_t structure to receive VCF data
 *      field_mask  Bit mask to indicate which fields to store
 *
 *  Returns:
 *      BL_READ_OK upon success
 *      BL_READ_TRUNCATED if EOF is encountered while reading a call
 *      BL_READ_EOF if EOF is encountered between calls as it should be
 *
 *  See also:
 *      bl_vcf_read_static_fields(3), tsv_read_field(3)
 *
 *  History: 
 *  Date        Name        Modification
 *  2019-12-11  Jason Bacon Begin
 ***************************************************************************/
#include 
-lbiolibc -lxtend

Read a single-sample VCF call (static fields and one sample column).
This should only be used with VCF inputs that have exactly one
sample column.  For multisample VCFs, use bl_vcf_read_static_fields()
followed by a loop to read the sample data.

If field_mask is not BL_VCF_FIELD_ALL, fields not indicated by a 1
in the bit mask are discarded rather than stored in bed_feature.
Possible mask values are.



vcf_stream  FILE pointer to VCF input stream
vcf_call    bl_vcf_t structure to receive VCF data
field_mask  Bit mask to indicate which fields to store

BL_READ_OK upon success
BL_READ_TRUNCATED if EOF is encountered while reading a call
BL_READ_EOF if EOF is encountered between calls as it should be



Date        Name        Modification
2019-12-11  Jason Bacon Begin
#include - lbiolibc - lxtend Read a single - sample VCF call ( static fields and one sample column ) . This should only be used with VCF inputs that have exactly one sample column . For multisample VCFs use bl_vcf_read_static_fields () followed by a loop to read the sample data . If field_mask is not BL_VCF_FIELD_ALL fields not indicated by a 1 in the bit mask are discarded rather than stored in bed_feature . Possible mask values are . vcf_stream FILE pointer to VCF input stream vcf_call bl_vcf_t structure to receive VCF data field_mask Bit mask to indicate which fields to store BL_READ_OK upon success BL_READ_TRUNCATED if EOF is encountered while reading a call BL_READ_EOF if EOF is encountered between calls as it should be Date Name Modification 2019 - 12 - 11 Jason Bacon Begin
int     bl_vcf_read_ss_call(bl_vcf_t *vcf_call, FILE *vcf_stream,
	    vcf_field_mask_t field_mask)
{
    int     status;
    status = bl_vcf_read_static_fields(vcf_call, vcf_stream, field_mask);
    if ( status == BL_READ_OK )
    {
	if ( tsv_read_field_malloc(vcf_stream, &vcf_call->single_sample,
			&vcf_call->single_sample_array_size,
			&vcf_call->single_sample_len) != EOF )
	    return BL_READ_OK;
	else
	{
	    fprintf(stderr, "bl_vcf_read_ss_call(): Got EOF reading sample.\n");
	    return BL_READ_TRUNCATED;
	}
    }
    else
	return status;
}
int bl_vcf_read_ss_call ( bl_vcf_t * vcf_call , FILE * vcf_stream , vcf_field_mask_t field_mask ) { int status ; status = bl_vcf_read_static_fields ( vcf_call , vcf_stream , field_mask ) ; if ( status == BL_READ_OK ) { if ( tsv_read_field_malloc ( vcf_stream , & vcf_call -> single_sample , & vcf_call -> single_sample_array_size , & vcf_call -> single_sample_len ) != EOF ) return BL_READ_OK ; else { fprintf ( stderr , " \n " ) ; return BL_READ_TRUNCATED ; } } else return status ; }
Library:
      #include <biolibc/vcf.h>
      -lbiolibc -lxtend
Library : #include <biolibc / vcf . h > - lbiolibc - lxtend