Beispiel #1
0
        if len(final_sys._strands) > 1:
            base.Logger.log(
                "more than one strand detected - sequence file will not be read",
                base.Logger.WARNING)
            final_sys._strands[0].set_sequence(
                np.random.randint(0, 4, len(final_sys._strands[0]._nucleotides)
                                  ))  # this line does not work

    # # Fix to reverse the direction of every strand so that the 3' to 5' direction is the same
    # # as in Cadnano. In cadnano the strands point in the 5' to 3' direction, whereas in oxDNA
    # # they point in the 3' to 5' direction. Ben 29/11/13
    rev_sys = base.System(final_sys._box)
    for strand in final_sys._strands:
        reverse_nucs = [nuc for nuc in strand._nucleotides]
        reverse_nucs.reverse()
        rev_strand = base.Strand()
        for nuc in reverse_nucs:
            rev_strand.add_nucleotide(
                base.Nucleotide(nuc.cm_pos, nuc._a1, -nuc._a3, nuc._base,
                                nuc._btype))
        if strand._circular:
            rev_strand.make_circular(check_join_len=True)
        rev_sys.add_strand(rev_strand, check_overlap=False)
    # # also reverse the vhelix_vbase_to_nucleotide order so it corresponds to the reversed system
    vh_vb2nuc_rev = cu.vhelix_vbase_to_nucleotide()
    # count the number of nucleotides up to but not including the nucleotides in strand ii
    nnucs_to_here = range(rev_sys._N_strands)
    nuc_total = 0
    for strandii, strand in enumerate(rev_sys._strands):
        nnucs_to_here[strandii] = nuc_total
        nuc_total += len(strand._nucleotides)
Beispiel #2
0
        print >> sys.stderr, "USAGE: %s lammps_data_file [lammps_trajectory_file]" % sys.argv[
            0]
        sys.exit(1)

    conf = reader_lammps_init.Lammps_parser(sys.argv[1])
    N = conf.natoms
    box = np.array([0, 0., 0.])
    box[0] = conf.Lx
    box[1] = conf.Ly
    box[2] = conf.Lz

    system = base.System(box)

    strands = []
    for i in range(conf.nstrands):
        strands.append(base.Strand())

    for i in range(N):
        cm = conf.xyz[i, :]
        quaternions = conf.ellipsoids[i, :]
        a1, a3 = quat_to_exyz(quaternions)
        b = number_oxdna_to_lammps[(conf.bases[i] + 3) % 4]

        v = np.array(conf.v[i, :]) * np.sqrt(mass_in_lammps)
        Lv = np.array(conf.Lv[i, :]) / np.sqrt(inertia_in_lammps)

        strands[conf.strand[i] - 1].add_nucleotide(
            base.Nucleotide(cm, a1, a3, b, b, v, Lv))

        # close strand
        next_bond = conf.bonds[i][1]
Beispiel #3
0
 box_high = np.array([-1e6, -1e6, -1e6], dtype=np.float64)
 for nucl in itertools.chain(*pdb_strands):
     com = nucl.get_com()
     for i in range(3):
         if com[i] < box_low[i]:
             box_low[i] = com[i]
         elif com[i] > box_high[i]:
             box_high[i] = com[i]
             
 L = 2 * np.max(box_high - box_low) * FROM_ANGSTROM_TO_OXDNA
 box = np.array([L, L, L])
 
 print >> sys.stderr, "Using a box of size %g in oxDNA units (twice as big as the PDB bounding box size)" % (L)
 
 system = base.System(box)
 strand = base.Strand()
 
 for pdb_strand in pdb_strands:
     strand = base.Strand()
     
     for nucl in pdb_strand:
         nucl.compute_as()
         
         com = nucl.get_com() * FROM_ANGSTROM_TO_OXDNA
         new_oxDNA_nucl = base.Nucleotide(com, nucl.a1, nucl.a3, nucl.base[0])
         strand.add_nucleotide(new_oxDNA_nucl)
         
     system.add_strand(strand, check_overlap=False)
             
 basename = os.path.basename(pdb_file)
 topology_file = basename + ".top"
Beispiel #4
0
            print >> sys.stderr, "The sequence file '%s' is unreadable" % opts.sequence_file
            exit(1)

        contents = seq_file.read()
        # remove all whitespace from the file's contents
        sequence = ''.join(contents.split())
        if len(sequence) != nbases:
            print >> sys.stderr, "The length of the given sequence (%d) should be equal to the number of coordinates in the centerline file (%d)" % (
                len(sequence), nbases)
            exit(1)

        ssdna1_base = map(lambda x: base.base_to_number[x], sequence)

        seq_file.close()

    strand1 = base.Strand()
    for c in range(nbases):
        b = ssdna1_base[c]
        strand1.add_nucleotide(
            base.Nucleotide(ssdna1[c], v_perp_ssdna1[c], dist_norm[c], b, b))
    if opts.closed:
        strand1.make_circular()
    system.add_strand(strand1)

    if opts.double:
        strand2 = base.Strand()
        for c in range(nbases):
            reverse_idx = nbases - 1 - c
            b = 3 - ssdna1_base[reverse_idx]
            strand2.add_nucleotide(
                base.Nucleotide(ssdna2[reverse_idx],