Skip to main content
15 events
when toggle format what by license comment
Jan 17, 2015 at 8:28 comment added WYSIWYG @kevbonham Yes you can do it but this should not be about writing codes in general and this is not the right forum to delve into programming details. Code that explains an algorithm is fine. Pseudocode is better. Codewriting comes under the domain of StackOverflow.
Jan 16, 2015 at 15:46 comment added kevbonham I finally managed to make this work in python, using your script as a template (at least what I understood of the logic behind it). It's probably far more bloated than it needs to be, but it was a good learning exercise. Is it appropriate to post my code as an answer to this question as a reference? I'm still not completely sure about stackexchange etiquette.
Jan 12, 2015 at 5:12 comment added WYSIWYG @kevbonham Another point: the equivalent of associative arrays of awk (hashtables) in python is a dictionary. Dictionaries are sometimes very convenient and work much faster than lists.
Jan 11, 2015 at 5:46 comment added WYSIWYG @kevbonham in awk you can specify what the record separator is (RS, which is newline by default). You can instead set ">.*" as the RS for a fasta file and each nucleotide/protein sequence will be read in a stream.
Jan 11, 2015 at 5:42 comment added WYSIWYG @kevbonham readline() reads the entire file line by line and stores it as a list. In stream reading one line is read and the code is implemented on it before proceeding to the next line. To implement stream reading in python use for line in file:. See here. Awk by default does stream reading. Awk also has good regex base; in python you have to import re. Having said that Awk is not as versatile as python but good for certain tasks.
Jan 10, 2015 at 15:18 comment added kevbonham Makes sense. Is stream reading equivalent to something like readline() declared explicitly in python?
Jan 10, 2015 at 15:01 comment added WYSIWYG @kevbonham you can add that condition along with checking if the second-field is in a group or not no need to add another loop. Basically all those criteria is to be stringent about the relationship between first and second field. Thing with awk is that it stream reads (doesn't load the entire file in the RAM) and field separation is an easy job. Good for text parsing.
Jan 10, 2015 at 14:51 vote accept kevbonham
Jan 10, 2015 at 14:51 comment added kevbonham Wow, thank you very much! This seems like it should work... I might attempt to re-write in python (since that's what I'm most familiar with), but the logic is easy enough to follow. I suppose I would add another loop to ignore matches < a certain % match, or would you specify those parameters in the initial BLAST parameters?
Jan 10, 2015 at 9:08 history edited WYSIWYG CC BY-SA 3.0
added 2 characters in body
Jan 10, 2015 at 9:02 history edited WYSIWYG CC BY-SA 3.0
added 3006 characters in body
Jan 10, 2015 at 8:57 comment added WYSIWYG @kevbonham This script should work. If you like some other programming language you can implement this logic in that.
Jan 10, 2015 at 8:53 history edited WYSIWYG CC BY-SA 3.0
added 3006 characters in body
Jan 10, 2015 at 4:29 comment added kevbonham Yes, though if you can even just point me in the right direction, that would be great.
Jan 9, 2015 at 9:28 history answered WYSIWYG CC BY-SA 3.0