app/covcalculator/utils.py
def calculate_expected_lanes(genome_size,coverage,samples_count,is_pe,cluster_size,
                             read_length,max_samples=96,min_required_lane_per_sample=0.003):
  '''
  A function to calculate expected number of lanes for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Requested genome coverage
  :param samples_count: Number of samples requested
  :param is_pe: Toggle for paired end run
  :param cluster_size: Available cluster size per lane
  :param read_length: Read length
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minumum required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * samples_count
                  * expected_lanes
                  * expected_bases_per_sample
  '''
  try:
    genome_size *= 1000000
    expected_bases_per_sample = genome_size * coverage
    if is_pe > 0:
        read_length *= 2
    output_per_unit = cluster_size * read_length
    required_lane_per_sample = expected_bases_per_sample / output_per_unit
    samples_per_lanes = output_per_unit / expected_bases_per_sample
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    if samples_per_lanes > max_samples:
        samples_per_lanes = max_samples
    #if int(samples_per_lanes) < 1:
    #    samples_per_lanes = 1
    expected_lanes = samples_count / samples_per_lanes
    if expected_lanes > int(expected_lanes):
        expected_lanes = int(expected_lanes) + 1
    output_dict = dict()
    output_dict.\
      update({\
        'output_per_unit':output_per_unit,
        'required_lane_per_sample': round(required_lane_per_sample,4),
        'samples_per_lanes':float(samples_per_lanes),
        'samples_count':samples_count,
        'expected_lanes':int(expected_lanes),
        'expected_bases_per_sample':int(expected_bases_per_sample)
        })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected lanes, error: {0}'.format(e))

  A function to calculate expected number of lanes for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Requested genome coverage
  :param samples_count: Number of samples requested
  :param is_pe: Toggle for paired end run
  :param cluster_size: Available cluster size per lane
  :param read_length: Read length
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minumum required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * samples_count
                  * expected_lanes
                  * expected_bases_per_sample
  
A function to calculate expected number of lanes for sequencing
A function to calculate expected number of lanes for sequencing
def calculate_expected_lanes(genome_size,coverage,samples_count,is_pe,cluster_size,
                             read_length,max_samples=96,min_required_lane_per_sample=0.003):
  try:
    genome_size *= 1000000
    expected_bases_per_sample = genome_size * coverage
    if is_pe > 0:
        read_length *= 2
    output_per_unit = cluster_size * read_length
    required_lane_per_sample = expected_bases_per_sample / output_per_unit
    samples_per_lanes = output_per_unit / expected_bases_per_sample
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    if samples_per_lanes > max_samples:
        samples_per_lanes = max_samples
    expected_lanes = samples_count / samples_per_lanes
    if expected_lanes > int(expected_lanes):
        expected_lanes = int(expected_lanes) + 1
    output_dict = dict()
    output_dict.\
      update({\
        'output_per_unit':output_per_unit,
        'required_lane_per_sample': round(required_lane_per_sample,4),
        'samples_per_lanes':float(samples_per_lanes),
        'samples_count':samples_count,
        'expected_lanes':int(expected_lanes),
        'expected_bases_per_sample':int(expected_bases_per_sample)
        })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected lanes, error: {0}'.format(e))
def calculate_expected_lanes ( genome_size , coverage , samples_count , is_pe , cluster_size , read_length , max_samples = 96 , min_required_lane_per_sample = 0.003 ) : try : genome_size *= 1000000 expected_bases_per_sample = genome_size * coverage if is_pe > 0 : read_length *= 2 output_per_unit = cluster_size * read_length required_lane_per_sample = expected_bases_per_sample / output_per_unit samples_per_lanes = output_per_unit / expected_bases_per_sample if required_lane_per_sample < min_required_lane_per_sample : required_lane_per_sample = min_required_lane_per_sample if samples_per_lanes > max_samples : samples_per_lanes = max_samples expected_lanes = samples_count / samples_per_lanes if expected_lanes > int ( expected_lanes ) : expected_lanes = int ( expected_lanes ) + 1 output_dict = dict ( ) output_dict . update ( { 'output_per_unit' : output_per_unit , 'required_lane_per_sample' : round ( required_lane_per_sample , 4 ) , 'samples_per_lanes' : float ( samples_per_lanes ) , 'samples_count' : samples_count , 'expected_lanes' : int ( expected_lanes ) , 'expected_bases_per_sample' : int ( expected_bases_per_sample ) } ) return output_dict except Exception as e : raise ValueError ( 'Failed to calculate expected lanes, error: {0}' . format ( e ) )
A function to calculate expected number of lanes for sequencing
A function to calculate expected number of lanes for sequencing
'''
  A function to calculate expected number of lanes for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Requested genome coverage
  :param samples_count: Number of samples requested
  :param is_pe: Toggle for paired end run
  :param cluster_size: Available cluster size per lane
  :param read_length: Read length
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minumum required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * samples_count
                  * expected_lanes
                  * expected_bases_per_sample
  ''' #if int(samples_per_lanes) < 1: #    samples_per_lanes = 1
A dictionary with following keys
output_per_unit
required_lane_per_sample
samples_per_lanes
samples_count
expected_lanes
expected_bases_per_sample
A dictionary with following keys output_per_unit required_lane_per_sample samples_per_lanes samples_count expected_lanes expected_bases_per_sample
genome_size
Genome size in Mb
Genome size in Mb
coverage
Requested genome coverage
Requested genome coverage
samples_count
Number of samples requested
Number of samples requested
is_pe
Toggle for paired end run
Toggle for paired end run
cluster_size
Available cluster size per lane
Available cluster size per lane
read_length
None
max_samples
Max number of allowed samples, default 96
Max number of allowed samples default 96
min_required_lane_per_sample
Minumum required lane per sample, default 0.003
Minumum required lane per sample default 0 . 003