[Tutor] R: Tutor Digest, Vol 134, Issue 36

2015-04-13 Thread jarod...@libero.it
At the moment I use this way to resolve my question: re.findall(r'(\w+):\W(\d+)',str(tp[0])) However please gave me you suggestion on how to improve my ability to use regular expression on python Thanks so much! ___ Tutor maillist - Tutor@python.o

[Tutor] Regular expression on python

2015-04-13 Thread jarod...@libero.it
Dear all. I would like to extract from some file some data. The line I'm interested is this: Input Read Pairs: 2127436 Both Surviving: 1795091 (84.38%) Forward Only Surviving: 17315 (0.81%) Reverse Only Surviving: 6413 (0.30%) Dropped: 308617 (14.51%) with open("255.trim.log","r") as p:

[Tutor] Execution of local data

2015-01-27 Thread jarod...@libero.it
I create a list of local object: but I can't execute as object only as string: ena = Rnaseq(options.configura, options.rst) job_1 = ena.trimmomatic() job_2 = ena.star() job_3 = ena.wiggle() job_4 = ena.rnaseqc() job_5 = ena.picard_sort_sam()

[Tutor] R: Tutor Digest, Vol 131, Issue 60 order loop from methos on class

2015-01-26 Thread jarod...@libero.it
dear all, thanks so much!! I explain better my problem :http://pastebin.com/iiPZMi2U this is my workflow. Take my data from readset an create a command list ena = Rnaseq() The order of the self.step are the order I wan to to execute my analisys. So this is the order: In [160]: ena.show() 1- tr

[Tutor] R: Re: Tutor Digest, Vol 131, Issue 59 Order loop from methos on class (jarod...@libero.it)

2015-01-26 Thread jarod...@libero.it
Thanks so much!! Now I understood it is a stupid thing! So, could you elpme to decompose the problem? I initiazlizate the class with the file to use so all the function have all the parameters that I need. At the moment I have in mind only to do this: ena = Rna() job1 = ena.trim() job2 = ena.alig

[Tutor] order loop from methos on class

2015-01-26 Thread jarod...@libero.it
Dear All, What is the best way to loop on methos on a class? class Rna(): def trim(): ... def align(): ... ena = Rna() ena.trim() ena.aling() Thanks for any suggestion!!! ___ Tutor maillist - Tutor@python.org To unsubscri

[Tutor] R: Re: Re: Re: Class learning

2015-01-23 Thread jarod...@libero.it
Thanks so much for clear explanation!!! So in this way work . In [38]: Test().x.__name__ Out[38]: 'x' The decoratory proprerty dosen't help to create the class in fast way.. When it is advisable use @property? ___ Tutor maillist - Tutor@python.org T

[Tutor] R: Re: Re: Class learning

2015-01-23 Thread jarod...@libero.it
/2015 11.08 >A: "jarod...@libero.it" >Cc: "Python Tutor Mailing List" >Ogg: Re: Re: [Tutor] Class learning > >On Fri, Jan 23, 2015 at 12:37 AM, jarod...@libero.it wrote: >> Thanks for the help and patience! >> It is a function on the class so I suppos

[Tutor] R: Re: Class learning

2015-01-23 Thread jarod...@libero.it
Thanks for the help and patience! It is a function on the class so I suppose for read that function list I need self.steps Where I'm wrong? @propertydef steps(self):return [ self.trimmomatic, self.merg

[Tutor] Class learning

2015-01-22 Thread jarod...@libero.it
Dear All How can gave the attributes __name__ to a function? class Foo(object): def __init__(self): steps = {} tmp = open("rnaseq.base.ini","rb") config.readfp(tmp) readsets = parse_illumina_readset_file("/home/mauro/Desktop/readset.csv") @prop

[Tutor] Class errors

2015-01-22 Thread jarod...@libero.it
Dear All, I created a class that invoke from another file another class I get an error that I do not understand: gobal name Job is not defined However If I see the class imported I found the class Job. Any suggestion or example on class invoke another class #job,py class Jobs: . #trial

Re: [Tutor] Learning class code and function (Alan Gauld)

2015-01-21 Thread jarod...@libero.it
>I'd also question why you seem to have a function that has the class >name in its name? Should that function not be a method of the class? >Or is it part of some third party library perhaps? Thanks for the clarification!! Could you please make an example of this two condition I still try to devo

[Tutor] Learning class code and function

2015-01-20 Thread jarod...@libero.it
Dear all, I continue to try to understand some code: class Tutto(): def __init__(self): print "Ok" #@property def readsets(self,nome): self.nome = nome self._readsets = parse_tutto_readset_file(self.nome) return self._readsets Why If uncomment the decora

[Tutor] How to use a function

2015-01-19 Thread jarod...@libero.it
Dear All, I would like to understand how work this funcion: def parse_illumina_readset_file(illumina_readset_file): readsets = [] samples = [] log.info("Parse readset " + illumina_readset_file + " ...") readset_csv = csv.DictReader(open(illumina_readset_file, 'rb'), delimiter='\t

Re: [Tutor] Parse files and create sqlite3 db (Alan Gauld)

2014-12-03 Thread jarod...@libero.it
thanks so much,here you have the error: --- NameError Traceback (most recent call last) in () 43 status = line[-4:] # and overall status pas

[Tutor] Parse files and create sqlite3 db

2014-12-03 Thread jarod...@libero.it
Dear all I aattach the file I want to parse and I wanto to create a sqlite database. The problem is I'm not able to create in the right way because there is some logic problems on my script. I have this code: import sqlite import sqlite3 import os # Creates or opens a file called mydb with a S

Re: [Tutor] Subprocess how to use?

2014-11-06 Thread jarod...@libero.it
Dear All thanks so much for the suggestion !!! One thing is not clear to me: How can write more safe string to send on subprocess.Popen() without %s? What is the best way to do this? thanks so much! ___ Tutor maillist - Tutor@python.org To unsubscr

[Tutor] Subprocess how to use?

2014-11-05 Thread jarod...@libero.it
Dear All, I need to use external program from my scirpt. code = "intersectBed -a %s -b /database/Refseq_Gene2.bed -wa -wb|cut -f 4,8|uniq > tmp.tmp1"%("gene5.tmp.bed") code2 = "intersectBed -a %s -b /database/Refseq_Gene2.bed -wa -wb|cut -f 4,8|uniq > tmp.tmp2"%("gene3.tmp.bed") proc =

[Tutor] R: re question on array

2014-10-30 Thread jarod...@libero.it
;than "Re: Contents of Tutor digest..." > > >Today's Topics: > > 1. Re: Would somebody kindly... (Steven D'Aprano) > 2. Re: Would somebody kindly... (Dave Angel) > 3. question on array Operation (jarod...@libero.it) > 4. Re: question on array

[Tutor] question on array Operation

2014-10-29 Thread jarod...@libero.it
Dear All, I have a long matrix where I have the samples (1to n) and then I have (1to j )elements. I would like to count how many times each j element are present on each samples. So the question is which is the best algoritm for obtain the results. The result I want is a table like that. A

[Tutor] python draw christman tree using loops

2014-10-19 Thread jarod...@libero.it
Dear All, or improve my understanding o python I would like to learn how to draw simple figures using loops. I start from this code in java: import java.util.Scanner; public class Eserc2_8 { public static void main(String args[]) { Scanner s = new Scanner(System.in); // Altezz

[Tutor] Regular expression

2014-09-23 Thread jarod...@libero.it
Hi there!! I need to read this file: pippo.count : 10566 ZXDC 2900 ZYG11A 7909 ZYG11B 3584 ZYX 9614 ZZEF1 17704 ZZZ3 This file present a use space on the begin then they have a number and the a word. p =re.compile("\s+\d+") with open("pippo.count") as p: for i in p:

Re: [Tutor] Re subprocess

2014-09-11 Thread jarod...@libero.it
Thanks for the suggestion and corrections. I don't put the else staement onf if log_file but now I realize my mistake I have 3 comand to do: step_1_out =["STAR --genomeDir /home/sbsuser/databases/Starhg19/GenomeDir/ -- runMode alignReads --readFilesIn %s %s --runThreadN 12 --readFilesCommand z

[Tutor] Re subprocess

2014-09-10 Thread jarod...@libero.it
thon.org > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of Tutor digest..." > > >Today's Topics: > > 1. Re: Good approach regarding classes attribute

Re: [Tutor] Understand subprocess poll

2014-09-09 Thread jarod...@libero.it
e, Sep 9, 2014 at 9:09 AM, Sydney Shall wrote: > >> And while I am writing, what does OP stand for in this list? > >"Original Poster". So I understand. Won't answer the Python question >since I'm a newbie here myself. > >-- >Mind on a Mis

[Tutor] Understand subprocess poll

2014-09-09 Thread jarod...@libero.it
Dear all!! I want to use subprocess for run some programs But I need to be sure the program end before continue with the other: subprocess.call("ls") cmd1 = i p1 = subprocess.Popen(cmd1,shell=True,stdout=subprocess.PIPE) while True: if p1.poll() is None: time.sleep(3) pass if p1.poll()==0: print

[Tutor] how to be sure the process are ended

2014-09-09 Thread jarod...@libero.it
>Messaggio originale >Da: jarod...@libero.it >Data: 08/09/2014 18.15 >A: >Ogg: how to be sure the process are ended > >Dear all!! >I want to use subprocess for run some programs But I need to be sure the >program end before continue with the ot

[Tutor] python pipeline

2014-09-01 Thread jarod...@libero.it
Dear all, I'll try to write a pipeline starting from a csv file where I write the name and the path of my files. example.csv Name,FASTQ1,FASTQ2,DIRECTORY sampleA,A_R1_.fastq.gz,A_R2_.fastq.gz,108,~/FASTQ/ sampleB,B_R1_.fastq.gz,B_R2_.fastq.gz,112,~/FASTQ/ On that list I need to send each time 3

[Tutor] R: Tutor Digest, Vol 125, Issue 71

2014-07-23 Thread jarod...@libero.it
your Subject line so it is more specific >than "Re: Contents of Tutor digest..." > > >Today's Topics: > > 1. How to show dictionary item non present on file > (jarod...@libero.it) > 2. Re: How to show dictionary item non present on file > (

[Tutor] How to show dictionary item non present on file

2014-07-22 Thread jarod...@libero.it
Hin there!!! I have a niave question on dictionary analysis: If you have a dictionary like this: diz Out[8]: {'elenour': 1, 'frank': 1, 'jack': 1, 'ralph': 1} and you have a list and you want to know which keys are not present on my dictionary the code are simple. for i in diz.keys(): ...:

[Tutor] R: Tutor Digest, Vol 125, Issue 49

2014-07-16 Thread jarod...@libero.it
Hi there!!! I have a file with this data ['uc002uvo.3 ', 'uc001mae.1'] ['uc010dya.2 ', 'uc001kko.2'] ['uc003ejx.2 ', 'uc010yfr.1'] ['uc001bhk.2 ', 'uc003eib.2'] ['uc001znc.2 ', 'uc001efn.2'] ['uc002ycq.2 ', 'uc001vnh.2'] ['uc001odf.1 ', 'uc002mwd.2'] ['uc010jkn.1 ', 'uc010luk.1'] ['uc003uhf.3 ', '

Re: [Tutor] How to create a dictionary for ount elements

2014-06-04 Thread jarod...@libero.it
Dear all thanks for your suggestion!!! Thanks to your suggestion I create this structure:with open("prova.csv") as p: for i in p: lines =i.rstrip("\n").split("\t") ...: print lines ...: ['programs ', 'sample', 'gene', 'values'] ['program1', 'sample1', 'TP53', '2']

[Tutor] How to create a dictionary for ount elements

2014-06-03 Thread jarod...@libero.it
HI there!!! I have afile like this: file.txt programssample gene program1sample1 TP53 program1sample1 TP53 program1sample2 PRNP program1sample2 ATF3 program2sample1 TP53 program2sample1 PRNP program2sample2 TRIM32 program2sam

[Tutor] How parse files in function of number of lines

2014-05-28 Thread jarod...@libero.it
Dear all! I have two example files: tmp.csv: namevalue root mark34 yes tmp2.csv namevalue root I want to print a different text if I have more than one row and if I have only one row. My code is this: with open("tmp.csv") as p: header =p.next() for i in p: p

[Tutor] R: Tutor Digest, Vol 123, Issue 65

2014-05-27 Thread jarod...@libero.it
reach the person managing the list at > tutor-ow...@python.org > >When replying, please edit your Subject line so it is more specific >than "Re: Contents of Tutor digest..." > > >Today's Topics: > > 1. Help on best way to check resence of item inside l

[Tutor] Help on best way to check resence of item inside list

2014-05-27 Thread jarod...@libero.it
Dear All clubA= ["mary","luke","amyr","marco","franco","lucia", "sally","genevra"," electra"] clubB= ["mary","rebecca","jane","jessica","judit","sharon","lucia", "sally"," Castiel","Sam"] I have a list of names that I would to annotate in function of presence in different clubs: my input files

[Tutor] Help merge files using python

2013-11-13 Thread jarod...@libero.it
Hi I want to merge many files like this: #file1 A 10 B 20 C 30 #file2 B 45 Z 10 #file1 A 60 B 70 C 10 I want to obtain A 10 0 60 B 20 45 70 C 30 0 10 Z 0 10 0 I try to do like this: f = os.listdir(".") for i in f: T =open(i,"r") for r in t.readli

[Tutor] Read and write list on I file

2013-01-26 Thread jarod...@libero.it
HI there!!! I have a file like this: 12345-2 ppp 12389-4 i ... I want to read this file and organize in different way: The second number present after "-" mea