<s> from __future__ import print_function <EOL> import json <EOL> import multiprocessing <EOL> import os <EOL> import subprocess <EOL> import sys <EOL> import tarfile <EOL> import urllib <EOL> class GknoTool ( object ) : <EOL> def __init__ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> self . out = sys . stdout <EOL> self . err = sys . stderr <EOL> self . environ = os . environ <EOL> def doBuild ( self ) : <EOL> assert False <EOL> return False <EOL> def doUpdate ( self ) : <EOL> assert False <EOL> return False <EOL> def build ( self , out = sys . stdout , err = sys . stderr ) : <EOL> self . out = out <EOL> self . err = err <EOL> return self . doBuild ( ) <EOL> def update ( self , out = sys . stdout , err = sys . stderr ) : <EOL> self . out = out <EOL> self . err = err <EOL> return self . doUpdate ( ) <EOL> def runCommand ( self , command ) : <EOL> p = subprocess . Popen ( command . split ( ) , env = self . environ , stdout = self . out , stderr = self . err ) <EOL> p . wait ( ) <EOL> status = p . returncode <EOL> return status == <NUM_LIT:0> <EOL> def runCommandList ( self , command , outputFile ) : <EOL> p = subprocess . Popen ( command , env = self . environ , stdout = outputFile , stderr = self . err ) <EOL> p . wait ( ) <EOL> status = p . returncode <EOL> return status == <NUM_LIT:0> <EOL> def runShellCommand ( self , command ) : <EOL> p = subprocess . Popen ( command . split ( ) , env = self . environ , stdout = self . out , stderr = self . err , shell = True ) <EOL> p . wait ( ) <EOL> status = p . returncode <EOL> return status == <NUM_LIT:0> <EOL> def ensureMakeDir ( self , directory , mode = <NUM_LIT:0> <NUM_LIT> ) : <EOL> if not os . path . exists ( directory ) : <EOL> os . makedirs ( directory , mode ) <EOL> def checkoutGitVersion ( self , version ) : <EOL> return self . runCommand ( "<STR_LIT>" + version ) <EOL> def ant ( self , optionString = "<STR_LIT>" ) : <EOL> return self . runCommand ( "<STR_LIT>" + optionString ) <EOL> def antClean ( self ) : <EOL> return self . runCommand ( "<STR_LIT>" ) <EOL> def cmake ( self , optionString = "<STR_LIT>" ) : <EOL> return self . runCommand ( "<STR_LIT>" + optionString ) <EOL> def make ( self , optionString = "<STR_LIT>" , cpus = multiprocessing . cpu_count ( ) ) : <EOL> return self . runCommand ( "<STR_LIT>" + str ( cpus ) + "<STR_LIT:U+0020>" + optionString ) <EOL> def makeClean ( self ) : <EOL> return self . runCommand ( "<STR_LIT>" ) <EOL> def install ( self , optionString ) : <EOL> return self . runCommand ( "<STR_LIT>" + optionString ) <EOL> class BamAddRg ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( BamAddRg , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class BamTools ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( BamTools , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> buildDir = os . getcwd ( ) + "<STR_LIT>" <EOL> self . ensureMakeDir ( buildDir ) <EOL> os . chdir ( buildDir ) <EOL> if not self . cmake ( "<STR_LIT:..>" ) : <EOL> return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . doBuild ( ) <EOL> class BamUtil ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( BamUtil , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class Bedtools ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Bedtools , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : return self . make ( cpus = <NUM_LIT:1> ) <EOL> def doUpdate ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class Blast ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Blast , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> blastSettings = { } <EOL> targetsFile = open ( "<STR_LIT>" ) <EOL> try : <EOL> blastSettings = json . load ( targetsFile ) <EOL> except : <EOL> return False <EOL> key = '<STR_LIT>' <EOL> if sys . platform == '<STR_LIT>' : <EOL> key = '<STR_LIT>' <EOL> else : <EOL> if sys . maxsize > <NUM_LIT:2> ** <NUM_LIT:32> : <EOL> key = '<STR_LIT>' <EOL> url = blastSettings [ key ] <EOL> try : <EOL> filename , headers = urllib . urlretrieve ( url ) <EOL> tar = tarfile . open ( filename ) <EOL> tar . extractall ( ) <EOL> tar . close ( ) <EOL> os . remove ( filename ) <EOL> except : <EOL> return False <EOL> return True <EOL> def doUpdate ( self ) : <EOL> filesList = os . listdir ( os . getcwd ( ) ) <EOL> blastFiles = [ ] <EOL> for f in filesList : <EOL> if f . startswith ( '<STR_LIT:.>' ) or f == '<STR_LIT>' : <EOL> continue <EOL> else : <EOL> blastFiles . append ( f ) <EOL> if len ( blastFiles ) == <NUM_LIT:0> : <EOL> return self . doBuild ( ) <EOL> return True <EOL> class Bwa ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Bwa , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class FastQValidator ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( FastQValidator , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class Freebayes ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Freebayes , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class Htslib ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Htslib , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class Jellyfish ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Jellyfish , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> os . chdir ( "<STR_LIT>" ) <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> self . environ [ "<STR_LIT>" ] = os . getcwd ( ) + "<STR_LIT>" <EOL> os . chdir ( "<STR_LIT:..>" ) <EOL> self . environ [ "<STR_LIT>" ] = os . getcwd ( ) + "<STR_LIT>" <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> if not self . runCommand ( "<STR_LIT>" + os . getcwd ( ) ) : return False <EOL> if not self . make ( ) : return False <EOL> return True <EOL> def doUpdate ( self ) : <EOL> os . chdir ( "<STR_LIT>" ) <EOL> self . environ [ "<STR_LIT>" ] = os . getcwd ( ) + "<STR_LIT>" <EOL> os . chdir ( "<STR_LIT:..>" ) <EOL> self . environ [ "<STR_LIT>" ] = os . getcwd ( ) + "<STR_LIT>" <EOL> if not self . runCommand ( "<STR_LIT>" ) : return False <EOL> if not self . runCommand ( "<STR_LIT>" + os . getcwd ( ) ) : return False <EOL> if not self . make ( ) : return False <EOL> return True <EOL> class LibStatGen ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( LibStatGen , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . doUpdate ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class Mosaik ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Mosaik , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> self . getPlatformType ( ) <EOL> def doBuild ( self ) : <EOL> os . chdir ( "<STR_LIT:src>" ) <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> os . chdir ( "<STR_LIT:src>" ) <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( ) <EOL> def getPlatformType ( self ) : <EOL> pl = '<STR_LIT>' <EOL> if sys . platform == '<STR_LIT>' : <EOL> pl = '<STR_LIT>' <EOL> if sys . maxsize > <NUM_LIT:2> ** <NUM_LIT:32> : <EOL> pl = '<STR_LIT>' <EOL> self . environ [ "<STR_LIT>" ] = pl <EOL> class Mutatrix ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Mutatrix , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . doUpdate ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class Picard ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Picard , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . antClean ( ) : <EOL> return False <EOL> return self . doUpdate ( ) <EOL> def doUpdate ( self ) : <EOL> if not self . ant ( "<STR_LIT>" ) : <EOL> return False <EOL> return self . ant ( "<STR_LIT>" ) <EOL> class Pindel ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Pindel , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . install ( optionString = '<STR_LIT>' ) <EOL> def doUpdate ( self ) : <EOL> return self . install ( optionString = '<STR_LIT>' ) <EOL> class Qplot ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Qplot , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( optionString = '<STR_LIT>' , cpus = <NUM_LIT:1> ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( optionString = '<STR_LIT>' , cpus = <NUM_LIT:1> ) <EOL> class Rufus ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Rufus , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class Samblaster ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Samblaster , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> return self . make ( ) <EOL> class Samtools ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Samtools , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> if not self . checkoutGitVersion ( '<STR_LIT>' ) : return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> if not self . checkoutGitVersion ( '<STR_LIT>' ) : return False <EOL> return self . make ( ) <EOL> class Seqan ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Seqan , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> self . ensureMakeDir ( os . getcwd ( ) + "<STR_LIT>" ) <EOL> os . chdir ( "<STR_LIT>" ) <EOL> if not self . cmake ( "<STR_LIT>" ) : return False <EOL> if not self . make ( "<STR_LIT>" ) : return False <EOL> os . chdir ( "<STR_LIT>" ) <EOL> return True <EOL> def doUpdate ( self ) : <EOL> return self . doBuild ( ) <EOL> class SnpEff ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( SnpEff , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> snpEffConfigFile = '<STR_LIT>' <EOL> snpEffConfig = open ( snpEffConfigFile , '<STR_LIT>' ) <EOL> command = [ ] <EOL> command . append ( '<STR_LIT>' ) <EOL> command . append ( '<STR_LIT>' + os . getcwd ( ) + '<STR_LIT>' ) <EOL> command . append ( snpEffConfigFile ) <EOL> return self . runCommandList ( command , snpEffConfig ) <EOL> def doUpdate ( self ) : <EOL> return True <EOL> class Tabix ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Tabix , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class Tangram ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Tangram , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . doUpdate ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( cpus = <NUM_LIT:1> ) <EOL> class VcfLib ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( VcfLib , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . doUpdate ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> class VerifyBamID ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( VerifyBamID , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : <EOL> return False <EOL> return self . make ( optionString = '<STR_LIT>' , cpus = <NUM_LIT:1> ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( optionString = '<STR_LIT>' , cpus = <NUM_LIT:1> ) <EOL> class Vt ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Vt , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> if not self . makeClean ( ) : return False <EOL> return self . make ( ) <EOL> class Wham ( GknoTool ) : <EOL> def __init__ ( self ) : <EOL> super ( Wham , self ) . __init__ ( ) <EOL> self . name = "<STR_LIT>" <EOL> self . installDir = "<STR_LIT>" <EOL> def doBuild ( self ) : <EOL> return self . make ( ) <EOL> def doUpdate ( self ) : <EOL> return self . make ( ) <EOL> List = [ <EOL> BamAddRg ( ) , <EOL> BamTools ( ) , <EOL> Bedtools ( ) , <EOL> Blast ( ) , <EOL> Bwa ( ) , <EOL> Freebayes ( ) , <EOL> Htslib ( ) , Samtools ( ) , Pindel ( ) , <EOL> LibStatGen ( ) , BamUtil ( ) , FastQValidator ( ) , Qplot ( ) , VerifyBamID ( ) , <EOL> Mosaik ( ) , <EOL> Mutatrix ( ) , <EOL> Picard ( ) , <EOL> Samblaster ( ) , <EOL> Seqan ( ) , <EOL> SnpEff ( ) , <EOL> Tabix ( ) , <EOL> Tangram ( ) , <EOL> VcfLib ( ) , <EOL> Vt ( ) , <EOL> Wham ( ) <EOL> ] </s>
