Python 3 DNA Concensus Sequence











up vote
-5
down vote

favorite












It's just I have a project for my programming class that requires me to create a Python program that reads DNA sequences from an input file and generates a consensus sequence. I already made a function to open and store the data from the file. What I'm struggling with is to loop over the letters from the sequences to count the nucleotides from each column of each sequence. I was told to use nested loops to process every character in every sequence. I was also recommended this: Use outer loop for columns (characters) and inner loop for rows (sequences) here is my code so far in he image I provided (BTW the file name does not appear because I'm not supposed to prompt the user for a file, the program is designed to try to open a specific file)



Image can now be seen in the question description










share|improve this question




















  • 5




    Don't post pictures of code.
    – khelwood
    Nov 7 at 20:55








  • 4




    Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
    – juanpa.arrivillaga
    Nov 7 at 20:55








  • 1




    Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
    – Prune
    Nov 7 at 21:04















up vote
-5
down vote

favorite












It's just I have a project for my programming class that requires me to create a Python program that reads DNA sequences from an input file and generates a consensus sequence. I already made a function to open and store the data from the file. What I'm struggling with is to loop over the letters from the sequences to count the nucleotides from each column of each sequence. I was told to use nested loops to process every character in every sequence. I was also recommended this: Use outer loop for columns (characters) and inner loop for rows (sequences) here is my code so far in he image I provided (BTW the file name does not appear because I'm not supposed to prompt the user for a file, the program is designed to try to open a specific file)



Image can now be seen in the question description










share|improve this question




















  • 5




    Don't post pictures of code.
    – khelwood
    Nov 7 at 20:55








  • 4




    Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
    – juanpa.arrivillaga
    Nov 7 at 20:55








  • 1




    Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
    – Prune
    Nov 7 at 21:04













up vote
-5
down vote

favorite









up vote
-5
down vote

favorite











It's just I have a project for my programming class that requires me to create a Python program that reads DNA sequences from an input file and generates a consensus sequence. I already made a function to open and store the data from the file. What I'm struggling with is to loop over the letters from the sequences to count the nucleotides from each column of each sequence. I was told to use nested loops to process every character in every sequence. I was also recommended this: Use outer loop for columns (characters) and inner loop for rows (sequences) here is my code so far in he image I provided (BTW the file name does not appear because I'm not supposed to prompt the user for a file, the program is designed to try to open a specific file)



Image can now be seen in the question description










share|improve this question















It's just I have a project for my programming class that requires me to create a Python program that reads DNA sequences from an input file and generates a consensus sequence. I already made a function to open and store the data from the file. What I'm struggling with is to loop over the letters from the sequences to count the nucleotides from each column of each sequence. I was told to use nested loops to process every character in every sequence. I was also recommended this: Use outer loop for columns (characters) and inner loop for rows (sequences) here is my code so far in he image I provided (BTW the file name does not appear because I'm not supposed to prompt the user for a file, the program is designed to try to open a specific file)



Image can now be seen in the question description







python python-3.x python-2.7 python-3.7






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 22:09









SPYBUG96

4411522




4411522










asked Nov 7 at 20:52









Fernando Bermúdez

11




11








  • 5




    Don't post pictures of code.
    – khelwood
    Nov 7 at 20:55








  • 4




    Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
    – juanpa.arrivillaga
    Nov 7 at 20:55








  • 1




    Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
    – Prune
    Nov 7 at 21:04














  • 5




    Don't post pictures of code.
    – khelwood
    Nov 7 at 20:55








  • 4




    Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
    – juanpa.arrivillaga
    Nov 7 at 20:55








  • 1




    Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
    – Prune
    Nov 7 at 21:04








5




5




Don't post pictures of code.
– khelwood
Nov 7 at 20:55






Don't post pictures of code.
– khelwood
Nov 7 at 20:55






4




4




Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
– juanpa.arrivillaga
Nov 7 at 20:55






Hi, welcome to StackOverflow. Since you're new, check out the help center. Questions should provide all relevant code as formatted text in the question itself. Links to code, especially links to images of code, are not useful. Please edit your question to address this. Thanks.
– juanpa.arrivillaga
Nov 7 at 20:55






1




1




Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
– Prune
Nov 7 at 21:04




Welcome to StackOverflow. Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. Minimal, complete, verifiable example applies here. We cannot effectively help you until you post your MCVE code and accurately describe the problem. We should be able to paste your posted code into a text file and reproduce the problem you described.
– Prune
Nov 7 at 21:04

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53197635%2fpython-3-dna-concensus-sequence%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53197635%2fpython-3-dna-concensus-sequence%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()