Commit 36306d05 authored by Blaise Li's avatar Blaise Li
Browse files

Added snakemake wrappers to compute RPK and TPM.

parent a5daeb29
import pandas as pd
counts_data = pd.read_table(snakemake.input.counts_data, index_col="gene")
feature_lengths = pd.read_table(snakemake.params.feature_lengths_file, index_col="gene")
common = counts_data.index.intersection(feature_lengths.index)
rpk = 1000 * counts_data.loc[common].div(feature_lengths.loc[common]["union_exon_len"], axis="index")
rpk.to_csv(snakemake.output.rpk_file, sep="\t")
import pandas as pd
rpk = pd.read_table(snakemake.input.rpk_file, index_col="gene")
tpm = 1000000 * rpk / rpk.sum()
tpm.to_csv(snakemake.output.tpm_file, sep="\t")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment