コード例 #1
0
ファイル: compute_primers.py プロジェクト: ericmjl/flu-gibson
segmaps['seg8'] = 'NS'

if __name__ == '__main__':

    master_cloning_primers = list()

    for f in os.listdir(os.getcwd()):
        if '.fasta' in f:
            print(f)
            for k, v in segmaps.items():
                if k in f:
                    segment = v
            backbone = plasmids['pDZ-{0}-split2'.format(segment)]
            print(backbone)
            p = PrimerDesigner()
            p.read_sequences(f)
            p.add_sequences(backbone)
            p.construct_graph()
            protocol = p.pcr_protocol()

            f = f.replace('.fasta', '')
            pd.DataFrame(protocol).to_csv('{0}_pcr_protocol.csv'.format(f))
            for n, d in p.nodes(data=True):
                """Grab out the cloning primers."""
                primer_data = dict()
                for drxn in ['fw', 're']:
                    primer_data['part'] = n
                    primer_data['{0}_cloning_primer'.format(drxn)] =\
                        str(d['{0}_cloning_primer'.format(drxn)].seq)
                master_cloning_primers.append(primer_data)
コード例 #2
0
from FluGibson.primer_designer import PrimerDesigner
import os
from Bio.SeqRecord import SeqRecord
import pytest

# Get the directory of this test file.
pkg_dir = os.path.dirname(os.path.abspath(__file__))

os.chdir(os.path.join(pkg_dir, 'test_data'))

p = PrimerDesigner()
p.read_sequences('victoria_np.fasta')
p.construct_graph()


def test_read_sequences():
    assert len(p.sequences) == 2


def test_construct_graph():
    assert len(p.nodes()) == 2
    assert len(p.edges()) == 2


def test_has_part():
    assert p.has_part('Vic_NP')
    assert p.has_part('pCI')


def test_compute_pcr_protocol():
    pass