MCPcopy Create free account
hub / github.com/CamaraLab/scTDA / expr

Method expr

scTDA/main.py:1027–1048  ·  view source on GitHub ↗

Returns the number of rows with non-zero expression of gene or list of genes specified by argument 'genin'. Optional argument 'group' allows to restrict this method to one of the node groups specified in the file name.groups.json.

(self, genis, group=None)

Source from the content-addressed store, hash-verified

1025 return 0.0, 0.0, 0.0
1026
1027 def expr(self, genis, group=None):
1028 """
1029 Returns the number of rows with non-zero expression of gene or list of genes specified by argument 'genin'.
1030 Optional argument 'group' allows to restrict this method to one of the node groups specified in the file
1031 name.groups.json.
1032 """
1033 per = []
1034 if group is not None:
1035 if type(group) == list:
1036 for k in group:
1037 per += self.dicgroups[k]
1038 per = list(set(per))
1039 else:
1040 per = self.dicgroups[group]
1041 po = []
1042 for q in per:
1043 po += list(self.dic[str(q)])
1044 po = list(set(po))
1045 pi = sum(1 for i in numpy.array(self.dicgenes[genis])[po] if i > 0.0)
1046 else:
1047 pi = sum(1 for i in self.dicgenes[genis] if i > 0.0)
1048 return pi
1049
1050 def save(self, n=500, filtercells=0, filterexp=0.0, annotation={}):
1051 """

Callers 3

saveMethod · 0.95
drawMethod · 0.95
saveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected