<commit_before>#!/usr/bin/env python

import sys
import os
import numpy
import scipy.stats
import argparse

def generate_output_files(data_file,prior_file,control_data_file, \
                          control_prior_file,prefix):

  # hyperprior for bsEff
  mu_mu_bsEff, sigma_mu_bsEff = 2, 1.29
  mu_sigma_bsEff, sigma_sigma_bsEff = 0.4, 0.5
  # hyperprior for bsBeff
  mu_mu_bsBEff, sigma_mu_bsBEff = -3, 1.29
  mu_sigma_bsBEff, sigma_sigma_bsBEff = 0.4, 0.5
  # hyperprior for oxEff
  mu_mu_oxEff, sigma_mu_oxEff = 2, 1.29
  mu_sigma_oxEff, sigma_sigma_oxEff = 0.4, 0.5
  # hyperprior for seqErr
  mu_mu_seqErr, sigma_mu_seqErr = -3, 1.29
  mu_sigma_seqErr, sigma_sigma_seqErr = 0.4, 0.5

  # prior for g
  g_a, g_b = 2.0, 2/6.0

  # read the input files
  data = numpy.loadtxt(data_file,delimiter='\t',skiprows=0,dtype='int')
  prior = numpy.loadtxt(prior_file,delimiter='\t',skiprows=0,dtype='float')
  control_data = numpy.loadtxt(control_data_file,delimiter='\t', \
                               skiprows=0,dtype='int')
  control_prior = numpy.loadtxt(control_prior_file,delimiter='\t', \
                                skiprows=0,dtype='float')

  # make sure the arrays are 2-dimensional
  if len(data.shape) == 1:
    data = numpy.reshape(data,[1,len(data)])
  if len(prior.shape) == 1:
    prior = numpy.reshape(prior,[1,len(prior)])
  if len(control_data.shape) == 1:
    control_data = numpy.reshape(control_data,[1,len(control_data)])
  if len(control_prior.shape) == 1:
    control_prior = numpy.reshape(control_prior,[1,len(control_prior)])

  # check that the files were in the right format
  if data.shape[1] % 4 != 0:
    sys.exit('error: the number of columns in %s is not divisible by four' \
      %(data_file))
  if prior.shape[1] != 3:
    sys.exit('error: there should be exactly three columns in %s'%(prior_file))
  if control_data.shape[1] % 4 != 0:
    sys.exit(('error: the number of columns in the file '
      '%s is not divisible by four')%(control_data_file))
  if control_prior.shape[1] != 3:
    sys.exit('error: there should be exactly three columns in %s' \
      %(control_prior_file))

  if data.shape[0] != prior.shape[0]:
    sys.exit('error: the number of lines do not match in %s and %s' \
      %(data_file,prior_file))
  if control_data.shape[0] != control_prior.shape[0]:
    sys.exit('error: the number of lines do not match in %s and %s' \
      %(control_data_file,control_prior_file))
    
  # get the number of replicates
  R = control_data.shape[1]/4
  # get the number of control cytosines
  N_control = control_data.shape[0]
  # get the number of noncontrol cytosines
  N = data.shape[0]

  # get the number of C and total read-outs for
  # noncontrol cytosines in BS-seq and oxBS-seq
  bsC, bsTot, oxC, oxTot = data[:,0::4], data[:,1::4]
  oxC, oxTot = data[:,2::4], data[:,3::4]

  # get the number of C and total read-outs for control cytosines in BS-seq and oxBS-seq<commit_msg>Fix a bug (found by clolalan7)<commit_after>#!/usr/bin/env python

import sys
import os
import numpy
import scipy.stats
import argparse

def generate_output_files(data_file,prior_file,control_data_file, \
                          control_prior_file,prefix):

  # hyperprior for bsEff
  mu_mu_bsEff, sigma_mu_bsEff = 2, 1.29
  mu_sigma_bsEff, sigma_sigma_bsEff = 0.4, 0.5
  # hyperprior for bsBeff
  mu_mu_bsBEff, sigma_mu_bsBEff = -3, 1.29
  mu_sigma_bsBEff, sigma_sigma_bsBEff = 0.4, 0.5
  # hyperprior for oxEff
  mu_mu_oxEff, sigma_mu_oxEff = 2, 1.29
  mu_sigma_oxEff, sigma_sigma_oxEff = 0.4, 0.5
  # hyperprior for seqErr
  mu_mu_seqErr, sigma_mu_seqErr = -3, 1.29
  mu_sigma_seqErr, sigma_sigma_seqErr = 0.4, 0.5

  # prior for g
  g_a, g_b = 2.0, 2/6.0

  # read the input files
  data = numpy.loadtxt(data_file,delimiter='\t',skiprows=0,dtype='int')
  prior = numpy.loadtxt(prior_file,delimiter='\t',skiprows=0,dtype='float')
  control_data = numpy.loadtxt(control_data_file,delimiter='\t', \
                               skiprows=0,dtype='int')
  control_prior = numpy.loadtxt(control_prior_file,delimiter='\t', \
                                skiprows=0,dtype='float')

  # make sure the arrays are 2-dimensional
  if len(data.shape) == 1:
    data = numpy.reshape(data,[1,len(data)])
  if len(prior.shape) == 1:
    prior = numpy.reshape(prior,[1,len(prior)])
  if len(control_data.shape) == 1:
    control_data = numpy.reshape(control_data,[1,len(control_data)])
  if len(control_prior.shape) == 1:
    control_prior = numpy.reshape(control_prior,[1,len(control_prior)])

  # check that the files were in the right format
  if data.shape[1] % 4 != 0:
    sys.exit('error: the number of columns in %s is not divisible by four' \
      %(data_file))
  if prior.shape[1] != 3:
    sys.exit('error: there should be exactly three columns in %s'%(prior_file))
  if control_data.shape[1] % 4 != 0:
    sys.exit(('error: the number of columns in the file '
      '%s is not divisible by four')%(control_data_file))
  if control_prior.shape[1] != 3:
    sys.exit('error: there should be exactly three columns in %s' \
      %(control_prior_file))

  if data.shape[0] != prior.shape[0]:
    sys.exit('error: the number of lines do not match in %s and %s' \
      %(data_file,prior_file))
  if control_data.shape[0] != control_prior.shape[0]:
    sys.exit('error: the number of lines do not match in %s and %s' \
      %(control_data_file,control_prior_file))
    
  # get the number of replicates
  R = control_data.shape[1]/4
  # get the number of control cytosines
  N_control = control_data.shape[0]
  # get the number of noncontrol cytosines
  N = data.shape[0]

  # get the number of C and total read-outs for
  # noncontrol cytosines in BS-seq and oxBS-seq
  bsC, bsTot = data[:,0::4], data[:,1::4]
  oxC, oxTot = data[:,2::4], data[:,3::4]

  # get the number of C and total read-outs for control cytosines in BS-seq and oxBS-seq
{'fraction_non_alphanumeric': 0.12548886243836083, 'fraction_numerical': 0.026015983676245538, 'mean_word_length': 3.496941896024465, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '269972', 'n_tokens_mistral': 2333, 'n_tokens_neox': 2153, 'n_words': 542}