Ejemplo n.º 1
0
def process(args):
    # Create the Genonets object. This will load the input file into
    # memory.
    gn = Genonets(args)

    # Use 'gn' to create genotype networks for all genotype sets.
    gn.create()

    # Perform only 'Robustness' and 'Evolvability' analyses on just two of
    # the genotype sets available in the input file, i.e., 'Foxa2' and 'Bbx'.
    gn.analyze(["Foxa2", "Bbx"], analyses=[ac.ROBUSTNESS, ac.EVOLVABILITY])

    # Write the given genotype networks to files in GML format.
    # For a genotype network with two or more components, two files are generated:
    # One corresponds to the entire network with all components, and the other
    # corresponds to the dominant component only.
    gn.save(["Foxa2", "Bbx"])

    # Save genotype network level measures for the given genotype sets to
    # 'Genotype_set_measures.txt'.
    gn.save_network_results(["Foxa2", "Bbx"])

    # Save all genotype level measures for the given genotype sets to
    # 'Foxa2_genotype_measures.txt' and 'Bbx_genotype_measures.txt' files.
    gn.save_genotype_results(["Foxa2", "Bbx"])
Ejemplo n.º 2
0
def process(args):
    # Create the Genonets object. This will load the input file into
    # memory.
    gn = Genonets(args)

    # Use 'gn' to create genotype networks for all genotype sets.
    gn.create()

    # Perform all available analyses on all genotype networks.
    gn.analyze()

    # Write all genotype networks to files in GML format. For a genotype network
    # with two or more components, two files are generated: One corresponds to the
    # entire network with all components, and the other corresponds to the dominant
    # component only.
    gn.save()

    # Save all genotype network level measures to 'Genotype_set_measures.txt'.
    gn.save_network_results()

    # Save all genotype level measures to '<genotypeSetName>_genotype_measures.txt'
    # files. One file per genotype set is generated.
    gn.save_genotype_results()
Ejemplo n.º 3
0
def process(args):
    # Create the Genonets object. This will load the input file into
    # memory.
    gn = Genonets(args)

    # Use 'gn' to create genotype networks for all genotype sets.
    gn.create()

    # Perform 'Peaks' analysis
    gn.analyze(analyses=[ac.PEAKS])

    # At this point, the analysis is done. We now need to extract the
    # data we need, i.e., the peaks dictionary.

    # For each genotype set,
    for genotypeSet in gn.genotype_sets():
        # Get the igraph object for the giant
        giant = gn.dominant_network(genotypeSet)

        # Get the dict of peaks {key=peakId : value=[list of sequences in the peak]}
        peaks = giant["Peaks"]

        # Update the dict of peaks, so that instead of just a list of
        # genotypes, we have a list of tuples (sequence, escore).
        newPeaks = {}

        # For each peak,
        for peak in peaks:
            # Initialize the list of tuples
            seqScrTuples = []

            # For each sequence in this peak,
            for sequence in peaks[peak]:
                # Find the corresponding vertex in the giant
                try:
                    vertex = giant.vs.find(sequences=sequence)
                except ValueError:
                    print("Oops! can't find " + sequence + " in giant.")

                # Get the escore
                score = giant.vs[vertex.index]["escores"]

                # Add the tuple to the list of tuples
                seqScrTuples.append((sequence, score))

            # Add the peak and the corresponding list of tuples to the
            # new peaks dict
            newPeaks[peak] = seqScrTuples

        # Replace the peaks dict in giant with the new dict. This is
        # useful because now if you use the genonets functions below to
        # save the network and results, the updated peaks dict with tuples
        # will be written automatically to file.
        giant["Peaks"] = newPeaks

    # Save networks to file in GML format
    gn.save()

    # Save the results to file from network level analysis
    gn.save_network_results()