Beispiel #1
0
                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)

    # fill in the _scaf and _stap dicts for the reverse vhelix_vbase_to_nucleotide object
    for vh, vb in vh_vb2nuc_final._scaf.keys():
        strandii, nuciis = vh_vb2nuc_final._scaf[(vh, vb)]
Beispiel #2
0
         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"
 configuration_file = basename + ".oxdna"
 system.print_lorenzo_output(configuration_file, topology_file)
 
 print >> sys.stderr, "## Wrote data to '%s' / '%s'" % (configuration_file, topology_file)
 print >> sys.stderr, "## DONE"
 
Beispiel #3
0
        # 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],
                                v_perp_ssdna2[reverse_idx],
                                -dist_norm[reverse_idx], b, b))
        if opts.closed and not opts.nicked:
            strand2.make_circular()
Beispiel #4
0
    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]
        if next_bond != -1 and next_bond != i + 1:
            if conf.strand[i] != conf.strand[next_bond]:
                print >> sys.stderr, "Wrong bond arising between two different strands"
            else:
                strands[conf.strand[i] - 1].make_circular()

    for i in range(conf.nstrands):
        system.add_strand(strands[i])

    basename = os.path.basename(sys.argv[1])
    topology_file = basename + ".top"
    configuration_file = basename + ".oxdna"
Beispiel #5
0
			
		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], v_perp_ssdna2[reverse_idx], -dist_norm[reverse_idx], b, b))
		if opts.closed and not opts.nicked:
			strand2.make_circular()
		system.add_strand(strand2)
		
	basename = os.path.basename(sys.argv[1])