Ejemplo n.º 1
0
##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

    # find out, whether it is 1. or 2. consensus
    # select the row, col, locus and experiment_id and check, whether there is another one for that
    #hash_ascii_phred = {"!": "0", '"' : "1", "#": "2", "$": "3", "%": "4", "&": "5","'": "6","(": "7",")":"8", "*": "9","+": "10",",":"11","-": "12", "."	: "13","/":"14", "0":"15","1": "16","2": "17","3":  "18", "4": "19", "5": "20", "6": "21","7":"22", "8": "23", "9":"24",":":"25",";": "26","<": "27","=": "28", ">"	: "29", "?" : "30", "@"	: "31", "A"	: "32", "B"	: "33", "C"	:"34", "D"	: "35", "E"	: "36", "F"	: "37", "G"	: "38", "H"	: "39", "I": "40"}
    hash_phred_ascii = {
        '0': '!',
        '1': '"',
        '2': '#',
        '3': '$',
        '4': '%',
        '5': '&',
        '6': "'",
Ejemplo n.º 2
0
                        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,'
    ' igblast_rank, name, eval, score, VDJ_id) VALUES (%s,%s,%s,%s,%s,%s,%s,%s);'
).format(conf['database'], args.targettable)