Skip to content

Commit

Permalink
rnaseqqc - rpy2 >3.0 changes
Browse files Browse the repository at this point in the history
This change makes rnaseqqc compatible with rpy2 3.1. That
probably means that it will make it incompatible with rpy3 <3.
A decision will need to be made whether to support this.
  • Loading branch information
IanSudbery committed Sep 2, 2021
1 parent e480395 commit b7036f9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cgatpipelines/tools/pipeline_rnaseqqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,8 @@ def runSalmon(infiles, outfiles):

@collate(runSalmon,
formatter(),
["salmon.dir/transcripts.tsv.gz",
"salmon.dir/genes.tsv.gz"])
["salmon.dir/transcripts.tsv.gz",
"salmon.dir/genes.tsv.gz"])
def mergeSalmonResults(infiles, outfiles):
''' merge counts for alignment-based methods'''

Expand Down Expand Up @@ -1443,9 +1443,9 @@ def plotTopGenesHeatmap(outfile):
''' % locals())

with localconverter(ro.default_converter + pandas2ri.converter):
r_intersection_pivot = ro.conversion.py2ri(intersection_pivot)
r_factors_df = ro.conversion.py2ri(factors_df)
r_intersection_pivot = ro.conversion.py2rpy(intersection_pivot)
r_factors_df = ro.conversion.py2rpy(factors_df)

plotHeatmap(r_intersection_pivot,
r_factors_df)

Expand All @@ -1469,7 +1469,7 @@ def plotExpression(outfile):
# See RnaseqqcReport.ExpressionDistribution tracker

dbh = P.connect()

statement = """
SELECT * FROM transcripts"""

Expand Down Expand Up @@ -1501,12 +1501,12 @@ def plotExpression(outfile):
f_colour_map = {f:
plt.cm.viridis((i % nlevels + 1)/float(nlevels))
for i, f in enumerate(factor_levels)}

for sname, subdf in df.groupby("sample_id"):
factor_level = str(factor_df.factor_value.loc[sname])
subdf.logTPM.plot(kind="density", color=f_colour_map[factor_level],
label=factor_level)

plt.title("TPM distribution by %(factor)s" % locals())
plt.xlabel("log2 TPM")
plt.ylabel("Density")
Expand All @@ -1516,8 +1516,7 @@ def plotExpression(outfile):
plt.legend(handles=legend_lines)
f.savefig(plotfile)
plt.close()



iotools.touch_file(outfile)

###################################################################
Expand Down

0 comments on commit b7036f9

Please sign in to comment.