Skip to content

Commit

Permalink
Remove sonLib dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
benedictpaten committed Feb 14, 2013
1 parent 3914f2b commit f251646
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 0 additions & 1 deletion process/extensionMovesTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from pyAVG.inputs.simulator import RandomHistory
from deAVG import deAVG
from sonLib.bioio import system
import extensionMoves

class ExtensionMovesTest(unittest.TestCase):
Expand Down
18 changes: 13 additions & 5 deletions scripts/scriptsForAVGTheoryPaper/simulationsForPaperScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@
import time
import copy
import os
import subprocess

from pyAVG.DNAHistoryGraph.graph import DNAHistoryGraph
from pyAVG.process.extensionMoves import listCase1, listCase2, listCase3
from pyAVG.utils.tex import *

from pyAVG.inputs.simulator import RandomHistory
from pyAVG.process.deAVG import deAVG
from sonLib.bioio import system
import pyAVG.process.extensionMoves

"""Script generates results for "A Unifying Parsimony Model for Genome Evolution"
in a directory called "results".
"""

def system(command):
sts = subprocess.call(command, shell=True, bufsize=-1, stdout=sys.stdout, stderr=sys.stderr)
if sts != 0:
raise RuntimeError("Command: %s exited with non-zero status %i" % (command, sts))
return sts

def main():
experimentNumber = 5
iterationNumber = 1000
experimentNumber = 10
iterationNumber = 2000
startTime = time.time()
last = startTime
results = []
experiment = 0
segmentNumber = 5
epochs = 5
epochs = 4

outputDir = "results"
system("mkdir %s" % outputDir)
Expand Down Expand Up @@ -60,9 +66,11 @@ def homologousSidesHaveOnlyTrivialLifts(side):
assert baseGraph.lowerBoundRearrangementCost() <= avg.lowerBoundRearrangementCost()

#Selection of histories with what we want
if avg.lowerBoundRearrangementCost() == 0 or avg.lowerBoundSubstitutionCost() == 0 or baseGraph.substitutionAmbiguity() == 0 or baseGraph.rearrangementAmbiguity() == 0 or len([ segment for segment in baseGraph.segments if len(segment.children) == 0 ]) != 4*segmentNumber:
if avg.lowerBoundRearrangementCost() == 0 or avg.lowerBoundSubstitutionCost() == 0 or baseGraph.substitutionAmbiguity() == 0 or baseGraph.rearrangementAmbiguity() == 0 or len([ segment for segment in baseGraph.segments if len(segment.children) == 0 ]) <= 3*segmentNumber:
continue

print avg.lowerBoundRearrangementCost(), avg.lowerBoundSubstitutionCost(), baseGraph.substitutionAmbiguity(), baseGraph.rearrangementAmbiguity(), len([ segment for segment in baseGraph.segments if len(segment.children) == 0 ]), 2*segmentNumber

def reportGraph(graph, graphName, iteration, step):
graph = copy.copy(graph)
graph.addFreeRoots()
Expand Down

0 comments on commit f251646

Please sign in to comment.