Exemplo n.º 1
0
# Created: August 26th 2019

"""

import argparse
from argparse import RawTextHelpFormatter
from Bio import AlignIO
import os
import bcelldb_init as binit
import collections
import math
from math import *
##usage -> todb_consensus_sequences.pl -aln <musclealign> [-h]
##get configuartion for scireptor

config_scireptor = binit.get_config()

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description=__doc__,
                                     formatter_class=RawTextHelpFormatter)
    parser.add_argument('-aln',
                        '--alignment',
                        required=True,
                        help="define input file")
    args = parser.parse_args()
    align = args.alignment
    ### 1. Prepare database for insertion of sequence
    conn = binit.connect()
    ##create a cursor object
    cursor = conn.cursor()
    ###prepare insert command
"""
bcelldb_plotting.py

Module that contains standard funtions for plotting data from the igdb.
"""

import bcelldb_init as bcelldb
import matplotlib as mpl
mpl.use('Agg')
import numpy as np
import numpy.random as random
import sys
import colorsys
from datetime import datetime as dt

conf = bcelldb.get_config()

# Get log information for a plot
# date, user, database, software version
# config file variables

def plot_log (object_name, args, db, short='T'):
    
    """
    Arguments:
        - args: sys.args 
        - verbose
    Return string for logging how plot was generated.
    Short: For titles in PDF.
    Long: also logging script that was executed to generate the plot
    """
Exemplo n.º 3
0
    required=True,
    help="where VDJ info will be written. Can be reads_VDJ_segments or VDJ_\
                        segments according to where the sequences in the IgBLAST analysis came from."
)
parser.add_argument(
    "-ut",
    "--updatetable",
    required=True,
    help="Table that will be updated according to what was found\
                        by IgBLAST (orientation, locus). Can be reads or sequences."
)
args = parser.parse_args()

### 0. Logging information (TBD) # get configuration using bcelldb_init

conf = binit.get_config()

db = binit.connect()
cursor = db.cursor()

### 1. Open IgBLAST output file

try:
    in_igblast = open(args.igblastoutput, "r")
except FileNotFoundError:
    print('\n\tBLAST output {} not found\n').format(args.igblastoutput)

# ### 2. Set up database handles for inserting to VDJ table and updating position

ins_VDJ_sth = (
    'INSERT IGNORE INTO {}.{} (seq_id, type, locus,'
import matplotlib.colorbar as cbar
import MySQLdb as mysql
from datetime import datetime as dt

import bcelldb_init as bcelldb

# get command line arguments
experiment_id = sys.argv[1]
runname = sys.argv[2]
try:
    greyscale = sys.argv[3]
except IndexError:
    greyscale = ''

# get configuration using bcelldb_init
conf = bcelldb.get_config()

# connect to database via ~/.my.conf settings
db = mysql.connect(db=conf['database'],
                   read_default_file="~/.my.cnf",
                   read_default_group=conf['db_group_auth'])
cursor = db.cursor()

# defining common variables
project = conf['database']

ncols, nrows = map(int, conf['matrix'].split('_'))
nrows_per_plate = int(conf['nrows_per_plate'])
ncols_per_plate = int(conf['ncols_per_plate'])
loci = ['B', 'A']