コード例 #1
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def update_sequence_details(sequence):
    # Update the first component id and
    # component count of the sequence's fields
    # Query for the first component matched
    comp = session.query(Component).filter_by(
            SequenceID = sequence.SequenceID).first()
    sequence.first_component = comp
    sequence.Valid = True
    session.commit()
コード例 #2
0
ファイル: populatedb.py プロジェクト: henryeherman/pyelixys
def create_sequence(user_id):
    # Create a new sequence for the user
    new_seq = Sequence()
    new_seq.Name = 'Sequence 1'
    new_seq.Component = 'Test Sequence'
    new_seq.Type = 'Saved'
    new_seq.UserID = user_id
    session.add(new_seq)
    session.commit()
    return new_seq
コード例 #3
0
ファイル: populatedb.py プロジェクト: henryeherman/pyelixys
def update_sequence_details(sequence):
    # Update the first component id and
    # component count of the sequence's fields
    # Query for the first component matched
    component_id = session.query(Component).filter_by(
            SequenceID = sequence.SequenceID).first().ComponentID
    sequence.FirstComponentID = component_id
    sequence.ComponentCount = 3
    sequence.Valid = 1
    session.commit()
コード例 #4
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def create_reagents(cassettes):
    # Let's create some empty reagents
    # For each of the 3 cassettes, create
    # 12 reagents
    for cassette in cassettes:
        for reg_count in range(1,13):
            reagent = Reagent()
            reagent.Position = reg_count
            reagent.component = cassette
            session.add(reagent)
            session.commit()
コード例 #5
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def create_sequence(user):
    # Create a new sequence for the user
    new_seq = Sequence()
    new_seq.Name = 'Sequence 1'
    new_seq.Component = 'Test Sequence'
    new_seq.Type = 'Saved'
    new_seq.user = user
    session.add(new_seq)
    session.commit()
    user.selected_sequence = new_seq
    session.commit()
    return new_seq
コード例 #6
0
ファイル: populatedb.py プロジェクト: henryeherman/pyelixys
def update_component_details(cassettes):
    # Update the details field of each new
    # cassette component
    # Keep a reactor count
    reactor_count = 1
    for cassette in cassettes:
        cassette.Details = json.dumps(
                get_default_component_state(
                cassette,
                reactor_count))
        session.commit()
        reactor_count += 1
コード例 #7
0
ファイル: populatedb.py プロジェクト: henryeherman/pyelixys
def create_reagents(sequence_id, cassettes):
    # Let's create some empty reagents
    # For each of the 3 cassettes, create
    # 12 reagents
    for cassette in cassettes:
        for reg_count in range(1,13):
            reagent = Reagents()
            reagent.SequenceID = sequence_id
            reagent.Position = reg_count
            reagent.component = cassette
            reagent.ComponentID = cassette.ComponentID
            session.add(reagent)
            session.commit()
コード例 #8
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def create_cassette_components(sequence):
    # Create a new set of component cassettes
    cass_list = []
    for cass_count in range(1,4):
        new_comp = Component()
        new_comp.sequence = sequence
        new_comp.Type = 'CASSETTE'
        new_comp.Note = ''
        # Leave details empty, update later
        new_comp.Details = ''
        session.add(new_comp)
        session.commit()
        cass_list.append(new_comp)
    return cass_list
コード例 #9
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def create_user(role):
    # Let's create a default user
    # Encrypt the password using md5 and reutrn as hex
    new_user = User()
    new_user.Username = '******'
    new_user.Password = hashlib.md5('devel').hexdigest()
    new_user.FirstName = 'Sofiebio'
    new_user.LastName = 'Developer'
    new_user.Email = '*****@*****.**'
    new_user.role = role
    new_user.ClientState = json.dumps(
            get_default_user_client_state())
    session.add(new_user)
    session.commit()

    return new_user
コード例 #10
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def update_component_details(cassettes):
    # Update the details field of each new
    # cassette component
    # Keep a reactor count
    reactor_count = 1

    previous_cassette = None
    for cassette in cassettes:
        cassette.Details = json.dumps(
                get_default_component_state(
                cassette,
                reactor_count))
        session.commit()
        reactor_count += 1
        if not previous_cassette is None:
            cassette.previous_component = previous_cassette
            session.commit()
            previous_cassette.next_component = cassette
            session.commit()


        previous_cassette = cassette
コード例 #11
0
ファイル: populatedb.py プロジェクト: mgramli1/pyelixys
def create_role():
    # Create admin role
    role = Role('Administrator', 255)
    session.add(role)
    session.commit()
    return role