app/covcalculator/utils.py
def calculate_expected_lanes_for_known_library(recommended_clusters,samples_count,cluster_size,is_sc,read_length,
                                               is_pe=0,max_samples=96,min_required_lane_per_sample=0.003):
  '''
  A function for calculating expected lane counts for known library

  :param recommended_clusters: Recommended cluster counts for known assay types
  :param samples_count: Number of samples to sequence
  :param cluster_size: Per lane cluster size on flowcell
  :param is_sc: A toggle for single cell assay type
  :param read_length: Read length in bp
  :param is_pe: A toggle for paired-end reads, default 0
  :param max_samples: Max number of allowed samples per lane, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :return: A dictionary with following keys
             * required_lane_per_sample
             * samples_per_lanes
             * samples_count
             * expected_lanes
             * output_per_unit
  '''
  try:
    samples_per_lanes = cluster_size / recommended_clusters
    required_lane_per_sample = recommended_clusters / cluster_size
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    if is_pe > 0:
      read_length *= 2
    output_per_unit = cluster_size * read_length
    if samples_per_lanes > max_samples and is_sc==0:
        samples_per_lanes = max_samples
    expected_lanes = samples_count / int(samples_per_lanes)
    if expected_lanes > int(expected_lanes):
      expected_lanes = int(expected_lanes) + 1
    output_dict = dict()
    output_dict.\
      update({ \
        'required_lane_per_sample': round(required_lane_per_sample,4),
        'samples_per_lanes':int(samples_per_lanes),
        'samples_count':samples_count,
        'expected_lanes':expected_lanes,
        'output_per_unit':output_per_unit
      })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected lanes for know library, error: {0}'.format(e))

  A function for calculating expected lane counts for known library

  :param recommended_clusters: Recommended cluster counts for known assay types
  :param samples_count: Number of samples to sequence
  :param cluster_size: Per lane cluster size on flowcell
  :param is_sc: A toggle for single cell assay type
  :param read_length: Read length in bp
  :param is_pe: A toggle for paired-end reads, default 0
  :param max_samples: Max number of allowed samples per lane, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :return: A dictionary with following keys
             * required_lane_per_sample
             * samples_per_lanes
             * samples_count
             * expected_lanes
             * output_per_unit
  
A function for calculating expected lane counts for known library
A function for calculating expected lane counts for known library
def calculate_expected_lanes_for_known_library(recommended_clusters,samples_count,cluster_size,is_sc,read_length,
                                               is_pe=0,max_samples=96,min_required_lane_per_sample=0.003):
  try:
    samples_per_lanes = cluster_size / recommended_clusters
    required_lane_per_sample = recommended_clusters / cluster_size
    if required_lane_per_sample < min_required_lane_per_sample:
      required_lane_per_sample = min_required_lane_per_sample
    if is_pe > 0:
      read_length *= 2
    output_per_unit = cluster_size * read_length
    if samples_per_lanes > max_samples and is_sc==0:
        samples_per_lanes = max_samples
    expected_lanes = samples_count / int(samples_per_lanes)
    if expected_lanes > int(expected_lanes):
      expected_lanes = int(expected_lanes) + 1
    output_dict = dict()
    output_dict.\
      update({ \
        'required_lane_per_sample': round(required_lane_per_sample,4),
        'samples_per_lanes':int(samples_per_lanes),
        'samples_count':samples_count,
        'expected_lanes':expected_lanes,
        'output_per_unit':output_per_unit
      })
    return output_dict
  except Exception as e:
    raise ValueError('Failed to calculate expected lanes for know library, error: {0}'.format(e))
def calculate_expected_lanes_for_known_library ( recommended_clusters , samples_count , cluster_size , is_sc , read_length , is_pe = 0 , max_samples = 96 , min_required_lane_per_sample = 0.003 ) : try : samples_per_lanes = cluster_size / recommended_clusters required_lane_per_sample = recommended_clusters / cluster_size if required_lane_per_sample < min_required_lane_per_sample : required_lane_per_sample = min_required_lane_per_sample if is_pe > 0 : read_length *= 2 output_per_unit = cluster_size * read_length if samples_per_lanes > max_samples and is_sc == 0 : samples_per_lanes = max_samples expected_lanes = samples_count / int ( samples_per_lanes ) if expected_lanes > int ( expected_lanes ) : expected_lanes = int ( expected_lanes ) + 1 output_dict = dict ( ) output_dict . update ( { 'required_lane_per_sample' : round ( required_lane_per_sample , 4 ) , 'samples_per_lanes' : int ( samples_per_lanes ) , 'samples_count' : samples_count , 'expected_lanes' : expected_lanes , 'output_per_unit' : output_per_unit } ) return output_dict except Exception as e : raise ValueError ( 'Failed to calculate expected lanes for know library, error: {0}' . format ( e ) )
A function for calculating expected lane counts for known library
A function for calculating expected lane counts for known library
'''
  A function for calculating expected lane counts for known library

  :param recommended_clusters: Recommended cluster counts for known assay types
  :param samples_count: Number of samples to sequence
  :param cluster_size: Per lane cluster size on flowcell
  :param is_sc: A toggle for single cell assay type
  :param read_length: Read length in bp
  :param is_pe: A toggle for paired-end reads, default 0
  :param max_samples: Max number of allowed samples per lane, default 96
  :param min_required_lane_per_sample: Minimum number of required lane per sample, default 0.003
  :return: A dictionary with following keys
             * required_lane_per_sample
             * samples_per_lanes
             * samples_count
             * expected_lanes
             * output_per_unit
  '''
A dictionary with following keys
required_lane_per_sample
samples_per_lanes
samples_count
expected_lanes
output_per_unit
A dictionary with following keys required_lane_per_sample samples_per_lanes samples_count expected_lanes output_per_unit
recommended_clusters
Recommended cluster counts for known assay types
Recommended cluster counts for known assay types
samples_count
Number of samples to sequence
Number of samples to sequence
cluster_size
Per lane cluster size on flowcell
Per lane cluster size on flowcell
is_sc
A toggle for single cell assay type
A toggle for single cell assay type
read_length
Read length in bp
Read length in bp
is_pe
A toggle for paired-end reads, default 0
A toggle for paired - end reads default 0
max_samples
Max number of allowed samples per lane, default 96
Max number of allowed samples per lane 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