#NEWLINE# def _variants_dtype( fields , dtypes , arities , filter_ids , flatten_filter , info_types ) : #NEWLINE# #INDENT# 'Utility function to build a numpy dtype for a variants array,\n    given user arguments and information available from VCF header.' #NEWLINE# dtype = list ( ) #NEWLINE# for ( f , n , vcf_type ) in zip ( fields , arities , info_types ) : #NEWLINE# #INDENT# if ( ( f == 'FILTER' ) and flatten_filter ) : #NEWLINE# #INDENT# for flt in filter_ids : #NEWLINE# #INDENT# nm = ( 'FILTER_' + flt ) #NEWLINE# dtype . append ( ( nm , 'b1' ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( f == 'FILTER' ) and ( not flatten_filter ) ) : #NEWLINE# #INDENT# t = [ ( flt , 'b1' ) for flt in filter_ids ] #NEWLINE# dtype . append ( ( f , t ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( dtypes is not None ) and ( f in dtypes ) ) : #NEWLINE# #INDENT# t = dtypes [ f ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( f in config . STANDARD_VARIANT_FIELDS ) : #NEWLINE# #INDENT# t = config . DEFAULT_VARIANT_DTYPE [ f ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( f in config . DEFAULT_INFO_DTYPE ) : #NEWLINE# #INDENT# t = config . DEFAULT_INFO_DTYPE [ f ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# t = config . DEFAULT_TYPE_MAP [ vcf_type ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( n == 1 ) : #NEWLINE# #INDENT# dtype . append ( ( f , t ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dtype . append ( ( f , t , ( n , ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return dtype