def snp_gen(): for snp in snps: # get SNP sequences snp_1hot_list = bvcf.snp_seq1(snp, job['seq_length'], genome_open) for snp_1hot in snp_1hot_list: yield {'sequence': snp_1hot}
def snp_gen(): for snp in snps: # get SNP sequences snp_1hot_list = bvcf.snp_seq1(snp, params_model['seq_length'], genome_open) for snp_1hot in snp_1hot_list: yield snp_1hot
def snps_next_batch(snps, snp_i, batch_size, seq_len, genome_open): """ Load the next batch of SNP sequence 1-hot. """ batch_1hot = [] batch_snps = [] while len(batch_1hot) < batch_size and snp_i < len(snps): # get SNP sequences snp_1hot = bvcf.snp_seq1(snps[snp_i], seq_len, genome_open) # if it was valid if len(snp_1hot) > 0: # accumulate batch_1hot += snp_1hot batch_snps.append(snps[snp_i]) # advance SNP index snp_i += 1 # convert to array batch_1hot = np.array(batch_1hot) return batch_1hot, batch_snps, snp_i
def snp_gen(): for snp in snps: # get SNP sequences snp_1hot_list = bvcf.snp_seq1(snp, seq_length, genome_open) for snp_1hot in snp_1hot_list: yield snp_1hot