Photredox reaction on DNA #memo #chemistry

Today I found very interesting article from researchers who is working at pfizer and Hitgen.

https://pubs.acs.org/doi/10.1021/acscombsci.9b00076

Pfizer and Hitgen launched drug discovery collaboration two years ago.
https://www.genengnews.com/topics/drug-discovery/pfizer-hitgen-launch-drug-discovery-collaboration/

Hitgen is one of CRO with DNA-encoded library as core technology.

In the article the authors reported that they conducted photoredox reaction on DNA tag.

Photoredox reaction is very useful tool for medchem because it can perform C(sp3)-C(sp3) coupling in one step which is difficult to do with old traditional chemistry.

DeNA Encoded Library(DELI) is powerful method to generate large number of molecules however available reaction is limited for not DNA damaging reaction. So it is not suitable for DELI production which has harsh reaction conditions.

At first they optimized coupling reaction condition of decarboxylateve coupling between aryl-iodide and aliphatic carboxylic acid. Main side reaction is reductive de haloganation product. But they found good reaction condition and the condition can work very well.

Table 2 shows many examples of the coupling reaction with moderate ~ high yield. And table 3 shows that the reaction can apply for not only phenyl iodide but also hetero cycles. Such as pyridine, pyrimidine etc.

There are few examples at ortho position with moderate yield. Maybe it is steric effect.

Finally they showed example of parallel synthesis via LED Array.

Scheme3-c) shows 96 well prate type LED reactor. It is very beautiful ;)

To prevent oxygen exposure, they degassed and sealed the plate.

And also they tried different type of photoredox reaction such as desulfinative coupling, deborylative coupling adn cross electrophile coupling and all reaction progressed with moderate yield.

Optimized reaction conducted in DMSO/H2O media with room temperature.

Combination of new technology is always exciting isn’t it?

SVM on quantum computing! #quantumcomputing #qiskit

Support vector machine is one of major method of machine learning. It very useful and powerful algorithm. However, SVM is not suitable for large size dataset.

Recently I’m learning QISKIT and qiskit has an attractive method named QSVM.

It means that perform SVM on quantum circuit!

Dose it sound fun?

Original URL of the paper is below.
https://arxiv.org/pdf/1804.11326.pdf

The author of the article defined quantum kernel functions for quantum SVM. The merit of quantum computing for SVM is parallel. Because quantum computing can generates entangle state which is parallel world.

And fortunately qiskit has QSVM method that means we can QSVM very conveniently!

Today I tried to use QSVM to iris dataset for practice.

At first, import packages and dataset.

import numpy as np
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import qiskit
from qiskit import BasicAer
from qiskit.aqua import QuantumInstance
from qiskit.aqua.algorithms import QSVM
from qiskit.aqua.components.multiclass_extensions import one_against_rest, all_pairs
from qiskit.aqua.components.feature_maps import SecondOrderExpansion
from qiskit.aqua.input import ClassificationInput
from qiskit.aqua import run_algorithm
backend = BasicAer.get_backend('qasm_simulator')
iris = load_iris()

 
X, Y = iris.data, iris.target
print(X.shape)
print(len(set(Y)))
train_x, test_x, train_y, test_y = train_test_split(X, Y, test_size=0.2)
num_features = 4
training_size = 120
test_size = 30
feature_map = SecondOrderExpansion(feature_dimension=num_features, depth=2)

Then split data for train and test. Iris data set has 4 features so I defined num_features=4, it will be number of qubit.

X, Y = iris.data, iris.target
print(X.shape)
print(len(set(Y)))
train_x, test_x, train_y, test_y = train_test_split(X, Y, test_size=0.2)
feature_map = SecondOrderExpansion(feature_dimension=num_features, depth=2) 

Next defined parameters for QSVM and transformed data for QSVM.

params = {
            'problem': {'name': 'classification'},
            'algorithm': {
                'name': 'QSVM',
            },
            'multiclass_extension': {'name': 'OneAgainstRest'},
            'feature_map': {'name': 'SecondOrderExpansion', 'depth': 2 }
}

params = {
            'problem': {'name': 'classification', 'random_seed': 794},
            'algorithm': {
                'name': 'QSVM',
            },
            'backend': {'shots': 1024},
            'multiclass_extension': {'name': 'OneAgainstRest'},
            #'feature_map': {'name': 'SecondOrderExpansion', 'depth': 2, 'entangler_map': [[0, 1]]}
            'feature_map': {'name': 'SecondOrderExpansion', 'depth': 2}
    
        }
 training_dataset={'A':train_x[train_y==0],
                'B':train_x[train_y==1],
                'C':train_x[train_y==2]}
test_dataset={'A':test_x[test_y==0],
                        'B':test_x[test_y==1],
                        'C':test_x[test_y==2]}
total_arr = np.concatenate((test_dataset['A'],test_dataset['B'],test_dataset['C']))
alg_input = ClassificationInput(training_dataset, test_dataset, total_arr)

Finally let’s learning!

 
%time result = run_algorithm(params, algo_input=alg_input, backend=backend)

Simulated QSVM is not so fast. It took 17min on my MacBook(mid2015 model)

Check the performance.
result['test_success_ratio']
> 0.733

Hmm it is not so high accuracy. Are there many room for improve?

And qiskit has more direct method for QSVM named QSVM.

I would like to use the method and tried. But it caused error.

I couldn’t find reason of above.

  q_instance = QuantumInstance(backend) qsvm = QSVM(feature_map=feature_map,            training_dataset={'A':train_x[train_y==0],                             'B':train_x[train_y==1],                             'C':train_x[train_y==2]},            test_dataset={'A':test_x[test_y==0],                         'B':test_x[test_y==1],                         'C':test_x[test_y==2]},            multiclass_extension=one_against_rest.OneAgainstRest)

It is very interesting for me about quantum computing.

programming and quantum computing is very interesting for me!!!!


Make quantum accumulator #quantum computing #qiskit

It’s not related to today’s topic but I’m sick with back pain. I hope I will get well soon..

Somedays ago I wrote post about qiskit. I think qiskit is very interesting package for quantum computing. And I stared to learn qiskit and quantum computer.

One of the interesting point of quantum computer is that it uses qubit instead of bit and the qubit can have an entangle state which means 0 or 1.

Today I made very simple quantum accumulator with qiskit.

Following code uses 4 qubit and 4 classical register.
Classical register used for results measurement.
And 4 kinds of gates.
Pauli X gate: x, this gate change |0> to |1>
hadamard gate: h, this gate generates entangle state |0> => 1/sq(2) [|0> + |1>]
control not gate: cx, this gate is same as NOT gate of classical computer
And gate: ccx, this gate is same ans AND gate.

Image of quantum circuit for 1 + 0 is below. First two qubits are used for input and third and forth qubits are used for output.

The code is below.

 
%matplotlib inline
import numpy as np
from qiskit import QuantumCircuit
from qiskit import QuantumRegister
from qiskit import execute
from qiskit import BasicAer
from qiskit import ClassicalRegister
from qiskit.visualization import plot_histogram
# I used simulator instead of real quantum computer
backend_sim = BasicAer.get_backend('qasm_simulator')

# 1 + 0 = 1
# Made 4 qubits and 4 classical bits
q = QuantumRegister(4)
c = ClassicalRegister(4)

# make quantum circuit object and add gates.
qc = QuantumCircuit(q,c)
qc.x(q[0])
qc.ccx(q[0],q[1],q[2])
qc.cx(q[0],q[3])
qc.cx(q[1],q[3])
qc.barrier(q)
qc.measure(q[3],c[0])
qc.measure(q[2],c[1])
qc.measure(q[1],c[2])
qc.measure(q[0],c[3])
qc.draw(output='mpl') # draw the circuit above.

OK let’s run the calculation.

 
# shots means number of trials because results of quantum computing depends on probability.
 
job = execute(qc, backend_sim, shots=80)
result = job.result()
plot_histogram(result.get_counts(qc))

1001 meants qubit1(1) + qubit(0) = 01 with 100% probability! It seems work well.

Next, how about 1 + 1? I added additional Pauli X gate to q[1].

 
# 1 + 1 = 2
q = QuantumRegister(4)
c = ClassicalRegister(4)
c = ClassicalRegister(4)

qc = QuantumCircuit(q,c)
qc.x(q[0])
qc.x(q[1])
qc.ccx(q[0],q[1],q[2]) # and gate count up when q[0] and q[1] is 1
qc.cx(q[0],q[3])
qc.cx(q[1],q[3])
qc.barrier(q)
qc.measure(q[3],c[0])
qc.measure(q[2],c[1])
qc.measure(q[1],c[2])
qc.measure(q[0],c[3])
qc.draw(output='mpl')

The results 1110 with 100% probability. It means qubit(1) + qubit(1) = 10, Binary 10 means 2 in decimal.

At last, write code with entangle state.

 
# 0/1 + 0/1 = 0, 1, 2
q = QuantumRegister(4)
c = ClassicalRegister(4)
c = ClassicalRegister(4)

qc = QuantumCircuit(q,c)
#qc.x(q[0])
#qc.x(q[1])
qc.h(q[0])
qc.h(q[1])
qc.ccx(q[0],q[1],q[2])
qc.cx(q[0],q[3])
qc.cx(q[1],q[3])
qc.barrier(q)
qc.measure(q[3],c[0])
qc.measure(q[2],c[1])
qc.measure(q[1],c[2])
qc.measure(q[0],c[3])
qc.draw(output='mpl')
 
job = execute(qc, backend_sim, shots=80)
result = job.result()
plot_histogram(result.get_counts(qc))

Result showed four state with almost same probability (25%).

0 + 0 = 0, 0 + 1 = 1, 1+0=1, 1+1 = 10(2)

I got more unbalanced data when I run code with low shots.

It is difficult for me to make the quantum circuit for complicated problem.

But technology goes very fast. Quantum computer is used for drug discovery in the feature. So I need to keep my eyes open.

Today’s code is uploaded following URL.

https://nbviewer.jupyter.org/github/iwatobipen/quantum_computing/blob/master/basics_sum.ipynb