### 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

### Resolved Question:

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

Submitted: 3 years ago.
Category: Homework
Expert:  Josie-Mod replied 3 years ago.
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
Expert:  Josie-Mod replied 3 years ago.
Thank you for your continued patience. We will continue the search for a professional for you.
Expert:  R.R. Jha replied 3 years ago.
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

Expert:  R.R. Jha replied 3 years ago.
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...

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

Thanks for your help.

Expert:  R.R. Jha replied 3 years ago.
You're welcome
Expert:  R.R. Jha replied 3 years ago.
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 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.

### JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

### What Customers are Saying:

• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Previous | Next >
• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
• This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
• Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
• I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
• Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
• Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
• He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX

• ### LogicPro

#### Satisfied Customers:

4925
Expert in Java C++ C C# VB Javascript Design SQL HTML
< Last | Next >

### LogicPro

#### Satisfied Customers:

4925
Expert in Java C++ C C# VB Javascript Design SQL HTML

### Manal Elkhoshkhany

#### Satisfied Customers:

4538
More than 5000 online tutoring sessions.

### Linda_us

#### Satisfied Customers:

3138
Post Graduate Diploma in Management (MBA)

### Chris M.

#### Satisfied Customers:

2602
Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

### F. Naz

#### Satisfied Customers:

2126
Experience with chartered accountancy

### Bizhelp

#### Satisfied Customers:

1887
Bachelors Degree and CPA with Accounting work experience