PICASO: Profiling Integrative Communities of Aggregated Single-cell Omics data
0.1.0
  • Using PICASO
  • Examples
  • API
    • PICASO
      • PICASO.kgraph
      • PICASO.link_clustering
      • PICASO.load_utils
PICASO: Profiling Integrative Communities of Aggregated Single-cell Omics data
  • API
  • PICASO
  • PICASO.link_clustering
  • View page source

PICASO.link_clustering

changes 2010-08-27:
  • all three output files now contain the same community id numbers

  • comm2nodes and comm2edges both present the cid as the first

entry of each line. Previously only comm2nodes did this. * implemented weighted version, added ‘-w’ switch * expanded help string to explain input and outputs

changes 2021-02-05:
  • Support Python 3.x

Classes

HLC

MyParser

Class attributes:

Functions

swap(a, b)

Dc(m, n)

partition density

similarities_unweighted(adj)

Get all the edge similarities. Input dict maps nodes to sets of neighbors.

similarities_weighted(adj, ij2wij)

Same as similarities_unweighted but using tanimoto coefficient. `adj' is a dict

read_edgelist_unweighted(filename[, delimiter, nodetype])

reads two-column edgelist, returns dictionary

read_edgelist_weighted(filename[, delimiter, ...])

same as read_edgelist_unweighted except the input file now has three

write_edge2cid(e2c, filename[, delimiter])

writes the .edge2comm, .comm2edges, and .comm2nodes files

write_dendro(filename, orig_cid2edge, linkage)

Module Contents

PICASO.link_clustering.swap(a, b)
PICASO.link_clustering.Dc(m, n)

partition density

class PICASO.link_clustering.HLC(adj, edges)
adj
edges
Mfactor
edge2cid
orig_cid2edge
curr_maxcid = 0
linkage = []
D = 0.0
initialize_edges()
merge_comms(edge1, edge2, S, dendro_flag=False)
single_linkage(threshold=None, w=None, dendro_flag=False)
PICASO.link_clustering.similarities_unweighted(adj)

Get all the edge similarities. Input dict maps nodes to sets of neighbors. Output is a list of decorated edge-pairs, (1-sim,eij,eik), ordered by similarity.

PICASO.link_clustering.similarities_weighted(adj, ij2wij)

Same as similarities_unweighted but using tanimoto coefficient. `adj’ is a dict mapping nodes to sets of neighbors, ij2wij is a dict mapping an edge (ni,nj) tuple to the weight wij of that edge.

PICASO.link_clustering.read_edgelist_unweighted(filename, delimiter=None, nodetype=str)

reads two-column edgelist, returns dictionary mapping node -> set of neighbors and a list of edges

PICASO.link_clustering.read_edgelist_weighted(filename, delimiter=None, nodetype=str, weighttype=float)

same as read_edgelist_unweighted except the input file now has three columns: node_i<delimiter>node_j<delimiter>weight_ij<newline> and the output includes a dict `ij2wij’ mapping edge tuple (i,j) to w_ij

PICASO.link_clustering.write_edge2cid(e2c, filename, delimiter='\t')

writes the .edge2comm, .comm2edges, and .comm2nodes files

PICASO.link_clustering.write_dendro(filename, orig_cid2edge, linkage)
class PICASO.link_clustering.MyParser(usage=None, option_list=None, option_class=Option, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)

Bases: optparse.OptionParser

Class attributes:
standard_option_list[Option]

list of standard options that will be accepted by all instances of this parser class (intended to be overridden by subclasses).

Instance attributes:
usagestring

a usage string for your program. Before it is displayed to the user, “%prog” will be expanded to the name of your program (self.prog or os.path.basename(sys.argv[0])).

progstring

the name of the current program (to override os.path.basename(sys.argv[0])).

descriptionstring

A paragraph of text giving a brief overview of your program. optparse reformats this paragraph to fit the current terminal width and prints it when the user requests help (after usage, but before the list of options).

epilogstring

paragraph of help text to print after option help

option_groups[OptionGroup]

list of option groups in this parser (option groups are irrelevant for parsing the command-line, but very useful for generating help)

allow_interspersed_argsbool = true

if true, positional arguments may be interspersed with options. Assuming -a and -b each take a single argument, the command-line

-ablah foo bar -bboo baz

will be interpreted the same as

-ablah -bboo – foo bar baz

If this flag were false, that command line would be interpreted as

-ablah – foo bar -bboo baz

– ie. we stop processing options as soon as we see the first non-option argument. (This is the tradition followed by Python’s getopt module, Perl’s Getopt::Std, and other argument- parsing libraries, but it is generally annoying to users.)

process_default_valuesbool = true

if true, option default values are processed similarly to option values from the command line: that is, they are passed to the type-checking function for the option’s type (as long as the default value is a string). (This really only matters if you have defined custom types; see SF bug #955889.) Set it to false to restore the behaviour of Optik 1.4.1 and earlier.

rargs[string]

the argument list currently being parsed. Only set when parse_args() is active, and continually trimmed down as we consume arguments. Mainly there for the benefit of callback options.

largs[string]

the list of leftover arguments that we have skipped while parsing options. If allow_interspersed_args is false, this list is always empty.

valuesValues

the set of option values currently being accumulated. Only set when parse_args() is active. Also mainly for callbacks.

Because of the ‘rargs’, ‘largs’, and ‘values’ attributes, OptionParser is not thread-safe. If, for some perverse reason, you need to parse command-line arguments simultaneously in different threads, use different OptionParser instances.

format_epilog(formatter)
Previous Next

© Copyright 2024, Joppich, Hayat.

Built with Sphinx using a theme provided by Read the Docs.