Esempio n. 1
0
def add_ion_dnabarcode_set():
    '''List from TS-1517 or, file Barcodes_052611.xlsx
    Added extra T to start of each sequence'''
    blist=[
        "TACTCACGATA",
        "TCGTGTCGCAC",
        "TGATGATTGCC",
        "TCGATAATCTT",
        "TCTTACACCAC",
        "TAGCCAAGTAC",
        "TGACATTACTT",
        "TGCCTTACCGC",
        "TACCGAGGCAC",
        "TGCAAGCCTTC",
        "TACATTACATC",
        "TCAAGCACCGC",
        "TAGCTTACCGC",
        "TCATGATCAAC",
        "TGACCGCATCC",
        "TGGTGTAGCAC"]
    btype='none'
    name='IonSet1'
    adapter = 'CTGCTGTACGGCCAAGGCGT'
    
    # Check for barcode set named 'ionSet1' and remove it
    # this is slightly different than desired name: 'IonSet1'
    allbarcodes = models.dnaBarcode.objects.filter(name='ionSet1')
    if allbarcodes:
        allbarcodes.all().delete()
        
    # Check for barcode set named 'IonSet1'
    allbarcodes = models.dnaBarcode.objects.filter(name=name)
    if allbarcodes:
        allbarcodes.all().delete()
    
    # Add the IonSet1 default barcodes
    index = 1
    for i in blist:
        kwargs = {
            'name':name,
            'id_str':'%s_%02d' % (name,index),
            'sequence':i,
            'type':btype,
            'length':len(i),
            'floworder':'',
            'index':index,
            'annotation':'',
            'adapter':adapter,
            'score_mode':0,
            'score_cutoff':0.90,
        }
        ret = models.dnaBarcode(**kwargs)
        ret.save()
        index += 1
Esempio n. 2
0
def add_barcode_set():
	kwargs = {'name' : 'single_nuke',
		'type' : 'text',
		'sequence' : 'T',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' : 'single_nuke',
		'type' :'text',
		'sequence' : 'A',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' : 'single_nuke',
		'type' : 'text',
		'sequence' : 'C',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' :'single_nuke',
		'type' : 'text',
		'sequence' : 'G',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
Esempio n. 3
0
def add_barcode_set():
	kwargs = {'name' : 'single_nuke',
		'type' : 'text',
		'sequence' : 'T',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' : 'single_nuke',
		'type' :'text',
		'sequence' : 'A',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' : 'single_nuke',
		'type' : 'text',
		'sequence' : 'C',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
	kwargs = {
		'name' :'single_nuke',
		'type' : 'text',
		'sequence' : 'G',
		'length':1,
		'floworder':'TACG'
	}
	ret = models.dnaBarcode(**kwargs)
	ret.save()
Esempio n. 4
0
def add_ion_xpress_dnabarcode_set():
    '''List from jira wiki page:
    https://iontorrent.jira.com/wiki/display/MOLBIO/Ion+Xpress+Barcode+Adapters+1-16+Kit+-+Lot+XXX
    '''
    blist=['CTAAGGTAAC',    #1
           'TAAGGAGAAC',    #2
           'AAGAGGATTC',    #3
           'TACCAAGATC',    #4
           'CAGAAGGAAC',    #5
           'CTGCAAGTTC',    #6
           'TTCGTGATTC',    #7
           'TTCCGATAAC',    #8
           'TGAGCGGAAC',    #9
           'CTGACCGAAC',    #10
           'TCCTCGAATC',    #11
           'TAGGTGGTTC',    #12
           'TCTAACGGAC',    #13
           'TTGGAGTGTC',    #14
           'TCTAGAGGTC',    #15
           'TCTGGATGAC',    #16
           'TCTATTCGTC',    #17
           'AGGCAATTGC',    #18
           'TTAGTCGGAC',    #19
           'CAGATCCATC',    #20
           'TCGCAATTAC',    #21
           'TTCGAGACGC',    #22
           'TGCCACGAAC',    #23
           'AACCTCATTC',    #24
           'CCTGAGATAC',    #25
           'TTACAACCTC',    #26
           'AACCATCCGC',    #27
           'ATCCGGAATC',    #28
           'TCGACCACTC',    #29
           'CGAGGTTATC',    #30
           'TCCAAGCTGC',    #31
           'TCTTACACAC',    #32
           ]
    btype='none'
    name='IonXpress'
    adapter = 'GAT'
    
    # Attempt to read dnabarcode set named 'IonXpress' from dbase
    dnabcs = models.dnaBarcode.objects.filter(name=name)
    if len(dnabcs) > 0:
        print '%s dnaBarcode Set exists in database' % name
        # make sure we have all the sequences we expect
        for index,sequence in enumerate(blist,start=1):
            # Search for this sequence in the list of barcode records
            bc_found = dnabcs.filter(sequence=sequence)
            if len(bc_found) > 1:
                print "ERROR: More than one entry with sequence %s" % sequence
                print "TODO: Fix this situation, Mr. Programmer!"
            if len(bc_found) == 1:
                
                # Make sure floworder field is not 'none'
                if bc_found[0].floworder == 'none':
                    bc_found[0].floworder = ''
                    
                # Make sure id string has zero padded index field
                bc_found[0].id_str = '%s_%03d' % (name,index)
                
                # Save changes to database
                bc_found[0].save()
                
            else:   # array length is zero
                print "Adding entry for %s" % sequence
                kwargs = {
                    'name':name,
                    'id_str':'%s_%03d' % (name,index),
                    'sequence':sequence,
                    'type':btype,
                    'length':len(sequence),
                    'floworder':'',
                    'index':index,
                    'annotation':'',
                    'adapter':adapter,
                    'score_mode':1,
                    'score_cutoff':2.0,
                }
                ret = models.dnaBarcode(**kwargs)
                ret.save()
    else:
        # Add the barcodes because they do not exist.
        # NOTE: name for id_str
        for index,sequence in enumerate(blist,start=1):
            kwargs = {
                'name':name,
                'id_str':'%s_%03d' % (name,index),
                'sequence':sequence,
                'type':btype,
                'length':len(sequence),
                'floworder':'',
                'index':index,
                'annotation':'',
                'adapter':adapter,
                'score_mode':1,
                'score_cutoff':2.0,
            }
            ret = models.dnaBarcode(**kwargs)
            ret.save()
        print '%s dnaBarcode Set added to database' % name
    return
Esempio n. 5
0
def add_or_update_barcode_set(blist,btype,name,adapter):
# Attempt to read dnabarcode set named 'IonXpress' from dbase
    dnabcs = models.dnaBarcode.objects.filter(name=name)
    if len(dnabcs) > 0:
        print '%s dnaBarcode Set exists in database' % name
        # make sure we have all the sequences we expect
        for index,sequence in enumerate(blist,start=1):
            # Search for this sequence in the list of barcode records
            bc_found = dnabcs.filter(sequence=sequence)
            if len(bc_found) > 1:
                print "ERROR: More than one entry with sequence %s" % sequence
                print "TODO: Fix this situation, Mr. Programmer!"
            if len(bc_found) == 1:
                
                # Make sure floworder field is not 'none'
                if bc_found[0].floworder == 'none':
                    bc_found[0].floworder = ''
                    
                # Make sure id string has zero padded index field
                bc_found[0].id_str = '%s_%03d' % (name,index)
                
                # Save changes to database
                bc_found[0].save()
                
            else:   # array length is zero
                print "Adding entry for %s" % sequence
                kwargs = {
                    'name':name,
                    'id_str':'%s_%03d' % (name,index),
                    'sequence':sequence,
                    'type':btype,
                    'length':len(sequence),
                    'floworder':'',
                    'index':index,
                    'annotation':'',
                    'adapter':adapter,
                    'score_mode':1,
                    'score_cutoff':2.0,
                }
                ret = models.dnaBarcode(**kwargs)
                ret.save()
    else:
        # Add the barcodes because they do not exist.
        # NOTE: name for id_str
        for index,sequence in enumerate(blist,start=1):
            kwargs = {
                'name':name,
                'id_str':'%s_%03d' % (name,index),
                'sequence':sequence,
                'type':btype,
                'length':len(sequence),
                'floworder':'',
                'index':index,
                'annotation':'',
                'adapter':adapter,
                'score_mode':1,
                'score_cutoff':2.0,
            }
            ret = models.dnaBarcode(**kwargs)
            ret.save()
        print '%s dnaBarcode Set added to database' % name