[Tutor] Unique Items in Lists

2005-01-26 Thread Srinivas Iyyer
Hi, I am a new member to this group and relatively to python. I have a list with 4 columns and column1 elements are unique. I wanted to extract unique elements in column3 and and place the other elements of the column along with unique elements in column 4 as a tab delim text. Table: col1

Re: [Tutor] Unique Items in Lists

2005-01-26 Thread Srinivas Iyyer
Dear Jacob, thank you for your suggestion. however, i think my question was not clear. what i meant to ask in my previous question was, how to know which elements repeated and how many times they were repeated. while my question was flying, i did a small test: took a list: >>> a [1, 1, 2, 3, 4,

Re: [Tutor] Unique Items in Lists

2005-01-27 Thread Srinivas Iyyer
<[EMAIL PROTECTED]> wrote: > > > On Wed, 26 Jan 2005, Srinivas Iyyer wrote: > > > I have a list with 4 columns and column1 elements > are unique. I wanted > > to extract unique elements in column3 and and > place the other elements > > of the column along w

[Tutor] range function

2005-01-29 Thread Srinivas Iyyer
Hi: I have bunch of coordinates for various vectors. example: small vecs: name cord. Xcord. Y Sector no. smvec175 1001aa smvec225 50 1aa smvec3135 1551ab large vecs:zone Lvec1 10

[Tutor] TypeError: can only concatenate list (not "str") to list

2005-01-30 Thread Srinivas Iyyer
Hello group, I am trying to print rows from two lists together: how can i deal with TypeError' where i have to print a list and a string. for line in pb: # tab delim text with 12 columns cols = line.split('\t') temp_seq = cols[7].split('\n') # extract 7thcol seq = temp_

[Tutor] Tab delim file

2005-03-01 Thread Srinivas Iyyer
Hello: I have a nasty file where I have 165 column and 140K lines. For every 12 columns, a new dataset is written. 0-12 - File A's data is there 13-24 - File B's data is there. My task is to write data in each 12 columns to a file. I have a rough idea, but when I try I am unable to proceed

[Tutor] Unique elements mapping

2005-03-25 Thread Srinivas Iyyer
Hi all: I have a question and I request groups help please. My list has two columns: NameState DrewVirginia NoelMaryland NikiVirginia Adams Maryland JoseFlorida Monica Virginia Andrews Maryland I would like to have my ouput like this: Virginia : Drew,Niki,Monica Maryla

[Tutor] please help

2005-07-10 Thread Srinivas Iyyer
Hello group, after 4 months my brain became rusty by not solving problems. I need some help to regain my basic skills. my problem: I have a file that looks like this: // AB32456\tTransaction from India \t 43 \t 34 \t 34 \t 65 \t 12 \t 35 // AV32567\tTransaction from Si

[Tutor] Will a dictionary based method work for this problem

2005-07-21 Thread Srinivas Iyyer
Hello group, I have a problem of classification of data. My data has two columns: Col. A refers section of a office and column B refers to name of the person: Col A Col B Accounts(A/c)Steve A/c Bill A/c Rafael Billing Mike Billing joshua

Re: [Tutor] Will a dictionary based method work for this problem

2005-07-21 Thread Srinivas Iyyer
Thanks Danny, I did not think of that at all. I have some experience with postgres. i will do that. thanks --- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > This is just a simple example, in my list I have > ~40 > > sections and ~10K people (this is repeated number > and > > I do not know

[Tutor] substitute function

2005-07-31 Thread Srinivas Iyyer
Hello group: Is there a 'substitute' function in python. For example: I want to substitute A with T and G with C and vice versa A -> T G -> C T -> A c -> G thanks Start your day with Yahoo! - make it your home page http://

Re: [Tutor] substitute function

2005-07-31 Thread Srinivas Iyyer
ot; <[EMAIL PROTECTED]> > Cc: > Sent: Sunday, July 31, 2005 2:46 PM > Subject: Re: [Tutor] substitute function > > > > Srinivas Iyyer wrote: > > > Hello group: > > > > > > Is there a 'substitute' function in python. > > > > >

[Tutor] substituting empty line with stuff

2005-08-02 Thread Srinivas Iyyer
Hello group: I have a file (3339203 lines) that looks like this: (col:1)(col:2) (col:3) AD134KL X X X X X X AD144KL Y Y Y Y Now I have to fill the rows in co

[Tutor] Please help

2005-08-03 Thread Srinivas Iyyer
sorry for repost. Hello group: I have a file (3339203 lines) that looks like this: (col:1)(col:2) (col:3) AD134KL X X X X X X AD144KL Y Y Y Y Now I have to

[Tutor] a dictionary method good for this process

2005-08-04 Thread Srinivas Iyyer
Dear group: I have two lists and I have to match the element in the first list to element in second list and print the line from second list: Example: listA =['apple','baby','cat'] listB =['fruit\tapple','tree\tapple','fruit\tmango', 'human\tbaby' 'infant\tbaby' 'human\tAl

Re: [Tutor] a dictionary method good for this process

2005-08-07 Thread Srinivas Iyyer
at murky. May be I need to work more on that. Thanks Srini --- Kent Johnson <[EMAIL PROTECTED]> wrote: > Srinivas Iyyer wrote: > > Dear group: > > > > I have two lists and I have to match the element > in > > the first list to element in second list an

[Tutor] priting keys and its values of a dictionary in a single row

2007-04-27 Thread Srinivas Iyyer
Dear group, I have a dictionary (huge) and there are 19K keys for this dictionary. The values for the could be a max 19K again. simpler version of it: mydict= {'a':['apple','ant','anchor','arrow'],'b':['ball','baby',boy','bus'],'c':['cat','call']} in a different list, i have keys: mlist = ['a'

[Tutor] Windows - Linux based open() file handle mode

2007-11-19 Thread Srinivas Iyyer
Dear group, I want to parse an file generated for windows. My code works beautifully when I try to parse the same file generated in Linux. I uses the following options with no success: blast_out = open('C:\human\prb_blast.out','r') blast_out = open('C:\human\prb_blast.out','rU') blast_out =

[Tutor] ElementTree - reading large XML files as file handles

2007-11-21 Thread Srinivas Iyyer
Dear tutors, I use ElementTree for XML works. I have a 1.3GB file to parse. I takes a lot of time to open my input XML file. Is that because of my hardware limitation or am I using a blunt method to load the file. my computer config: Inte(R) Pentium(R)4 CPU 2.80GHz 2.79GHz, 0.99GB of RAM f

[Tutor] pls. help me in sorting and choosing

2005-08-10 Thread Srinivas Iyyer
Dear Group: After cutting short a lot of gory detail, I finally arrived at atomic level of my problem and here I crash. I guess this crash is due to not so strong logic (hopefully i get better with more and more exerise in solving problems). I have a file with two columns: Column A (accession num

Re: [Tutor] pls. help me in sorting and choosing

2005-08-10 Thread Srinivas Iyyer
: > Quoting Srinivas Iyyer <[EMAIL PROTECTED]>: > > > My question is how can I code to distinguish all > high > > scoring group and all low scoring group. > > One thing you need to decide is what it means to be > high scoring. Is an element > high scoring if i

[Tutor] Please help with comparision in range of numbers

2005-09-15 Thread Srinivas Iyyer
Hello group, I have a data like this in tab-delim text. 1427021_s_atchr7:102786983-102794499(+) 1452285_a_atchr7:102786983-102794499(+) 1445553_at chr7:102848766-102910961(-) 1420925_at chr7:102863841-102887410(+) 1450041_a_atchr7:102863841-10

[Tutor] how to do systematic searching in dictionary and printing it

2005-10-20 Thread Srinivas Iyyer
dear group, I have two files in a text format and look this way: File a1.txt: >a1 TTAATTGGAACA >a2 AGGACAAGGATA >a3 TTAAGGAACAAA File b1.txt: >b1 TTAATTGGAACA >b2 AGGTCAAGGATA >b3 AAGGCCAATTAA I want to check if there are common elements based on ATGC sequences. a1 and b1 are identical se

[Tutor] Glossory of terms in Python

2005-10-26 Thread Srinivas Iyyer
Dear python experts, I am a novice python learner and aspiring to become decent python programmer. I am reading 'Learning Python' by Mark Lutz et al. and it is one of the good books that I find in addition to Alan Gauld's book 'Learn to Program Using Python'. While reading these books step-by

[Tutor] Weird iteration using zip()

2005-10-27 Thread Srinivas Iyyer
Hi all: Here is a simple code: >>> a = ['a','b','c','d','e'] >>> b = [1,2,3,4,5] >>> abdict = dict(zip(a,b)) >>> abdict {'a': 1, 'c': 3, 'b': 2, 'e': 5, 'd': 4} Why is this weird iteration going on" Why not: >>> abdict {'a':1,'b':2,'c':3,'d':4,'e':5} Is there any hidden logic in the code that

[Tutor] How to convert a list to tuple

2005-11-16 Thread Srinivas Iyyer
Dear all, Pardon me for asking a simple question. Sometimes brain gets blank and compells me to seek help from tutors. I have a list : >>>prcor ['933\t957', '955\t979', '969\t993', '1025\t1049', '1052\t1076', '1098\t1122', '1136\t1160', '1298\t1322', '1406\t1430', '1422\t1446', '1471\t1495'] >

Re: [Tutor] How to convert a list to tuple

2005-11-16 Thread Srinivas Iyyer
Clarke-Hutchinson| Contact Centre Advisor| > Ministry of Economic > Development > DDI +64 3 962 2639 | Fax +64 3 962 6220 > www.med.govt.nz > > > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of Srinivas > I

[Tutor] how to identify a list element is in the range of a tuple element or a list element

2005-11-17 Thread Srinivas Iyyer
Dear group, I have a list of numbers: a = [10,3,4.6,2.3,4.8,10.8,4.1] b = ['1-4','4.1-8','8.1-12','12.1-16'] c = ((1,4),(4.1,8),(8.1-12),(12.1,16)) Now I want to find if elements of list a are in the range of list b and in the range of tuple b. I know (and my limited knowledge on range functi

[Tutor] Weird situation in using .split() function

2005-11-29 Thread Srinivas Iyyer
Hello group: I have a list t and the elements are tab limited. there are 2 columns: >>>t ['STAG2\tmiR-101', 'SMARCA1\tmiR-101', 'RAP2C\tmiR-101', 'DDX3Y\tmiR-101', 'AGRN\tmiR-101\tmiR-144', 'EPB41\tmiR-101\tmiR-144', 'PUM1\tmiR-101\tmiR-144', 'KIAA1573\tmiR-101\tmiR-144', 'ST6GALNAC3\tmiR-101\tmi

[Tutor] Printing regular expression match

2005-12-03 Thread Srinivas Iyyer
Dear group, I have two lists: >>> a ['apple', 'boy', 'boy', 'apple'] >>> b ['Apple', 'BOY', 'APPLE-231'] >>> for i in a: pat = re.compile(i,re.IGNORECASE) for m in b: if pat.match(m): print m Apple APPLE-231 BOY

Re: [Tutor] Printing regular expression match

2005-12-03 Thread Srinivas Iyyer
-- Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Sat, 3 Dec 2005, Srinivas Iyyer wrote: > > >>> a > > ['apple', 'boy', 'boy', 'apple'] > > > > >>> b > > ['Apple', &#x

[Tutor] Words alignment tool

2005-12-04 Thread Srinivas Iyyer
Dear Expert programmers, I aplogise if this mail is out of context here. I have a list of elements like these: Contr1 SPR-10 SPR-101 SPR-125 SPR-137 SPR-139 SPR-143 contr2 SPR-1 SPR-15 SPR-126 SPR-128 SPR-141 SPR-148 contr3 SPR-106 SPR-130 SPR-135 SPR-138 SPR-139 SPR-145 contr4 SPR-12

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-09 Thread Srinivas Iyyer
Hi group, I just have another question in parsin XML files. I found it very easy to parse XML files with kent and danny's help. I realized that all my XML files have '\t' and '\n' and whitespace. these extra features are making to extract the text data from the xml files very difficult. I can

Re: [Tutor] Learning books

2005-12-20 Thread Srinivas Iyyer
1. Learn to Program Using Python by Alan Gauld (Stage 1) 2. Learning Python by Mark Lutz and David Ascher (Stage 2) 3. If u are serious in learning python - my sincere advise : STICK TO THIS LIST. You can never find good teachers with lots of patience and with real appetite to teach elesewhere. T

Re: [Tutor] Help with choosing books

2006-01-03 Thread Srinivas Iyyer
Hi, I guess this has been discussed in detail in December 2005 (last month). you might want to check this thread and the replies in deteails. http://mail.python.org/pipermail/tutor/2005-December/044028.html This might help. --- wood yee <[EMAIL PROTECTED]> wrote:

[Tutor] Excel files to Tab delim files

2006-01-05 Thread Srinivas Iyyer
Dear group, is there any library available that would convert over 2000 .xls files to tab delim text files. I have over 2000 Excel files and I want to convert them to tab delim files, which has become a pain in brain. Thanks Srini __

[Tutor] Python upgrade from 2.3 to 2.4

2006-01-05 Thread Srinivas Iyyer
Hi, I might be asking this question out of context. however, eversince I started working with Python, the only mailing list that I used ever is this. So this could be also the other reason that I am posting here. I am currently using Python 2.3 for windows XP. I wanted to use PyExcellerator modu

[Tutor] IDLE doesn't start in Python 2.4 in windows XP

2006-01-06 Thread Srinivas Iyyer
Hi Danny, I was following some of your suggestions in making my IDLE work in Windows XP laptop. (http://mail.python.org/pipermail/tutor/2005-January/034683.html). First, i changed the IDLE shortcut path: from C:\Python24\python.exe TO C:\Python24\python.exe "C:\Python24\Lib\idlelib\idle.pyw" -

[Tutor] How can I make a python script go directory by directory and excecute on files of choice

2006-01-10 Thread Srinivas Iyyer
Dear group, I have Excel files that are arranged according to transctions under various name/directories. I found out that all these Excel files are not real OLE based files and some of them are really tab delim files with .XLS appended to the end of file name. I got fooled and started using pyEx

[Tutor] how to do multiple searching against many lists

2006-01-19 Thread Srinivas Iyyer
Hi Group, my Problem: I have soms list for variety of animals, birds, bacteria I have another list: search_list = ['cat','python','parrot','donkey','e.coli'] animals = ['cat','tiger','donkey','zebra','lemur'] birs = ['parrot','mina','oriole','blue jay'] bacteria = ['e.coli','bacillus','staphy

[Tutor] mapping problem

2006-02-01 Thread Srinivas Iyyer
Dear group, I have a problem in finding a method to solve a problem where I want to walk through a lineage of terms and find group them from right to left. A snippet of the problem is here. The terms in file as tab delim manner. a b c d car a b c f

[Tutor] need to get unique elements out of a 2.5Gb file

2006-02-01 Thread Srinivas Iyyer
Hi Group, I have a file which is 2.5 Gb., TRIM54 NM_187841.1 GO:0004984 TRIM54 NM_187841.1 GO:0001584 TRIM54 NM_187841.1 GO:0003674 TRIM54 NM_187841.1 GO:0004985 TRIM54 NM_187841.1 GO:0001584 TRIM54 NM_187841.1 GO:0001653 TRIM54 NM_187841.1 GO:0004984 There ar

[Tutor] Substitution problem

2006-02-21 Thread Srinivas Iyyer
Dear group, I am trying to automate a process in statistical language R. There for 1 operation 50 lines of code is written. This process query postgres database and does some processing on the resulting data and writes back a file. I want to replicate the 50 line code, 90 times, by substitut

[Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Dear group, I have a question for solving a problem in more simplistic and efficient way. I have two lists: list_a = ['S83513\tNM_001117', 'X60435\tNM_001117', 'U75370\tNM_005035', 'U05861\tNM_001353', 'S68290\tNM_001353', 'D86864\tNM_145349', 'D86864\tNM_003693', 'D86864\tNM_145351', 'D63483\t

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Hi Danny, Thanks for reminding me the tip from Kent :-) da = {} for m in list_a: cols = m.split('\t') ter = cols[0] da.setdefault(ter,[]).append(m) >>> da {'S66427': ['S66427\tNM_002892'], 'U05861': ['U05861\tNM_001353'], 'D63483': ['D63483\tNM_145349', 'D63483\tNM_003693',

Re: [Tutor] efficient method to search between two lists

2006-03-22 Thread Srinivas Iyyer
Thank you Terry, I learned some stuff from your snippet. I used 'Set' but never got to use its power using LC. Thanks again Srini --- Terry Carroll <[EMAIL PROTECTED]> wrote: > On Wed, 22 Mar 2006, Srinivas Iyyer wrote: > > > I cannot think of any other smart

[Tutor] Automating web page parsing

2006-03-29 Thread Srinivas Iyyer
Dear group, ***Disclaimer***Not suitable for BioPython list*** I work with GeneChips to analyze human gene expression patterns. These genechips are various kinds one of the variety is made at Stanford University. In a typical experiment, an experimenter uses roughly over 40 chips. For a third

[Tutor] Python + PostGreSQL

2006-03-31 Thread Srinivas Iyyer
Dear group, I want to connect python to postgresql. My python dist. is 2.4.2 My postgres: 8.1.2 My system: Linux Enterprise Linux, Intel Xeon, 4GB RAM. I tried to install pygresql: version: 3.8, it failed throwing exception : Exception: pg_config tool is not available. I gave another try on go

Re: [Tutor] Python + PostGreSQL

2006-03-31 Thread Srinivas Iyyer
Thanks Bill, and wesley, Psycopg worked for me. I had to use setup.cfg . Regular setup.py did not work. AFA, pygresql I did used this some 2 years back. However, the install was pretty easy due to proper redhat rpm updates. I felt more comfortable with PyGreSQL. I liked it somehow. tar -xvf

[Tutor] Mapping elements in various lists - walking over lists and their elements

2006-04-05 Thread Srinivas Iyyer
Dear Tutors, I have a huge string and 2 lists. List A consists of tabed elements, where first tab represents entry somewhere in string(ndat). ndat has 'Contig27915_RC' and List A [nbat]has 'Contig27915_RC\tXM_945977'. List B [nmlist]has elements, for instance ['XM_945977\tNM_152513']. Now my tas

Re: [Tutor] Mapping elements in various lists -

2006-04-05 Thread Srinivas Iyyer
Sorry for the very long email. and I my brain is dead to create some related generic snippet. Thus, I shrunk the string and lists into as short as I could. apologies again. srini --- Srinivas Iyyer <[EMAIL PROTECTED]> wrote: > Dear Tutors, > I have a huge string and 2 lists. Lis

Re: [Tutor] Mapping elements in various lists

2006-04-05 Thread Srinivas Iyyer
Hi Alan, Thank you again. I did not give a try by using dictionary power. It works now. Thanks again for tip. -srini. dida = {} for m in nbat: cols = m.split('\t') old = cols[0] dida.setdefault(old,[]).append(cols[1]) lista = ndat.split('\n') result = [] for i in li

[Tutor] changing 2x3 matrix to 3x2 matrix - using lists

2006-04-14 Thread Srinivas Iyyer
Dear group, I have a huge list of data. This was obtained using R through Rpy. the data resembles a 10K (row) x 30 (column) matrix. I processed the data column wise( obtained median values for duplicated rows). Now I am left with 500 rows and 30 columns. I want to print the same way. A

[Tutor] creating a tab delim file

2006-04-18 Thread Srinivas Iyyer
Hi group, I asked similar questions in the past. I am unable to get to the crux of this problem so that I can solve on my own. apologies for my ignorance. The problem: I have 50 tab delim files. Each file has 500 rows and 50 columns. I have to read the first column of each file. Repeat the s

[Tutor] Creating a graphical interface to database of gene coordinates

2006-04-21 Thread Srinivas Iyyer
Dear group, I am happy that I am slowly finding pyhonian projects related to my research area. Problem: 1. I have a database of human gene coordinates on chromosomes. 2. I have gene expression data from my lab concerning the genes I mentioned above. 3. I want to visualize expression data laid

Re: [Tutor] looking to hire a tutor

2006-04-22 Thread Srinivas Iyyer
Hi meenakshi, I am a postdoctoral fellow in oncology and with passion and I wanted to learn programming especially Python. I tried my luck in C, Java and PERL. To my surprise they were much harder to understand and work with. I chose Python to help my work and it helped me run my life easily. ju

[Tutor] how can I use Set.interaction function on a dictionary

2006-04-22 Thread Srinivas Iyyer
Hi Tutors, Background: 1. I have a dictionary with 4 keys and some repeated values for each key. >>> dida {'NM_001033044': [32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32842023, 32843894, 32843894, 32843894, 32843894, 32843894, 3

[Tutor] Is this called a 'Hash table method for string mapping'

2006-09-03 Thread Srinivas Iyyer
Dear group, for mapping a string of protein/nucleotides, BLAST is one tool that is highly sought. However, its performance is limited due to some factors and one such factor is length of the query string. IF the length of the query string is less than 30 characters, its output is questionable.

[Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
Dear group: I have a data like this: 10 15 16 20 25 35 45 50 55 60 61 65 75 80 Since 15 precedes 16, I want to consider 10:20 as one unit. If I repeat completely for data I would get: 10 20 25 35 45 50 55 65 75 80 test = ['10\t15', '1

Re: [Tutor] List manipulation

2006-09-13 Thread Srinivas Iyyer
e list: >>> for m in range(0,7): ... k = m+1 ... if int(x[k])-int(y[m])==1: ... print x[m]+'\t'+y[k] ... else: ... print x[m]+'\t'+y[m] ... 10 20 16 20 25 35 45 50 55 65 61 65 Traceback

[Tutor] Limitation of range() function in Walking problem

2006-09-15 Thread Srinivas Iyyer
Dear tutors: this question is in continuation of my previous question about list manipulations where Kent and Bob helped me. Thanks to you both. My aim was to walk along coordinates of exon of a gene on a chromosome. In simple terms: Coordinates of a variable G1: a1 : 3-8 b2 : 10-25 c3 : 7-18

Re: [Tutor] List manipulation

2006-09-15 Thread Srinivas Iyyer
AIL PROTECTED]> wrote: > Srinivas Iyyer wrote: > > Thank you Bob for your email. > > Sorry for the confusion. > > here is what I ment: > > > > test = ['10\t15', '16\t20', '25\t35', '45\t50', > > '55\t60', 

[Tutor] re.compile concatenating two searh words

2008-09-29 Thread Srinivas Iyyer
Hi Tutors, I have a list with elements as strings. I want to search if any of these element strings has two words of my interest. How can I ask re.compile to look for both words. my words are 'good' and 'bad'. import re pat = re.compile('good'+'bad') a = ['Rama is a good boy','Raghu is a g

[Tutor] Batch searches on Googlescholar

2008-10-07 Thread Srinivas Iyyer
Dear Tutors, This might ben off track question, but I am asking to seek help from experts here. I have a list of (n = 240) research publications (Biology and medicine). I have title, journal name and PubMedID. my aim is to identify how many times each publication got cited on google Scholar

[Tutor] finding numbers in range of of numbers

2008-10-20 Thread Srinivas Iyyer
dear group, a simple question that often challenges me. I have I have a list of list: [[10,45],[14,23],[39,73],[92,135]] I want to identify if any of the items in this list are in range of [5,100] These numbers are large in original data, I will be using xrange for memory issues. thank

Re: [Tutor] finding numbers in range of of numbers

2008-10-21 Thread Srinivas Iyyer
this is a correct way to tackle this kind of problem. Issue 3: I have 200K elements in a anb b lists. this code has been running for last 18 hours and only 800 elements of 200K have been evaluated. Could tutors help me with 3 issues. Thank you. srini --- On Tue, 10/21/08, Alan Gauld <