def load_orphan_sample(rowdic):
    print rowdic

    sampleid = rowdic['sampleid']

    newsampleobj = Sample()
    if Sample.objects.filter(sampleid=sampleid).exists():
        newsampleobj = Sample.objects.get(sampleid=sampleid)


    newsampleobj.sampleid = sampleid
    # Things not in spread sheet but essential
    newsampleobj.sampletype = "RNA"
    newsampleobj.growthphase = Growthphase.objects.get(growthphase="log")
    newsampleobj.phenotype = Phenotype.objects.get(phenotype="wildtype")
    newsampleobj.author_modified = User.objects.get(username="******")
    newsampleobj.sourcename = Source.objects.get(pk=1)
    # Things From spread sheet

    #
    parentsampleid = "None"
    if sampleid[-1].isdigit():
        parentsampleid = "None"
    else:
        parentsampleid = rowdic['sampleid'][:-1]
    print parentsampleid
    newsampleobj.parent_sampleid = parentsampleid;

    #
    label_ontube = rowdic['oncap']
    if rowdic['ontube']:
        label_ontube =  rowdic['oncap'] + ' / ' + rowdic['ontube']
    newsampleobj.label_ontube = label_ontube

    #
    newsampleobj.genotype = Genotype.objects.get(genotype=rowdic['genotype'])
    newsampleobj.lifestage = Lifestage.objects.get(lifestage=rowdic['stage'])
    print rowdic['genus']
    print rowdic['species']
    print rowdic['strain']
    print rowdic['dateisolated']
    newsampleobj.organism = Organism.objects.get(genus=rowdic['genus'], species=rowdic['species'], strain=rowdic['strain'])
    if rowdic['dateisolated']:
        newsampleobj.collected_on = rowdic['dateisolated']
    newsampleobj.collected_by = rowdic['sender']
    newsampleobj.collected_by_emailid = rowdic['senderemailid']
    newsampleobj.isolation_method = rowdic['isolationmethod']
    newsampleobj.sample_dilution = rowdic['dilution']
    if rowdic['daterecieved']:
        newsampleobj.date_received  = rowdic['daterecieved']
    newsampleobj.sample_concentration = rowdic['concentration']
    newsampleobj.sample_volume = rowdic['volume']
    newsampleobj.sample_quantity = rowdic['quantity']
    newsampleobj.biological_replicate_of = rowdic['replicate']

    newsampleobj.freezer_location = rowdic['freezerlocation']
    #
    newsampleobj.sample_notes = rowdic['notesfromsender']
    print rowdic['pi']
    newsampleobj.collaborator = Collaborator.objects.get(lastname=rowdic['pi'])

    print newsampleobj
    newsampleobj.save()
Esempio n. 2
0
def load_orphan_sample(rowdic):
    print rowdic

    sampleid = rowdic['sampleid']

    newsampleobj = Sample()
    if Sample.objects.filter(sampleid=sampleid).exists():
        newsampleobj = Sample.objects.get(sampleid=sampleid)

    newsampleobj.sampleid = sampleid
    # Things not in spread sheet but essential
    newsampleobj.sampletype = "RNA"
    newsampleobj.growthphase = Growthphase.objects.get(growthphase="log")
    newsampleobj.phenotype = Phenotype.objects.get(phenotype="wildtype")
    newsampleobj.author_modified = User.objects.get(username="******")
    newsampleobj.sourcename = Source.objects.get(pk=1)
    # Things From spread sheet

    #
    parentsampleid = "None"
    if sampleid[-1].isdigit():
        parentsampleid = "None"
    else:
        parentsampleid = rowdic['sampleid'][:-1]
    print parentsampleid
    newsampleobj.parent_sampleid = parentsampleid

    #
    label_ontube = rowdic['oncap']
    if rowdic['ontube']:
        label_ontube = rowdic['oncap'] + ' / ' + rowdic['ontube']
    newsampleobj.label_ontube = label_ontube

    #
    newsampleobj.genotype = Genotype.objects.get(genotype=rowdic['genotype'])
    newsampleobj.lifestage = Lifestage.objects.get(lifestage=rowdic['stage'])
    print rowdic['genus']
    print rowdic['species']
    print rowdic['strain']
    print rowdic['dateisolated']
    newsampleobj.organism = Organism.objects.get(genus=rowdic['genus'],
                                                 species=rowdic['species'],
                                                 strain=rowdic['strain'])
    if rowdic['dateisolated']:
        newsampleobj.collected_on = rowdic['dateisolated']
    newsampleobj.collected_by = rowdic['sender']
    newsampleobj.collected_by_emailid = rowdic['senderemailid']
    newsampleobj.isolation_method = rowdic['isolationmethod']
    newsampleobj.sample_dilution = rowdic['dilution']
    if rowdic['daterecieved']:
        newsampleobj.date_received = rowdic['daterecieved']
    newsampleobj.sample_concentration = rowdic['concentration']
    newsampleobj.sample_volume = rowdic['volume']
    newsampleobj.sample_quantity = rowdic['quantity']
    newsampleobj.biological_replicate_of = rowdic['replicate']

    newsampleobj.freezer_location = rowdic['freezerlocation']
    #
    newsampleobj.sample_notes = rowdic['notesfromsender']
    print rowdic['pi']
    newsampleobj.collaborator = Collaborator.objects.get(lastname=rowdic['pi'])

    print newsampleobj
    newsampleobj.save()
            sampleobj.treatment = libobj.treatment
            sampleobj.collected_at  = libobj.collected_at

            # from spread sheet
            if rowdic['dateisolated']:
                sampleobj.collected_on = rowdic['dateisolated']
            sampleobj.collected_by = rowdic['sender']
            sampleobj.collected_by_emailid = rowdic['senderemailid']
            sampleobj.isolation_method = rowdic['isolationmethod']
            if rowdic['daterecieved']:
                sampleobj.date_received = rowdic['daterecieved']
            sampleobj.sample_concentration = rowdic['concentration']
            sampleobj.sample_volume = rowdic['volume']
            sampleobj.sample_quantity = rowdic['quantity']
            sampleobj.sample_dilution = rowdic['dilution']
            sampleobj.biological_replicate_of = rowdic['replicate']
            sampleobj.freezer_location = rowdic['freezerlocation']
            sampleobj.sample_notes = libobj.sample_notes + "\n" + rowdic['notesfromsender']
            #
            parentsampleid = "None"
            if sampleid[-1].isdigit():
                parentsampleid = "None"
            else:
                parentsampleid = rowdic['sampleid'][:-1]
            print parentsampleid
            sampleobj.parent_sampleid = parentsampleid

            sampleobj.author_modified = User.objects.get(username="******")

            print sampleobj
            sampleobj.save()
Esempio n. 4
0
            sampleobj.treatment = libobj.treatment
            sampleobj.collected_at = libobj.collected_at

            # from spread sheet
            if rowdic['dateisolated']:
                sampleobj.collected_on = rowdic['dateisolated']
            sampleobj.collected_by = rowdic['sender']
            sampleobj.collected_by_emailid = rowdic['senderemailid']
            sampleobj.isolation_method = rowdic['isolationmethod']
            if rowdic['daterecieved']:
                sampleobj.date_received = rowdic['daterecieved']
            sampleobj.sample_concentration = rowdic['concentration']
            sampleobj.sample_volume = rowdic['volume']
            sampleobj.sample_quantity = rowdic['quantity']
            sampleobj.sample_dilution = rowdic['dilution']
            sampleobj.biological_replicate_of = rowdic['replicate']
            sampleobj.freezer_location = rowdic['freezerlocation']
            sampleobj.sample_notes = libobj.sample_notes + "\n" + rowdic[
                'notesfromsender']
            #
            parentsampleid = "None"
            if sampleid[-1].isdigit():
                parentsampleid = "None"
            else:
                parentsampleid = rowdic['sampleid'][:-1]
            print parentsampleid
            sampleobj.parent_sampleid = parentsampleid

            sampleobj.author_modified = User.objects.get(username="******")

            print sampleobj