[Tutor] Selecting from list

2013-07-18 Thread Hs Hs
hi list: In the following list, is there a simply way to find element less than 200 sandwiched between two numbers greater than 1000. a = [3389, 178, 2674, 2586, 13731, 3189, 785, 1038, 25956, 33551] in a, 178 is between 3389 and 2674.  How this particular list can be selected for further

[Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
Dear List members: I always have problem in getting ranges: Following is my representation of part of my file. X1 A G C G X2 A G X3 A G X4 H T I want to print the above contents in the following way: X1 \t A X1 \t G X1 \t C X1 \t G X2 \t A X2 \t G X3 \t A X3 \t G X4 \t H X4 \t H Here is

Re: [Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
                       - X2A X2G X3A X3G X4A X4A Thanks Hs. From: Steven D'Aprano st...@pearwood.info To: tutor@python.org Sent: Tuesday, February 5, 2013 4:28 PM Subject: Re: [Tutor] Getting range of a list On 06/02/13 08:08, Hs Hs wrote: Here is what I do : f1 = open

Re: [Tutor] Getting range of a list

2013-02-05 Thread Hs Hs
Sent: Tuesday, February 5, 2013 5:20 PM Subject: Re: [Tutor] Getting range of a list On 02/05/2013 04:48 PM, Hs Hs wrote: Thanks Steve. But one question, when I print, I get extra empty lines. How to get rid of them!  Thanks again. f = open('test') head = '---' for line in f: line

[Tutor] regular expression wildcard search

2012-12-11 Thread Hs Hs
Dear group: I have 50 thousand lists. My aim is to search a pattern in the alphabetical strings (these are protein sequence strings). MMSASRLAGTLIPAMAFLSCVRPESWEPC VEVVP NITYQCMELNFYKIPDNLPFSTKNLDLSFNPLRHLGSYSFFSFPELQVLDLSRCEIQTIED my aim is to find the list of string that has V*VVP.  myseq

[Tutor] summing lists

2012-04-10 Thread Hs Hs
Hi: I have 4 lists: a [40] b [2] c [23] d [12] how is it possible to do add elements in list. I can do this using tupples, but I do not know how to append elements to tuple, thats the reason I am using list.  I want to find the value of a+c/a+b+c+d - which is 40+23/40+2+23+12.  Any

Re: [Tutor] summing lists

2012-04-10 Thread Hs Hs
sorry I did this following, please advise if any better way exist: gc = lambda x,y: x[0]+y[0] atgc = lambda x,y,k,l: x[0]+y[0]+k[0]+l[0] gc(a,b)/atgc(a,b,c,d) 0.54545454545454541 Hi: I have 4 lists: a [40] b [2] c [23] d [12] how is it possible to do add elements in list. I

Re: [Tutor] summing lists

2012-04-10 Thread Hs Hs
thanks all for quick reply.  In my previous e-mail I send adding using lambda function. I now know that I am using too much functionality where simple ways to solve exist. That's python! thanks again.  Hs. From: Evert Rol evert@gmail.com To: Hs Hs ilhs

[Tutor] number of mismatches in a string

2012-03-02 Thread Hs Hs
Hi: I have the following table and I am interested in calculating mismatch ratio. I am not completely clear how to do this and any help is deeply appreciated.  Length     Matches 77      24A0T9T36 71      25^T9^T37 60      25^T9^T26 62      42A19 In length column I have length of the

[Tutor] finding a polymer of letters in a string

2012-01-19 Thread Hs Hs
Hi:  I am writing to see if I could any help. I am trying to find if a mutation in gene falls in a polymer region of DNA. To explain in simplistic terms, Given a piece of DNA string, with following characters, I know where mutation happens.  Happens at T (in quotes with spaces.) 3 As before T

Re: [Tutor] finding a polymer of letters in a string

2012-01-19 Thread Hs Hs
what that pattern would be when I read in a string. I do not know if regex could solve my kind of problem too. Thanks Hs. From: Hilton Fernandes hgfer...@gmail.com To: tutor@python.org tutor@python.org Cc: Hs Hs ilhs...@yahoo.com Sent: Thursday, January 19

Re: [Tutor] vcf_files and strings

2011-10-11 Thread Hs Hs
VCF - Variant Call Format VCF files are nothing special but tab delim files describing the genetic mutations, friquencies and other base information (bases here mean ATGC pertaining to DNA). These files are generated by variety of genome sequence data analysis pipelines.  MIT and Haplotype

Re: [Tutor] vcf_files and strings

2011-10-11 Thread Hs Hs
http://www.1000genomes.org/node/101 From: Alan Gauld alan.ga...@btinternet.com To: tutor@python.org Sent: Tuesday, October 11, 2011 1:52 PM Subject: Re: [Tutor] vcf_files and strings On 11/10/11 18:16, Hs Hs wrote: VCF - Variant Call Format

Re: [Tutor] vcf_files and strings

2011-10-07 Thread Hs Hs
if col[x] == 'missense':     print col[withRefSeqID] hth From: Anna Olofsson olofsson_anna...@hotmail.com To: tutor@python.org Sent: Friday, October 7, 2011 12:12 PM Subject: [Tutor] vcf_files and strings Hi, I'm a beginner at Python and would really

Re: [Tutor] selecting elements from dictionary

2010-09-15 Thread Hs Hs
] selecting elements from dictionary On Wed, 15 Sep 2010 12:10:59 pm Hs Hs wrote: I want to print only those items that have [1,2] and [1,3] in any order, such as [1,2] or [2,1], [3,1] or [1,3] for item in xdic.keys(): ... if [1,2] in xdic[item]: ... print item I get

[Tutor] selecting elements from dictionary

2010-09-14 Thread Hs Hs
dear group: I have a dictionary object that looks like this: xdic {11135457: [1], 11135492: [1], 11135913: [1], 11135436: [1, 2], 11135699: [1, 2], 11135702: [1, 3], 11135901: [1]} I want to print only those items that have [1,2] and [1,3] in any order, such as [1,2] or [2,1], [3,1] or

[Tutor] large file

2010-06-13 Thread Hs Hs
hi: I have a very large file 15Gb. Starting from 15th line this file shows the following lines: HWUSI-EAS1211_0001:1:1:977:20764#0 HWUSI-EAS1211_0001:1:1:977:20764#0 HWUSI-EAS1521_0001:1:1:978:13435#0 HWUSI-EAS1521_0001:1:1:978:13435#0 Every two lines are part of one readgroup.

Re: [Tutor] An interesting situation befalls me

2010-05-09 Thread Hs Hs
It is interesting to note war against 'Dive into Python'. Personally I felt it was good, a quick resource to learn without buying O'reilly books. After I came across Alan Gauld and Mark Lutz's books, I never referred DintoP. I still have the printed version of this book from 2002-3 I guess.

[Tutor] how to sort a tab delim file

2010-01-13 Thread Hs Hs
Hi: I have a tab-delim file: col1 col2 col3 andrew1987 1990 jake 1974 1980 jim 1964 1970 lance1984 1992 how can I sort column 2 and get : jim 1964 1970 jake 1974 1980 lance1984 1992 andrew1987 1990 I know