Skip to content

Instantly share code, notes, and snippets.

View NPSDC's full-sized avatar

Noor Pratap Singh NPSDC

View GitHub Profile
@NPSDC
NPSDC / Snakefile.smk
Last active May 12, 2023 19:44
Snakefile
import yaml
from os.path import join
with open('cluster_partition.conf', 'r') as f:
partitions = yaml.safe_load(f)
def get_partition(rule_name):
return partitions[rule_name] if rule_name in partitions else partitions['__default__']
sim_save_dir = config['sim_save_dir']
getEffLen <- function(txp_len, max_len=1000, mean = 200, sd = 25)
{
if(txp_len > max_len)
return(txp_len-mean)
new_mean = mean(truncnorm::rtruncnorm(n=10000, b=txp_len, mean=mean, sd=sd))
return(ifelse(txp_len-new_mean > 0,txp_len-new_mean, new_mean-txp_len))
}
computeWeightedLFC <- function(y, tNodes) {
compLFC <- function(reps, conds) {
mC1 <- rowMeans(reps[,conds==1]) ##mean condition 1
mC2 <- rowMeans(reps[,conds==2]) ##mean condition 2
lfc <- log2(mC2+1) - log2(mC1+1)
return(lfc)
}
lfcCounts <- compLFC(assays(y)[["counts"]], colData(y)[["condition"]]) ## count LFC
varThresh <- log2(exp(1))^2*(1/rowMeans(assays(y)[["counts"]][,colData(y)[["condition"]]==1]) + 1/rowMeans(assays(y)[["counts"]][,colData(y)[["condition"]]==2])) ## threshold for variance
### Keybase proof
I hereby claim:
* I am npsdc on github.
* I am noorpratap (https://keybase.io/noorpratap) on keybase.
* I have a public key ASDT4ICFn2-6S5XHPwliTVntQR_QQJLrOS-QRZ6MJYFwPgo
To claim this, I am signing this object:
### Keybase proof
I hereby claim:
* I am npsdc on github.
* I am noorpratap (https://keybase.io/noorpratap) on keybase.
* I have a public key ASDT4ICFn2-6S5XHPwliTVntQR_QQJLrOS-QRZ6MJYFwPgo
To claim this, I am signing this object: