app/covcalculator/utils.py
def calculate_expected_samples(genome_size,coverage,lanes_count,is_pe,cluster_size,
                               read_length,max_samples=96,min_required_lane_per_sample=0.003):
  '''
  A function to calculate expected sample counts for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Genome coverage
  :param lanes_count: Number of lanes to sequence
  :param is_pe: Toggle for paired-end reads
  :param cluster_size: Cluster size per lane on flowcell
  :param read_length: Read length in bp
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * lanes_count
                  * expected_samples
                  * expected_bases_per_sample
  '''
  try:
    genome_size *= 1000000
    if is_pe > 0:
        read_length *= 2
    output_per_unit = cluster_size * read_length
    expected_bases_per_sample = genome_size * coverage
    required_lane_per_sample = expected_bases_per_sample / output_per_unit
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    samples_per_lanes = output_per_unit / expected_bases_per_sample
    if samples_per_lanes > max_samples:
        samples_per_lanes = max_samples

    expected_samples = samples_per_lanes * lanes_count
    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':samples_per_lanes,
        'lanes_count':lanes_count,
        'expected_samples':int(expected_samples),
        'expected_bases_per_sample':int(expected_bases_per_sample)
        })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected samples, error: {0}'.format(e))

  A function to calculate expected sample counts for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Genome coverage
  :param lanes_count: Number of lanes to sequence
  :param is_pe: Toggle for paired-end reads
  :param cluster_size: Cluster size per lane on flowcell
  :param read_length: Read length in bp
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * lanes_count
                  * expected_samples
                  * expected_bases_per_sample
  
A function to calculate expected sample counts for sequencing
A function to calculate expected sample counts for sequencing
def calculate_expected_samples(genome_size,coverage,lanes_count,is_pe,cluster_size,
                               read_length,max_samples=96,min_required_lane_per_sample=0.003):
  try:
    genome_size *= 1000000
    if is_pe > 0:
        read_length *= 2
    output_per_unit = cluster_size * read_length
    expected_bases_per_sample = genome_size * coverage
    required_lane_per_sample = expected_bases_per_sample / output_per_unit
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    samples_per_lanes = output_per_unit / expected_bases_per_sample
    if samples_per_lanes > max_samples:
        samples_per_lanes = max_samples
    expected_samples = samples_per_lanes * lanes_count
    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':samples_per_lanes,
        'lanes_count':lanes_count,
        'expected_samples':int(expected_samples),
        'expected_bases_per_sample':int(expected_bases_per_sample)
        })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected samples, error: {0}'.format(e))
def calculate_expected_samples ( genome_size , coverage , lanes_count , is_pe , cluster_size , read_length , max_samples = 96 , min_required_lane_per_sample = 0.003 ) : try : genome_size *= 1000000 if is_pe > 0 : read_length *= 2 output_per_unit = cluster_size * read_length expected_bases_per_sample = genome_size * coverage required_lane_per_sample = expected_bases_per_sample / output_per_unit if required_lane_per_sample < min_required_lane_per_sample : required_lane_per_sample = min_required_lane_per_sample samples_per_lanes = output_per_unit / expected_bases_per_sample if samples_per_lanes > max_samples : samples_per_lanes = max_samples expected_samples = samples_per_lanes * lanes_count 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' : samples_per_lanes , 'lanes_count' : lanes_count , 'expected_samples' : int ( expected_samples ) , 'expected_bases_per_sample' : int ( expected_bases_per_sample ) } ) return output_dict except Exception as e : raise ValueError ( 'Failed to calculate expected samples, error: {0}' . format ( e ) )
A function to calculate expected sample counts for sequencing
A function to calculate expected sample counts for sequencing
'''
  A function to calculate expected sample counts for sequencing

  :param genome_size: Genome size in Mb
  :param coverage: Genome coverage
  :param lanes_count: Number of lanes to sequence
  :param is_pe: Toggle for paired-end reads
  :param cluster_size: Cluster size per lane on flowcell
  :param read_length: Read length in bp
  :param max_samples: Max number of allowed samples, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :returns: A dictionary with following keys
                  * output_per_unit
                  * required_lane_per_sample
                  * samples_per_lanes
                  * lanes_count
                  * expected_samples
                  * expected_bases_per_sample
  '''
A dictionary with following keys
output_per_unit
required_lane_per_sample
samples_per_lanes
lanes_count
expected_samples
expected_bases_per_sample
A dictionary with following keys output_per_unit required_lane_per_sample samples_per_lanes lanes_count expected_samples expected_bases_per_sample
genome_size
Genome size in Mb
Genome size in Mb
coverage
None
lanes_count
Number of lanes to sequence
Number of lanes to sequence
is_pe
Toggle for paired-end reads
Toggle for paired - end reads
cluster_size
Cluster size per lane on flowcell
Cluster size per lane on flowcell
read_length
Read length in bp
Read length in bp
max_samples
Max number of allowed samples, default 96
Max number of allowed samples default 96
min_required_lane_per_sample
Minimum number of required lane per sample, default 0.003
Minimum number of required lane per sample default 0 . 003