Beispiel #1
0
 def go(self):
     """Execution function: coordinates options used and background GC calculation, then runs
     TAMO.MD.AlignAce.MetaAce and catches the output in self.output for access from MDAP.
     Output is TAMO.AligAce result object."""
     import time
     # Calc GC background of genomic sequences representing the
     # entire data set if requested.
     if self.mdapOptions['background'] == 1:
         self.dataStats = seqStats.calcStats(self.mdapArgs[0])
         self.gcback = self.dataStats['percentGC']
         
     # write a temp fasta file of coregulated seqs to use as input to Meme(file=TempFasta)
     ctimeStr  = time.ctime().replace(' ','_')
     fileName  = 'tempFastaOfCoRegSeqs.MDAP.%s.fas' %(ctimeStr)
     tFasta    = open(fileName, 'w')
     tFastaTxt = Fasta.text(self.coRegSeqs[0])
     tFasta.write(tFastaTxt)
     
     # call TAMO to do its thing
     self.output = MetaAce(fileName, self.width, self.iterations, self.gcback)
     pass
Beispiel #2
0
import sys
import pickle


assert 4 >= len(sys.argv[1:]) >= 3, 'usage: python %s fastaDir iterations runName [globPatern]' \
       % (sys.argv[0].split('/')[-1])

if len(sys.argv[1:]) > 3:
    globPattern = sys.argv[4]
else:
    globPattern = '*.fas'
    
fastaPaths = glob.glob(sys.argv[1]+globPattern)

gcBacks = []
for path in fastaPaths:
    stats = calcStats(path)
    gcBacks.append(stats['percentGC'])
    

metaAceObjs = []
for i in range(len(fastaPaths)):
    metaAceObjs.append(MetaAce(fastaPaths[i],iterations=int(sys.argv[2]),gcback=gcBacks[i]))
    
outFile = open('%s%s.pickle' % (sys.argv[1],sys.argv[3]),'w')
pickle.dump(tuple(metaAceObjs),outFile)