### How JustAnswer Works:

• Ask an Expert
• Get a Professional Answer
• 100% Satisfaction Guarantee

## Ask R.R. Jha Your Own Question

R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
20870358
Type Your Homework Question Here...
R.R. Jha is online now

# HELP Please! Need Pseudo code for array comparison in Python

This answer was rated:

I have a list of data (array) from an experiment:

v1 = 23, -1, -3, ..., n

v2 = 12, 0, -26, ..., n

- - -

vn = -1, -1, 1, ..., n

and

p1 = 3, -11, 3, ..., n

p2 = 1, 0, 6, ..., n

- - -

pn = -1, 1, 1, ..., n

Have to normalize all values to 0 and 1 first:

if value is<=0 make value=0; if value>0 make value=1

After normalize, compare using Boolean logic, the vn lists with the pn list.

pn ALWAYS as result of vn boolean interactions, returning true or false as ouput.

I have to compare the whole list... not element by element...

Have to use only these booleans == (equal to), != (not equal to), and 'and'.

Final results should be something like:

v1 = pn; v2 is not pn; vn and v2 and ... = pn

Optional Information:
Language (or Software): Python
Browser (if necessary): Safari

1. # XXXXX data in array (list) format where vnj contains gene expression from DNA microarray for a vn gene at time j (t input), and pnj contains gene expression from DNA microarray for a vn gene at time j (t+1 output)

2. Use variables: v1, v2, v3, ..., vn, p1, p2, p3, ..., pn

3. # XXXXX normalization to an integer in binary format (0, 1).

4. # XXXXX is the number of columns/genes (i), and k is the maximum number of rows (j).

5. for i=1 to n

6. for j=0 to k

7. if vij<=0 then vij=0 otherwise make vij=1

8. if pij<=0 then pij=0 otherwise make pij=1

9. done

13. done

14.

15. # XXXXX Boolean logic compare all elements in vn with all elements in pn. Return vn "inhibits" or "activates" pn.

16.

17. for i=1 to n

18. for j=1 to n

19. if vi==pj then print vi,' activates ',pj

20. if vi!=pj then print vi,' inhibits ',pj

21. *** MISSING "AND" COMPARISON ***

22.

23. done

24. done

Hi, I'm a Moderator for this topic. I've been working hard to find a professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, please let me know and I will cancel this question for you. Thank you!
Customer: replied 3 years ago.
Thanks, XXXXX XXXXX wait.
It doesn't need be someone super expert... I just would like to have someone with python experience to give me some inputs.
I have no rush to have it finished.
Thanks
Thank you for your continued patience. We will continue the search for a professional for you.
Hi,

I'd be glad to help with your question. Could you please explain with example, how should the AND comparison be? Are you ANDing all vi's and checking if it's equal to pj?
Customer: replied 3 years ago.

Thank you RRJha,

I need is the relationship of pj (the output) from vi (the input)...

I am attaching a table to see it can be more explanatory...

I did some extra work too...

If you could have a look, it would be very helpful.

No rush...

Customer: replied 3 years ago.

I am trying to attach the table, but it gives me error...

Below it is what I did so far:

1. start

2. # XXXXX data in array (list) format where vnj contains gene expression from DNA microarray for a vn gene at time j (t input), and pnj contains gene expression from DNA microarray for a vn gene at time j (t+1 output)

3. Use variables: v1, v2, v3, ..., vn, p1, p2, p3, ..., pn

4. # XXXXX normalization to an integer in binary format (0, 1).

5. # XXXXX is the number of columns/genes (i), and k is the maximum number of rows (j).

6. for i=1 to n

7. for j=0 to k

8. if vij<=0 then vij=0 otherwise make vij=1

9. if pij<=0 then pij=0 otherwise make pij=1

10. done

11. done

12. # XXXXX Boolean logic to compare all vn lists with all pn lists. Return vn "inhibits" or "activates" pn.

13. for i=1 to n

14. for j=1 to n

15. if vi==pj then print vi,' activates ',pj

16. if vi!=pj then print vi,' inhibits ',pj

17. done

18. done

19. for all vn, if (vn and vn) == pn print vn,' and ', vn,' activates ',pn

20. for all vn, if (vn and vn) != pn print vn,' and ', vn,' inhibits ',pn

21. end

Customer: replied 3 years ago.

The number of pns are equal to the number of vns.

You can think vns as v1(t), v2(t),..., vn(t)

and pns as v1(t+1), v2(t+1),...,vn(t+1)

Relationship Boolean:

NOT (pn is not true for vn):

v p

1 0

0 1

AND (example: vn and vn are true for pn)

vn vn pn

1 1 1

1 0 0

0 1 0

0 0 0

Let me know if you need more information.

Thanks again

Could you please clarify more about the AND relationship you're looking for? I know how AND works, but not sure what combination are you looking for. Do you want to check each pi against all possible ANDing combination of vi's?
Because == and != logic would compare only one vi against one pi, but AND can take multiple combination of vi's and compare it with one pi.

For example, checking

v1 AND v2 == p1
v1 AND v2 AND v3 == p1
v2 AND v5 == p2
v3 AND v5 AND v7 == p3

So, what AND combination are you looking to compare with a pi? I hope I'm making it clear what my question is.

Thanks
Customer: replied 3 years ago.

Yes, you are right.

All combinations possibles for v... I got stuck on there...

Ok, I'll give it a try and let you know.
Customer: replied 3 years ago.

Thanks for your help.

You're welcome
THIS ANSWER IS LOCKED!

You need to spend \$3 to view this post. Add Funds to your account and buy credits.
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience: B.Tech
R.R. Jha and 4 other Homework Specialists are ready to help you
Customer: replied 3 years ago.
Thank you!

Your work looks great. I will be implementing the python code during the fall semester. For sure I will need your help.

Thanks again.