Help writing code for a question on my homework
1
0
Entering edit mode
3.0 years ago

Hello! I am taking my first programming class and I am struggling with some questions on my biopython homework. I can't figure out how to work with the files and how to get the sequence from the file in order it to change it. If someone could help me with even one of these questions that would be amazing!

Write a Python program that takes the sequences.fasta file (included in the cumulative exercises folder) and writes a revcomp.fasta file with the reverse complements of the original sequences. Hint. The SeqIO.write() function can write an entire list of SeqIO records.

Write a Python program that takes the sequence of the 1AI4 (http://www.rcsb.org/pdb/explore.do?structureId=1xi4) PDB protein (download the FASTA file manually), and writes a corresponding UniProt file.

Find and download a single sequence record from genbank (here is a shortcut to the search engine https://www.ncbi.nlm.nih.gov/search/all/?term=HE805982.1). The genbank identifier of the record is HE805982.1. This record contains information about the DNA region coding for HBx, a multifunctional hepatitis B viral protein involved in modulating several pathways by directly or indirectly interacting with hosts factors (protein degradation, apoptosis, transcription, signal transduction, cell cycle progress, and genetic stability). Write a Python program that, using the genbank record, saves the corresponding protein sequence in fasta format.

biopython • 2.3k views
ADD COMMENT
0
Entering edit mode

So, what have you tried already? Did you wrote a piece of code that doesn't work? Writing what you need is not going to help you. You should look for the literature about this. Show some effort, this is your homework, no one is going to solve it for you!

ADD REPLY
0
Entering edit mode

This post does not fit the theme of this forum.

EDIT: If OP can show us what they have tried and where they ran into a problem, we can consider this post on topic.

ADD REPLY
0
Entering edit mode

Why not? It's good enough for a homework tag.

ADD REPLY
0
Entering edit mode

We do not help with homework, especially when the OP has invested near zero effort in solving it themselves. They've given us a list of questions that they're supposed to work on.

ADD REPLY
0
Entering edit mode

With all due respect, I don't think "We do not help with homework" is a stated policy of this forum? The "About" page states "No question is too trivial or too "newbie"." The FAQ page does not mention anything about homework questions at all. I did not go looking for discussion posts regarding homework questions, and I do not know if the moderators have an unstated policy regarding homework(s). So please do correct me if I am mistaken.

And while there is no evidence that the OP has invested any effort in solving the questions, there isn't any that they haven't either. It is often difficult for beginners to demonstrate they have put in effort when it comes to stuff like this. I know of people who spent hours looking up how to import a FASTA file into Python without a single line of code to show for it. They were simply so new to it that even that was exceptionally hard for them. Does that mean they didn't put in any effort? How do you suggest a person in such a situation demonstrate their effort?

Turning away users who need help will not further science. I agree that low effort posts should be dealt with somehow, but I do think the community should err on the side of caution, and not come down too harshly on beginners and newcomers.

ADD REPLY
1
Entering edit mode

I think I get you. In my opinion it is ok to give some help as long as not a complete solution is provided. Hints to teaching materials are probably ok. You should take into account, that there are a lot of people doing teaching here, and as such do not want students to simply copy solutions others made for them, because that will have prevent any positive learning outcome.

I am speculating now, that questions like these are often either caused by problems in didactics (as in too steep learning curve) or lack of attention (as in "didn't listen" but that may also teacher's fault) or timing, likely all. It is hard to fix the underlying didactics problem though. From a teacher's perspective it is prudent to provide students with teaching materials they can use to catch up on. The question is however, for a beginners course, why wasn't the exercise posed in a more accessible way?

For OP, a way to get through with the task is to work through the tutorial as described below and get the information from there and convey to the instructor if they had difficulties in solving the task.

ADD REPLY
0
Entering edit mode

The question is however, for a beginners course, why wasn't the exercise posed in a more accessible way?

Probably because the course instructor comes from a computer science/math/bioinformatics background while OP probably has had no exposure to even the relevant line of thinking prior?

ADD REPLY
1
Entering edit mode

You are right, I stand corrected. There is no evidence that OP hasn't invested effort. I will remove my comment marking the post as off-topic.

ADD REPLY
0
Entering edit mode

I am very grateful to you for your humility and candor!! Thank you.

ADD REPLY
0
Entering edit mode

Could you clarify what you mean by "help"? Also this is the first time I've heard of a "UniProt file". So can't really help you there.

With regards to your first problem: all you need to do is use a for loop to go through the characters in the input sequence, and check what the character is, and keep appending that character's (i.e., base's) complement to an empty list you create(d) just before said for loop. Then reverse this list's contents and convert it to a string. All these steps are well documented and accessible (e.g., "How to reverse a list in Python") if you just search for them with a search engine.

The second and third problems boil down to finding out what Python functions you can use to download a certain file or set of data corresponding to an identifier. I'd just use a search engine once again to look for the appropriate Biopython functions (e.g., "download Genbank FASTA Biopython") and try and follow documented examples.

If your trouble is reading in data into Python then it's really time to go look at some examples of this online. It's a very well documented topic. Qualify your search with keywords like "FASTA" or "Biopython" and you should find documentation, tutorials, etc., that are directly relevant to the problem(s) at hand.

If this feels tough: it probably is. But you got this!! Don't give up.

ADD REPLY
1
Entering edit mode

There is a UniProt XML format. All info is here: https://biopython.org/wiki/SeqIO

ADD REPLY
0
Entering edit mode

Hey everyone,

I hope you're doing well. I'm in a bit of a pickle here. I need to write a statement of purpose for my master's program application, and I'm feeling lost. Can anyone help me out? How do I even start? What should I include, and what's the right structure for it? Any tips or advice would be greatly appreciated!

ADD REPLY
0
Entering edit mode

This isn't really the right place for this question.

Please ask this as a separate new question, but only if it is bioinformatics related.

ADD REPLY
0
Entering edit mode
3.0 years ago
Michael 54k

I think your instructor wanted to give you the following self-study task (at least that is what I would do)

Self study

Start with reading the Wiki and BioPython tutorial:

https://biopython.org/wiki/SeqIO http://biopython.org/DIST/docs/tutorial/Tutorial.html

Work through Chapter 1, 2, 3, and 5 (4 optional) of the tutorial trying the examples with the Python interpreter.

Then you are ready to solve the mandatory assignments. Don't hesitate to contact me (not ME, your course responsible that is) in case of doubt.

Next time we are going to learn more about handling BLAST objects.

ADD COMMENT

Login before adding your answer.

Traffic: 2899 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6