示例#1
0
def main(number: int = 10, double: bool = False):
    # Add Strand 1 - ssDNA
    n = number
    nucleotides = []
    print("Creating a nucleotide:")
    nucleotides.append(
        Nucleotide(random.choice(['A', 'T', 'C', 'G']),
                   np.array([0., -10., 0.]),
                   a1=np.array([1., 0., 0.]),
                   a3=np.array([0., 1., 0.])))
    print(f"Nucleotide #0: {nucleotides[0]}")
    print("Creating more nucleotides...\n")
    for i in range(n):
        nucleotides.append(
            get_5p(nucleotides[-1], base=random.choice(['A', 'T', 'C', 'G'])))
    strand = Strand(nucleotides=nucleotides)
    print(f"Strand: {strand}")
    system = System(np.array([20., 20., 20.]))
    system.add_strand(strand)
    # Add Strand 2 - complementary ssDNA -> dsDNA
    if double:
        nucleotides = []
        for nucleotide in strand.nucleotides[::-1]:
            nucleotides.append(get_across(nucleotide))
    #    for i in range(10):
    #        nucleotides.append(get_5p(nucleotides[-1]))
        strand = Strand(nucleotides=nucleotides)
        print(f"Adding double: {strand}")
        system.add_strand(strand)
    system.write_oxDNA('local')
    return
示例#2
0
def main(length=17, n_strands=10, output_format='oxdna'):
    # generate a strand
    strands = []
    staples = []
    strand, staple = generate_helix(n=length, double=True)
    staples.append(staple.copy())
    strands.append(strand.copy())

    for i in range(n_strands - 1):

        last_nuc = strands[-1].nucleotides[-1]
        direction = -last_nuc._a3
        a1 = -last_nuc._a1

        # ensure the backbone position is FENE_LENGTH away from
        # the backbone position of the previous nucleotide
        start = last_nuc.pos_back + (FENE_LENGTH - POS_BACK) * a1

        # generate strand above that's going in opposite direction
        strand, staple = generate_helix(n=length,
                                        start_position=start,
                                        direction=direction,
                                        a1=a1,
                                        double=True)
        strands.append(strand.copy())
        staples.append(staple.copy())

    print(staples)

    # using the two previously created strands create a new strand that
    # we will add to the system
    nucleotides = []
    for strand in strands:
        nucleotides += strand.nucleotides
    strand = Strand(nucleotides=nucleotides)

    # create system and add the final completed strand
    system = System(np.array([50., 50., 50.]))
    system.add_strand(strand)

    # create staples from staple list
    # iterate over every 2 staples in reverse
    # and append the last onto the first, and add to the system
    staples = staples[::-1]
    completed_staples = []
    for i, staple in enumerate(staples):
        if i % 2 != 0:
            continue
        try:
            new_nucleotides = []
            new_nucleotides += staples[i + 1].nucleotides
            new_nucleotides += staple.nucleotides
            new_staple = Strand(nucleotides=new_nucleotides)
            system.add_strand(new_staple.copy())
        except IndexError:
            pass
    if output_format.lower() == 'oxdna':
        system.write_oxDNA('stapled_turns')
    elif output_format.lower() == 'lammps':
        system.write_lammps_data('stapled_turns')
示例#3
0
def main(strands: bool = True, edges: bool = False):
    system = System(np.array([30., 30., 30.]))
    if strands:
        system.add_strands(with_strands())
    if edges:
        system.add_strands(with_edges())
    system.write_oxDNA('connect')
    return
示例#4
0
def main():
    strand = long_strand()
    print(f"Strand:\n    {strand}")
    print(f"    Length between bases of the end nucleotides: {strand_length(strand)}")
    route = long_route()
    print(f"\nSingle-Edge Route:\n    {route}")
    print(f"    Length between bases of the end nucleotides: {strand_length(route)}")
    multi = multi_route()
    print(f"\nDouble-Edge Route:\n    {multi}")
    print(f"    Length between bases of the end nucleotides: {strand_length(multi)}")
    system = System(np.array([50., 50., 50.]))
    system.add_strands([strand, route, multi])
    system.write_oxDNA('route')
    return
示例#5
0
def test_route():
    nodes = [
        LatticeNode(np.array([0., 10., 0.])),
        LatticeNode(np.array([0., 30., 0.])),
        LatticeNode(np.array([30., 30., 0.])),
        LatticeNode(np.array([30., 10., 0.])),
    ]
    route = LatticeRoute(nodes)
    assert len(route.edges) == 3
    system = System(np.array([50., 50., 50.]))
    system.add_strand(route)
    assert len(system.strands) == 1
    system = route.system(box=np.array([50., 50., 50.]))
    assert len(system.strands) == 1
    system.write_oxDNA(root=ROOT)
    return route
示例#6
0
def main(length=16, n_strands=10):
    # generate a strand
    strands = []
    doubles = []
    strand, double = generate_helix(n=length, double=True)
    strands.append(strand.copy())
    doubles.append(double.copy())

    for i in range(n_strands - 1):

        last_nuc = strands[-1].nucleotides[-1]
        direction = -last_nuc._a3
        a1 = -last_nuc._a1

        # ensure the backbone position is FENE_LENGTH away from
        # the backbone position of the previous nucleotide
        start = last_nuc.pos_back + (FENE_LENGTH - POS_BACK) * a1

        # generate strand above that's going in opposite direction
        strand, double = generate_helix(
            n=length,
            start_position=start,
            direction=direction,
            a1=a1,
            double=True,
        )
        strands.append(strand)
        doubles.append(double)

    # using the two previously created strands create a new strand that
    # we will add to the system
    nucleotides = []
    for strand in strands:
        nucleotides += strand.nucleotides
    strand = Strand(nucleotides=nucleotides)

    # create system and add the final completed strand
    system = System(np.array([20., 20., 20.]))
    system.add_strand(strand)

    actual_doubles = []
    for strand in doubles:
        nucleotides = strand.nucleotides[:5]
        actual_doubles.append(Strand(nucleotides=nucleotides))

    system.add_strands(actual_doubles)
    system.write_oxDNA('turns')
                        .format(file_path),
                        shell=True)

                #Delete all previously generated .turns.top and .turns.conf files out of /sim folder:
                #shutil.move(file_path + '/' + './oxdna.turns.top','./oxdna.turns.top')
                #shutil.move(file_path + '/' + './oxdna.turns.conf', './oxdna.turns.conf')
                #shutil.move(file_path + '/' + './oxdna.turns.conf.pdb', './oxdna.turns.conf.pdb')
                os.remove(file_path + '/' + './oxdna.turns.top')
                os.remove(file_path + '/' + './oxdna.turns.conf')
                os.remove(file_path + '/' + './oxdna.turns.conf.pdb')

                #remove sim_path folder before running the final simulation of mother_system
                shutil.rmtree(sim_path)

                #write mother_system to oxDNA input (.conf and .top)
                mother_system.write_oxDNA('mother_turns')

                #move oxDNA files to simulation folder
                shutil.move('./oxdna.mother_turns.top',
                            file_path + '/' + './oxdna.mother_turns.top')
                shutil.move('./oxdna.mother_turns.conf',
                            file_path + '/' + './oxdna.mother_turns.conf')

                #Convert oxDNA output files to .pdb input file format
                subprocess.call(
                    "bash -c \"source ~/.bashrc && module load CUDA && cd {} && python3 /home/fiona/tacoxDNA-python3/src/oxDNA_PDB.py oxdna.mother_turns.top oxdna.mother_turns.conf 35\""
                    .format(file_path),
                    shell=True)

                #Running mrdna simulation with the .pdb input file from the MOTHER_SYSTEM
                subprocess.call(
示例#8
0
def test_square():
    route = square_route()
    system = System(np.array([50.0, 50.0, 50.0]))
    system.add_strand(route)
    system.write_oxDNA(root=ROOT)