예제 #1
0
def main():
    parser = argparse.ArgumentParser(description='primertool-isoforms: preparing the isoform database for PrimerServer2', \
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('-v', '--version', action='version', version='%(prog)s '+version.get())
    parser.add_argument('template', help='the template file in FASTA format')
    parser.add_argument('gff', help='the annotation file in GFF3 format')
    parser.add_argument('-f', '--features', help='features in GFF3 (the 3rd column) that should be parsed as isoforms. \
        Multiple features separated by comma are allowed', default='mRNA')
    parser.add_argument('-i', '--id', help='the key in GFF3 (in the last column) that should be treated as the isoform IDs. \
        ', default='ID')
    parser.add_argument('-r', '--remove-version', help='remove the version code (such as .1, .2, ...) from isoform IDs. \
        ', action='store_true')
    args = parser.parse_args()

    isoform_data = get_AS(gff_file=args.gff, features=args.features.split(','), rna_print_ID_key=args.id, remove_version=args.remove_version)

    with open(args.template+'.isoforms.json', 'w') as f:
        json.dump(isoform_data, f, indent=4)
예제 #2
0
from setuptools import setup, find_packages

from primerserver2.core import version

setup(
    name='primerserver2',
    version=version.get(),
    description=
    "a high-throughput primer design and specificity-checking platform",
    long_description=__doc__,
    classifiers=[
        'Development Status :: 4 - Beta', 'Environment :: Console',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: MIT License', 'Operating System :: Unix',
        'Programming Language :: Python :: 3.6',
        'Topic :: Scientific/Engineering :: Bio-Informatics'
    ],
    keywords='primer bioinformatics PCR',
    author='Tao Zhu',
    author_email='*****@*****.**',
    url='https://github.com/billzt/PrimerServer2',
    license='MIT',
    packages=find_packages(),
    include_package_data=True,
    python_requires='>=3.6',
    install_requires=['primer3-py', 'progressbar2', 'flask', 'python-dotenv'],
    entry_points={
        'console_scripts': [
            'primertool = primerserver2.cmd.primertool:main',
            'primertool-junction = primerserver2.cmd.junctions:main',
            'primertool-isoform = primerserver2.cmd.isoforms:main',
예제 #3
0
def make_args():
    parser = argparse.ArgumentParser(description='primertool: the command-line version of PrimerServer2', \
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('-v', '--version', action='version', version='%(prog)s '+version.get())

    # parent arguments
    # These arguments are used by all the three modes
    parent_parser_all = argparse.ArgumentParser(add_help=False)
    group_io = parent_parser_all.add_argument_group('Input (REQUIRED)')
    group_io.add_argument('query', help='query file. (STDIN is acceptable)', \
        type=argparse.FileType('r'))
    group_io.add_argument('templates', help='template file in FASTA format. \
        Allowing multiple files (separated by comma), where the first one is used to design primers and/or order the primer \
            specificity')

    group_all = parent_parser_all.add_argument_group('Overall Setttings')
    group_all.add_argument('--primer-num-retain', type=int, help='The maximum number of primers to retain in each \
        site in the final report.', default=10)
    group_all.add_argument('--check-multiplex', help='Checking dimers between primers in different sites, which is useful in \
        multiplex PCR.', action='store_true')
    group_all.add_argument('--Tm-diff', type=int, help='The mininum difference of melting temperature (℃) \
        suggested to produce off-target amplicon or primer dimers. Suggest >10', default=20)
    group_all.add_argument('-p', '--cpu', type=int, help='Used CPU number.', default=2)
    group_all.add_argument('-o', '--out', help="Output primers in JSON format. default: {query}.out", \
        type=argparse.FileType('w'))
    group_all.add_argument('-t', '--tsv', help="Output primers in TSV format. default: {query}.tsv", \
        type=argparse.FileType('w'))

    # These arguments are used by design and full
    parent_parser_design = argparse.ArgumentParser(add_help=False)
    group_design = parent_parser_design.add_argument_group('Design Primers')
    group_design.add_argument('--type', choices=['SEQUENCE_TARGET', 'SEQUENCE_INCLUDED_REGION', 'FORCE_END'],\
        help='designing primer types', default='SEQUENCE_TARGET')
    group_design.add_argument('--pick-oligo', action='store_true', help='Pick internal Oligos (Probes) for qRT-PCR')
    group_design.add_argument('--product-size-min', type=int, help='Lower limit of the product amplicon size range (bp).', \
        default=70)
    group_design.add_argument('--product-size-max', type=int, help='Upper limit of the product amplicon size range (bp).', \
        default=1000)
    group_design.add_argument('--Tm-opt', type=int, help='Optmized melting temperature for primers (℃).', \
        default=60)
    group_design.add_argument('--primer-num-return', type=int, help='The maximum number of primers to return in Primer3 \
        designing results.', default=30)
    # qRT-PCR specific
    group_design.add_argument('--junction', help='Primer pair must be separated by at least one intron on the \
        corresponding genomic DNA; or primers must span an exon-exon junction. Junction data in JSON format should be prepared by \
            the command-line primertool-junctions', action='store_true')
    
    # These arguments are used by check and full
    parent_parser_check = argparse.ArgumentParser(add_help=False)
    group_check = parent_parser_check.add_argument_group('Check Specificity')
    group_check.add_argument('-3', '--use-3-end', help='If turned on, primer pairs having at least one mismatch at the 3 end\
        position with templates would not be considered to produce off-target amplicon, even if their melting temperatures \
            are high. Turn on this would find more candidate primers, but might also have more false positives\
                ', action='store_true')
    group_check.add_argument('--checking-size-min', type=int, help='Lower limit of the checking amplicon size range (bp).', \
        default=50)
    group_check.add_argument('--checking-size-max', type=int, help='Upper limit of the checking amplicon size range (bp).', \
        default=2000)
    group_check.add_argument('--amplicon-num-max', type=int, help='The maximum number of amplicons for checking.', \
        default=10)
    group_check.add_argument('-a', '--report-amplicon-seqs', help="Get amplicon seqs (might be slow)", action='store_true')
    # qRT-PCR specific
    group_check.add_argument('--isoform', help="Allow primers targeting on alternative isoforms and still regard them \
        as specific ones. Isoform data in JSON format should be prepared by the command-line primertool-isoforms", action='store_true')

    # sub commands
    subparsers = parser.add_subparsers(help='Sub commands: running mode')
    subparsers.required = True
    subparsers.dest = 'run_mode'
    # sub commands: full (design primers and check specificity)
    parser_full = subparsers.add_parser('full', help='design primers, check their specificity and output specific ones', \
        parents=[parent_parser_all, parent_parser_design, parent_parser_check], \
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    # sub commands: design (design primers only, don't check specificity)
    parser_design = subparsers.add_parser('design', help="design primers only, don't check specificity", \
        parents=[parent_parser_all, parent_parser_design], formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    # sub commands: check (check specificity only, skip the design step)
    parser_check = subparsers.add_parser('check', help='check specificity only, skip the design step', \
        parents=[parent_parser_all, parent_parser_check], formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    args = parser.parse_args()
    return args
예제 #4
0
def index():
    check = config.check()
    if check['status'] == 'error':
        return render_template('error.html', msg=check['msg'])
    else:
        return render_template('index.html', ver=version.get())