Example #1
0
 def save(self, commit=True):
     instance = super(DnaSampleForm, self).save(commit=False)
     #instance.historyDescription = self.cleaned_data['genebank'] # etc
     
     if self.cleaned_data['dnaConstruct']==None:
         dna2db = DnaComponent(displayId=self.cleaned_data['DNA_Display_ID'],description=self.cleaned_data['DNA_Description'], name =self.cleaned_data['DNA_Name'], sequence = self.cleaned_data['sequence'],status = self.cleaned_data['DNA_Status'], genBankfile = self.cleaned_data['genebank'])
         dna2db.saveSequenceWithoutAnnotations()
         #dna2db.save()
         instance.dnaConstruct = dna2db
     else:
         instance.dnaConstruct = self.cleaned_data['dnaConstruct']
     if commit:
         instance.save()
     return instance 
Example #2
0
    def save(self, commit=True):
        instance = super(DnaSampleForm, self).save(commit=False)
        #instance.historyDescription = self.cleaned_data['genebank'] # etc

        if self.cleaned_data['dnaConstruct'] == None:
            dna2db = DnaComponent(
                displayId=self.cleaned_data['DNA_Display_ID'],
                description=self.cleaned_data['DNA_Description'],
                name=self.cleaned_data['DNA_Name'],
                sequence=self.cleaned_data['sequence'],
                status=self.cleaned_data['DNA_Status'],
                genBankfile=self.cleaned_data['genebank'])
            dna2db.saveSequenceWithoutAnnotations()
            #dna2db.save()
            instance.dnaConstruct = dna2db
        else:
            instance.dnaConstruct = self.cleaned_data['dnaConstruct']
        if commit:
            instance.save()
        return instance
Example #3
0
                    fir = fullSequence[first:]
                    sec = fullSequence[:secon]
                    seq = fir+sec
                else:
                    seq = fullSequence[first:secon]
                name=obj["text3"]
                descrp=obj["text4"]
                dnatype=obj["text5"]
                optimizedfor=obj["text7"].split(' - ')
                try:
                    chassisOptimizedFor = Chassis.objects.get(displayId=optimizedfor[0])
                except Chassis.DoesNotExist:
                    chassisOptimizedFor = None
                subCtVectorType = DnaComponentType.objects.filter(name__in=[dnatype,'Annotation'])	

                dnaAnnot = DnaComponent(displayId=id,description=descrp, name =name, sequence = seq,optimizedFor = chassisOptimizedFor, created_by = created_by)
                dnaAnnot.save()
                if (id.upper()=='(AUTO)' or id.upper()==''):
                    
                    if (dnatype=='Vector Backbone' or dnatype=='Vector'):
                        lastComponent = DnaComponent.objects.filter(displayId__regex='^Ve.*').order_by('-displayId')[:1]
                        leng = len(lastComponent)
                        if leng>0:
                            lastComponentDisplayID = int(lastComponent[0].displayId[2:])
                        else:
                            lastComponentDisplayID = 0                                
                        
                        #pkUsed = dnaAnnot.pk
                        pkUsed = lastComponentDisplayID + 1
                        stringId = '00000000'+str(pkUsed)                                
                        stringId = stringId[-3:]
Example #4
0
                    seq = fullSequence[first:secon]
                name = obj["text3"]
                descrp = obj["text4"]
                dnatype = obj["text5"]
                optimizedfor = obj["text7"].split(' - ')
                try:
                    chassisOptimizedFor = Chassis.objects.get(
                        displayId=optimizedfor[0])
                except Chassis.DoesNotExist:
                    chassisOptimizedFor = None
                subCtVectorType = DnaComponentType.objects.filter(
                    name__in=[dnatype, 'Annotation'])

                dnaAnnot = DnaComponent(displayId=id,
                                        description=descrp,
                                        name=name,
                                        sequence=seq,
                                        optimizedFor=chassisOptimizedFor,
                                        created_by=created_by)
                dnaAnnot.save()
                if (id.upper() == '(AUTO)' or id.upper() == ''):

                    if (dnatype == 'Vector Backbone' or dnatype == 'Vector'):
                        lastComponent = DnaComponent.objects.filter(
                            displayId__regex='^Ve.*').order_by(
                                '-displayId')[:1]
                        leng = len(lastComponent)
                        if leng > 0:
                            lastComponentDisplayID = int(
                                lastComponent[0].displayId[2:])
                        else:
                            lastComponentDisplayID = 0