From 202ae5c75ed0b9c6191d4fdf2e86994b86f678c4 Mon Sep 17 00:00:00 2001 From: Venkat Malladi <Venkat.Malladi@utsouthwestern.edu> Date: Tue, 7 Mar 2017 10:09:44 -0600 Subject: [PATCH] fix syntax. --- rpkm.py | 4 ++-- rpkm_gro.py | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rpkm.py b/rpkm.py index 77e195a..4895f5f 100755 --- a/rpkm.py +++ b/rpkm.py @@ -47,7 +47,7 @@ def rpkm(peak_file,aln_file,exp_name,columns): columns.append(exp_name) ## RPKM = numReads / (geneLength/1000 * totalNumReads/1,000,000 ) peak_counts = peak_file.multi_bam_coverage(bams=[aln_file]) - total_counts = reduce(lambda x, y: x + y, [ int(l.rstrip('\n').split('\t')[2]) for l in pysam.idxstats(aln_file,,split_lines=True))]) + total_counts = reduce(lambda x, y: x + y, [ int(l.rstrip('\n').split('\t')[2]) for l in pysam.idxstats(aln_file,split_lines=True)]) rpkm = peak_counts.each(normalized_to_length, 3, float(math.pow(10,9))/total_counts).saveas("test.bed") rpkm_df = rpkm.to_dataframe() #os.remove('test.bed') @@ -61,7 +61,7 @@ def rpkm_strand(peak_file,aln_file,exp_name,columns): columns.append(exp_name) ## RPKM = numReads / (geneLength/1000 * totalNumReads/1,000,000 ) peak_counts = peak_file.multi_bam_coverage(bams=[aln_file],s=True) - total_counts = reduce(lambda x, y: x + y, [ int(l.rstrip('\n').split('\t')[2]) for l in pysam.idxstats(aln_file,,split_lines=True))]) + total_counts = reduce(lambda x, y: x + y, [ int(l.rstrip('\n').split('\t')[2]) for l in pysam.idxstats(aln_file,split_lines=True)]) rpkm = peak_counts.each(normalized_to_length, 6, float(math.pow(10,9))/float(total_counts)).saveas("test.bed") rpkm_df = rpkm.to_dataframe() #os.remove('test.bed') diff --git a/rpkm_gro.py b/rpkm_gro.py index cae162d..4cf65f2 100755 --- a/rpkm_gro.py +++ b/rpkm_gro.py @@ -48,7 +48,6 @@ def rpkm(peak_file,aln_file,exp_name,columns): ## RPKM = numReads / (geneLength/1000 * totalNumReads/1,000,000 ) peak_counts = peak_file.multi_bam_coverage(bams=[aln_file]) total_counts = reduce(lambda x, y: x + y, [ int(l.rstrip('\n').split('\t')[2]) for l in pysam.idxstats(aln_file,split_lines=True)]) - print total_counts rpkm = peak_counts.each(normalized_to_length, 3, float(math.pow(10,9))/total_counts).saveas("test.bed") rpkm_df = rpkm.to_dataframe() #os.remove('test.bed') -- GitLab