[Tutor] Problem on parsing data

2017-03-13 Thread jarod_v6--- via Tutor
I have a csv file with "," as separator. If I try to separate using ",": I have many different rows some with 30 columns some with 50 depend on many "," In [105]: dimension_columns = [] In [106]: with open(nomi) as f: for i in f: lines = i.rstrip

[Tutor] R: Re: Create a pivot table (Peter Otten)

2016-05-20 Thread jarod_v6--- via Tutor
Thanks s much for the help. I want to obtain table like this: >csv.writer(sys.stdout, delimiter="\t").writerows(table) >A100D33 D34 D35 D36 D37 D38 D39 >A 5 0 ... >B 2 2 ... >C 0 .. > I have tried the pandas way but unfortuna

[Tutor] Create a pivot table

2016-05-19 Thread jarod_v6--- via Tutor
Dear All! This is my data from a file. I want to obtain a count table how many times c11 are present for each project and Samples and Program. ['Program', 'Sample', 'Featurename', 'Project'], ['A', 'A100', 'c11', 'post50'], ['A', 'A100', 'c12', 'post50'], ['A', 'A100', 'c14', 'post50'], ['A

[Tutor] R: Tutor Digest, Vol 146, Issue 23

2016-04-20 Thread jarod_v6--- via Tutor
Thanks so much!! Now I try to understand. Once I have did the matrix at absence on presence I want to subtitute the values of 1 or 0 inside the table extract some values form dictionary called tutto. ___ Tutor maillist - Tutor@python.org To unsu

[Tutor] R:reformatting data and traspose dictionary

2016-04-20 Thread jarod_v6--- via Tutor
Dear All, sorry for my not good presentation of the code. I read a txt file and I prepare a ditionary files = os.listdir(".") tutto={} annotatemerge = {} for i in files: with open(i,"r") as f: for it in f: lines = it.rstrip("\n").split("\t")

[Tutor] reformatting data and traspose dictionary

2016-04-20 Thread jarod_v6--- via Tutor
Hi!!! I have this problems I have a dictionary like this: [Name_file ::position] = lines #Samplename::chr10-43606756-C-T::['chr10', '43606756', '.', 'C', 'T', '100.00', 'PASS', 'DP=439;TI=NM_020630,NM_020975;GI=RET,RET;FC=Synonymous_V455V,Synonymous_V455V;EXON', 'GT:GQ:AD:VF:NL:SB:GQX', '0/1

[Tutor] Dictionary on data

2015-11-20 Thread jarod_v6--- via Tutor
Dear All! I have this elements In [445]: pt = line.split("\t")[9] In [446]: pt Out[446]: 'gene_id "ENSG0223972"; gene_version "5"; transcript_id "ENST0456328"; transcript_version "2"; exon_number "1"; gene_name "DDX11L1"; gene_source "havana"; gene_biotype "transcribed_unprocessed_pse

Re: [Tutor] Strange error (Peter Otten)

2015-11-20 Thread jarod_v6--- via Tutor
Thanks so much!! was a very silly error ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Strange error

2015-11-19 Thread jarod_v6--- via Tutor
HI!! This is my list: In [378]: type(Span) Out[378]: list In [379]: Span Out[379]: [['M02898:39:0-AH4BK:1:2107:17412:10850', 'M02898:39:0-AH4BK:1:2117:15242:18766', 'M02898:39:0-AH4BK:1:1112:21747:21214', 'M02898:39:0-AH4BK:1:2112:5119:9813', 'M02898:39:00

Re: [Tutor] How to parse large files

2015-11-01 Thread jarod_v6--- via Tutor
Thanks!! I use python2.7 Can Also use in that version? I don't understand why use partition and not split(). what is the reason for that? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/ma

Re: [Tutor] How to parse large files

2015-11-01 Thread jarod_v6--- via Tutor
My file have 1960607 rows but I don't understand why I'm not able to create a dictionary in fast way I try to use also gc.disable but Not work. I need to have dictionary but I have this erro: with shelve.open("diz5") as db: with open("tmp1.txt") as instream: for line in instream:

[Tutor] R: Re: Create complex dictionary :p:

2015-10-27 Thread jarod_v6--- via Tutor
Sorry, I just realize my question are wrong: I want to knowhow to do dictionary of dictionary in most python way: diz = { "A"={"e"=2,"s"=10},"B"={"e"=20,"s"=7}} So I have some keys (A,B) is correlate with a new dictionary where I have other key I want to use. I want to extract for each key the

[Tutor] How to parse large files

2015-10-27 Thread jarod_v6--- via Tutor
Hi! I want to reads two files and create simple dictionary. Input file contain more than 1 rows diz5 = {} with open("tmp1.txt") as p: for i in p: lines = i.rstrip("\n").split("\t") diz5.setdefault(lines[0],set()).add(lines[1]) diz3 = {} with open("tmp2.txt") as p:

[Tutor] Create complex dictionary

2015-10-22 Thread jarod_v6--- via Tutor
Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) What is the most pythonic way to build a dictionary of dictionary?thanks for any help! ___ Tutor maillist - Tutor@python.org

[Tutor] Refresh library imported

2015-08-11 Thread jarod_v6--- via Tutor
HI there!! I try to develop some scripts. I use ipython for check if my script work. When I change the script and try to import again that script I'm not able to see the modification so I need every time close ipython and run again and import the script. How can do the refresh of library wit

[Tutor] R: Tutor Digest, Vol 138, Issue 26 Re: Problem on select esecution of object in a class (Alan Gauld)

2015-08-05 Thread jarod_v6--- via Tutor
Thanks so much fro the help. What I want to do is to obtain a selection of the function I want to run. ena = Rnaseq(options.configura, options.rst, options.outdir) cmdset = [ ena.trimmomatic, ena.star,

[Tutor] Problem on select esecution of object in a class

2015-08-05 Thread jarod_v6--- via Tutor
I have a class with many objects and I want to select using opt parse some function id = options.step ena = Rnaseq(options.configura, options.rst, options.outdir) now = datetime.datetime.now() ena.show() diz = {} for i,t in enumerate(ena.steps()):

[Tutor] R: Tutor Digest, Vol 136, Issue 19

2015-06-08 Thread jarod_v6--- via Tutor
Thanks for the help!! The data I put unfortunately was runcated: ENSG0267199 11.8156750037 1.74423209120.51035586473.4176781572 0.00063157740.0122038731ENSG0267199 NA NA NA ENSG0267206 27.9863824875 -1.7496803666 0.5026610268-3.4808355401 0.0

[Tutor] Problem on filtering data

2015-06-08 Thread jarod_v6--- via Tutor
Dear All; I have a very silly problem. with open("Dati_differenzialigistvsminigist_solodiff.csv") as p: for i in p: lines = i.strip("\n").split("\t") if lines[8] != "NA": if lines[8] : print lines[8] Why I continue to obtain "" empity line? "bas