Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #231

Merged
merged 8 commits into from
Nov 19, 2021
Merged

Devel #231

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions R/ALPACA.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,22 @@ alpaca <- function(net.table,file.stem,verbose=FALSE)
louv.Bscores <- NULL
for (i in seq_len(max(louv.memb)))
{
print(i)
this.comm <- names(louv.memb)[louv.memb==i]
this.tfs <- this.comm[grep("_A$",this.comm)]
this.genes <- this.comm[grep("_B$",this.comm)]
if (length(this.tfs)>=1){
if (length(this.tfs)>1){
tf.sums <- apply(dwbm[this.tfs,this.genes],1,sum)
gene.sums <- apply(dwbm[this.tfs,this.genes],2,sum)
if (length(this.genes)==1){
gene.sums <- sum(dwbm[this.tfs,this.genes])
tf.sums <- dwbm[this.tfs,this.genes]
}else if (length(this.genes)>1){
tf.sums <- apply(dwbm[this.tfs,this.genes],1,sum)
gene.sums <- apply(dwbm[this.tfs,this.genes],2,sum)
}
} else if (length(this.tfs)==1) {
tf.sums <- sum(dwbm[this.tfs,this.genes])
gene.sums <- dwbm[this.tfs,this.genes]
} else if (length(this.genes)==1){
gene.sums <- sum(dwbm[this.tfs,this.genes])
tf.sums <- dwbm[this.tfs,this.genes]
}
this.denom <- sum(dwbm[this.tfs,this.genes])
louv.Ascores <- c(louv.Ascores,tf.sums/this.denom)
Expand Down
7 changes: 4 additions & 3 deletions inst/extdata/panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pandas as pd
from scipy.stats import zscore
import numpy as np
import os

# this scirpt is derived from https://github.com/netZoo/netZooPy/blob/master/netZooPy/panda/panda.py
# and https://github.com/netZoo/netZooPy/blob/master/netZooPy/panda/timer.py
Expand Down Expand Up @@ -91,9 +92,9 @@ def __init__(self, expression_file, motif_file, ppi_file, computing='cpu',precis
if save_tmp:
with Timer('Saving expression matrix and normalized networks ...'):
if self.expression_data is not None:
np.save('/tmp/expression.npy', self.expression_data.values)
np.save('/tmp/motif.normalized.npy', self.motif_matrix)
np.save('/tmp/ppi.normalized.npy', self.ppi_matrix)
np.save('expression.npy', self.expression_data.values)
np.save('motif.normalized.npy', self.motif_matrix)
np.save('ppi.normalized.npy', self.ppi_matrix)

# delete expression data
del self.expression_data
Expand Down