<commit_before># -*- coding: utf-8 -*-
# import
## batteries
from __future__ import print_function
import os
import sys
import argparse
from itertools import product
import string
## 3rd party
import numpy as np
import pandas as pd
## package
from pyTecanFluent import Utils
from pyTecanFluent import Fluent
from pyTecanFluent import Labware


# functions
def get_desc():
    desc = 'Create robot commands for qPCR assay setup'
    return desc

def parse_args(test_args=None, subparsers=None):
    # desc
    desc = get_desc()
    epi = """DESCRIPTION:
    Create a worklist file for the TECAN Fluent robot for qPCR setup.
    The input is an exported plate layout from the BioRad qPCR software.
    The file format should be Excel or CSV.
    Just create a plate layout for your experimet, then export and add some needed info:
      The following columns should also be added to the table:
      * "Sample labware name" 
         * labware name containing the sample (any name that you want)
         * Exmaple: "source plate"
      * "Sample labware type" 
         * labware type (must EXACTLY match an existing labware type)
         * Example: "96 Eppendorf TwinTec PCR"
      * "Sample location"  
         * location of sample in the source plate. 
         * numeric; column-wise indexing
      * "Sample volume"  
         * numeric; sample volume in ul
      * "MM name"  
         * Name of master mix for that sample
         * This allows for multiple master mixes per assay 
      * "MM volume"  
         * Volume of master mix in PCR rxn (ul)
      * "Water volume"  
         * Volume of water in PCR rxn (ul)
    
    Notes:
    * Sample locations in plates numbered are column-wise (left-to-right)
    * The setup file (input table) MUST have a header (capitalization doesn't matter)
    * All volumes are in ul.
    """
    if subparsers:
        parser = subparsers.add_parser('qPCR', description=desc, epilog=epi,
                                       formatter_class=argparse.RawTextHelpFormatter)
    else:
        parser = argparse.ArgumentParser(description=desc, epilog=epi,
                                         formatter_class=argparse.RawTextHelpFormatter)

    # args
    ## I/O
    groupIO = parser.add_argument_group('I/O')
    groupIO.add_argument('setup', metavar='SetupFile', type=str,
                         help='An Excel or CSV file with experimental setup')
    groupIO.add_argument('--prefix', type=str, default='TECAN_qPCR',
                         help='Output file name prefix (default: %(default)s)')
    groupIO.add_argument('--format', type=str, default=None,
                         choices=[None, 'excel', 'csv', 'tsv'],
                         help='File format (excel, csv, or tsv). If not provided, the format is determined from the file extension (default: %(default)s)') 

    ## source labware 
    src = parser.add_argument_group('Source labware')
    src.add_argument('--mm-type', type=str, default='1.5ml Eppendorf waste',
                      help='Mastermix labware type (default: %(default)s)')
    src.add_argument('--water-type', type=str, default='100ml_1 waste',
                      help='Water labware type (default: %(default)s)')
    
    ## destination labware
    dest = parser.add_argument_group('Destination labware')
    dest.add_argument('--dest', type=str, default='Destination plate',
                      help='Destination plate labware name (default: %(default)s)')
    dest.add_argument('--dest-type', type=str, default='384 Well Biorad PCR',
                      help='Destination plate labware type (default: %(default)s)')

    # Liquid classes
    liq = parser.add_argument_group('Liquid classes')
    liq.add_argument('--mm-liq', type=str, default='MasterMix Free Multi Wall Disp',
                      help='Mastermix liquid class (default: %(default)s)')
    liq.add_argument('--samp-liq', type=str, default='Water Free Single Wall Disp',
                      help='Sample liquid class (default: %(default)s)')
    liq.add_argument('--water-liq', type=str, default='Water Free Single Wall Disp',
                      help='Water liquid class (default: %(default)s)')

    ## tip type
    # tips = parser.add_argument_group('Tip type')
    # tips.add_argument('--tip1000-type', type=str, default='FCA, 1000ul SBS',
    #                   help='1000ul tip type (default: %(default)s)')
    # tips.add_argument('--tip200-type', type=str, default='FCA, 200ul SBS',
    #                   help='200ul tip type (default: %(default)s)')
    # tips.add_argument('--tip50-type', type=str, default='FCA, 50ul SBS',
    #                   help='50ul tip type (default: %(default)s)')
    # tips.add_argument('--tip10-type', type=str, default='FCA, 10ul SBS',
    #                   help='10ul tip type (default: %(default)s)')

    # parse & return
    if test_args:
        args = parser.parse_args(test_args)
        return args

    return parser


def main(args=None):
    # Input
    if args is None:
        args = parse_args()

    # Load input assay setup table<commit_msg>cleaned code for qpcr.py<commit_after># -*- coding: utf-8 -*-
# import
## batteries
from __future__ import print_function
import os
import sys
import argparse
from itertools import product
import string
## 3rd party
import numpy as np
import pandas as pd
## package
from pyTecanFluent import Utils
from pyTecanFluent import Fluent
from pyTecanFluent import Labware


# functions
def get_desc():
    desc = 'Create robot commands for qPCR assay setup'
    return desc

def parse_args(test_args=None, subparsers=None):
    # desc
    desc = get_desc()
    epi = """DESCRIPTION:
    Create a worklist file for the TECAN Fluent robot for qPCR setup.
    The input is an exported plate layout from the BioRad qPCR software.
    The file format should be Excel or CSV.
    Just create a plate layout for your experimet, then export and add some needed info:
      The following columns should also be added to the table:
      * "Sample labware name" 
         * labware name containing the sample (any name that you want)
         * Exmaple: "source plate"
      * "Sample labware type" 
         * labware type (must EXACTLY match an existing labware type)
         * Example: "96 Eppendorf TwinTec PCR"
      * "Sample location"  
         * location of sample in the source plate. 
         * numeric; column-wise indexing
      * "Sample volume"  
         * numeric; sample volume in ul
      * "MM name"  
         * Name of master mix for that sample
         * This allows for multiple master mixes per assay 
      * "MM volume"  
         * Volume of master mix in PCR rxn (ul)
      * "Water volume"  
         * Volume of water in PCR rxn (ul)
    
    Notes:
    * Sample locations in plates numbered are column-wise (left-to-right)
    * The setup file (input table) MUST have a header (capitalization doesn't matter)
    * All volumes are in ul.
    """
    if subparsers:
        parser = subparsers.add_parser('qPCR', description=desc, epilog=epi,
                                       formatter_class=argparse.RawTextHelpFormatter)
    else:
        parser = argparse.ArgumentParser(description=desc, epilog=epi,
                                         formatter_class=argparse.RawTextHelpFormatter)

    # args
    ## I/O
    groupIO = parser.add_argument_group('I/O')
    groupIO.add_argument('setup', metavar='SetupFile', type=str,
                         help='An Excel or CSV file with experimental setup')
    groupIO.add_argument('--prefix', type=str, default='TECAN_qPCR',
                         help='Output file name prefix (default: %(default)s)')
    groupIO.add_argument('--format', type=str, default=None,
                         choices=[None, 'excel', 'csv', 'tsv'],
                         help='File format (excel, csv, or tsv). If not provided, the format is determined from the file extension (default: %(default)s)') 

    ## source labware 
    src = parser.add_argument_group('Source labware')
    src.add_argument('--mm-type', type=str, default='1.5ml Eppendorf waste',
                      help='Mastermix labware type (default: %(default)s)')
    src.add_argument('--water-type', type=str, default='100ml_1 waste',
                      help='Water labware type (default: %(default)s)')
    
    ## destination labware
    dest = parser.add_argument_group('Destination labware')
    dest.add_argument('--dest', type=str, default='Destination plate',
                      help='Destination plate labware name (default: %(default)s)')
    dest.add_argument('--dest-type', type=str, default='384 Well Biorad PCR',
                      help='Destination plate labware type (default: %(default)s)')

    # Liquid classes
    liq = parser.add_argument_group('Liquid classes')
    liq.add_argument('--mm-liq', type=str, default='MasterMix Free Multi Wall Disp',
                      help='Mastermix liquid class (default: %(default)s)')
    liq.add_argument('--samp-liq', type=str, default='Water Free Single Wall Disp',
                      help='Sample liquid class (default: %(default)s)')
    liq.add_argument('--water-liq', type=str, default='Water Free Single Wall Disp',
                      help='Water liquid class (default: %(default)s)')

    # parse & return
    if test_args:
        args = parser.parse_args(test_args)
        return args

    return parser


def main(args=None):
    # Input
    if args is None:
        args = parse_args()

    # Load input assay setup table
{'fraction_non_alphanumeric': 0.10426739541727979, 'fraction_numerical': 0.006201387429051923, 'mean_word_length': 2.546403279910548, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4514875', 'n_tokens_mistral': 2828, 'n_tokens_neox': 2667, 'n_words': 875}