Example #1
0
							exit()
						if features != '':
							finalOut.write(header)
							finalOut.write(features)
		call('rm *.ps', shell=True)

###########################################
# Main script starts here
###########################################

# Move data file into microPred directory
call('cp data/'+inPath+' progs/HeteroMirPred/'+inPath, shell=True)
exitFlag = 0

# Split input fasta into <numThreads> smaller fasta files
FastaOps.split_fasta('progs/HeteroMirPred/'+inPath, numThreads)

#Get a path to the input file that doesn't have '.fasta' on the end
threadPath = inPath.rsplit('.',1)[0]
threadExt = inPath.rsplit('.',1)[1]
# Move to microPred directory and run microPred on all the smaller files (multi-threaded)
os.chdir('progs/HeteroMirPred/')
threads = []
for i in range(numThreads):
	threads.append(myThread(threadPath+'.'+str(i)+'.'+threadExt))

for thread in threads:
	thread.start()

for thread in threads:
	thread.join()
                            features = inFile.readline()
                            if features != '':
                                finalOut.write(header)
                                finalOut.write(features)


###########################################
# Main script starts here
###########################################

# Move data file into microPred directory
call('cp data/' + inPath + ' progs/HeteroMirPred/' + inPath, shell=True)
exitFlag = 0

# Split input fasta into <numThreads> smaller fasta files
FastaOps.split_fasta('progs/HeteroMirPred/' + inPath, numThreads)

#Get a path to the input file that doesn't have '.fasta' on the end
threadPath = inPath.rsplit('.', 1)[0]
threadExt = inPath.rsplit('.', 1)[1]
# Move to microPred directory and run microPred on all the smaller files (multi-threaded)
os.chdir('progs/HeteroMirPred/')
threads = []
for i in range(numThreads):
    threads.append(myThread(threadPath + '.' + str(i) + '.' + threadExt))

for thread in threads:
    thread.start()

for thread in threads:
    thread.join()
Example #3
0
                            features = inFile.readline()
                            if features != '':
                                finalOut.write(header)
                                finalOut.write(features)


###########################################
# Main script starts here
###########################################

# Move data file into microPred directory
call('cp data/' + inPath + ' progs/microPred/data/' + inPath, shell=True)
exitFlag = 0

# Split input fasta into <numThreads> smaller fasta files
FastaOps.split_fasta('progs/microPred/data/' + inPath, numThreads)

#Get a path to the input file that doesn't have '.fasta' on the end
threadPath = inPath.rsplit('.', 1)[0]
threadExt = inPath.rsplit('.', 1)[1]
# Move to microPred directory and run microPred on all the smaller files (multi-threaded)
os.chdir('progs/microPred/progs')
threads = []
for i in range(numThreads):
    threads.append(myThread(threadPath + '.' + str(i) + '.' + threadExt))

for thread in threads:
    thread.start()

for thread in threads:
    thread.join()
Example #4
0
            shell=True)
        print "Filtering folds  in " + self.inPath + " down to hairpins."
        FoldOps.filter_hairpins('data/tmp/' + self.inPath + '.folds',
                                'data/tmp/' + self.inPath + '.hairpins')
        FileConversion.RNAL_to_fasta('data/tmp/' + self.inPath + '.hairpins',
                                     'data/tmp/folds_from_' + self.inPath)
        print "Removing redundant hairpins from " + self.inPath + "."
        sl = SequenceList()
        sl.load_fasta('data/tmp/folds_from_' + self.inPath)
        sl.remove_all_redundant()
        sl.export_fasta('data/tmp/' + self.inPath + 'nrhairpins')


print "Re-formatting fasta."
# Step one: turn the fasta into something that RNALfold will work with
FastaOps.remove_newlines('data/' + inPath, 'data/tmp/' + inPath + '.fixed')
# Step two: split the fasta for mutli-threaded processing
FastaOps.split_fasta('data/tmp/' + inPath + '.fixed', numThreads)
# Step three: Launch threads
threadPath = inPath
threadExt = 'fixed'
threads = []
for i in range(numThreads):
    threads.append(myThread(threadPath + '.' + str(i) + '.' + threadExt))
for thread in threads:
    thread.start()
for thread in threads:
    thread.join()

FastaOps.merge_fasta('data/tmp/' + inPath + '.fixednrhairpins', numThreads)
call('cp data/tmp/' + inPath + '.fixednrhairpins data/' + inPath +
Example #5
0
		self.inPath = inPath

	def run(self):
		# Use newer local version of RNAfold
		call('RNALfold -T '+str(foldTemp)+' -d2 --noLP -L '+str(hairpinLength)+' < data/tmp/'+self.inPath+' > data/tmp/'+self.inPath+'.folds', shell=True)
		# Use older version of RNAfold
		# call('progs/ViennaRNA-1.8.5/Progs/RNALfold -T '+str(foldTemp)+' -d2 -noLP -L '+str(hairpinLength)+' < data/tmp/'+self.inPath+' > data/tmp/'+self.inPath+'.folds', shell=True)
		FoldOps.filter_hairpins('data/tmp/'+self.inPath+'.folds', 'data/tmp/'+self.inPath+'.hairpins', minMFE, basePairs)
		FileConversion.RNAL_to_fasta('data/tmp/'+self.inPath+'.hairpins', 'data/tmp/folds_from_'+self.inPath)
		sl = SequenceList()
		sl.load_fasta('data/tmp/folds_from_'+self.inPath)
		# sl.remove_all_redundant()
		sl.export_fasta('data/tmp/'+self.inPath+'nrhairpins')

# Step one: turn the fasta into something that RNALfold will work with
FastaOps.remove_newlines('data/'+inPath, 'data/tmp/'+inPath+'.fixed')
FastaOps.convert_DNA_to_RNA('data/tmp/'+inPath+'.fixed', 'data/tmp/'+inPath+'.rna')
# Step two: split the fasta for mutli-threaded processing
FastaOps.split_fasta('data/tmp/'+inPath+'.rna', numThreads)
# Step three: Launch threads
threadPath = inPath
threadExt = 'rna'
threads = []
for i in range(numThreads):
	threads.append(myThread(threadPath+'.'+str(i)+'.'+threadExt))
for thread in threads:
	thread.start()
for thread in threads:
	thread.join()

FastaOps.merge_fasta('data/tmp/'+inPath+'.rnanrhairpins', numThreads)
Example #6
0
import sys
import getopt
import classes.FastaOperations as fo

# Arguments
############
# -i: Input file (in data/ directory)
# -n: Number of output files

# Output
#########
# n fasta files, with 


opts, extraparams = getopt.getopt(sys.argv[1:], 'i:n:')
for o,p in opts:
	if o == '-i':
		inPath = p
	if o == '-n':
		numFiles = p

fo.split_fasta('data/'+inPath, int(numFiles))
Example #7
0
import classes.FastaOperations as fo
from classes.SequenceList import *

# fo.split_fasta('data/folds_from_AHGY01.fa', 10)
for i in range(10):
	sl = SequenceList()
	sl.load_fasta('data/folds_from_AHGY01.fa.'+str(i))
	sl.remove_redundant()
	sl.export_fasta('data/AHGY01.fa.nr.hairpins'+'.'+str(i))
	print str((i+1)*10)+'% complete removing redundant hairpins'
fo.merge_fasta('data/AHGY01.fa.nr.hairpins', 10)
						with open("../data/selected."+self.inPath+".-21.features", 'a') as finalOut:
							features = inFile.readline()
							if features != '':
								finalOut.write(header)
								finalOut.write(features)

###########################################
# Main script starts here
###########################################

# Move data file into microPred directory
call('cp data/'+inPath+' progs/microPred/data/'+inPath, shell=True)
exitFlag = 0

# Split input fasta into <numThreads> smaller fasta files
FastaOps.split_fasta('progs/microPred/data/'+inPath, numThreads)

#Get a path to the input file that doesn't have '.fasta' on the end
threadPath = inPath.rsplit('.',1)[0]
threadExt = inPath.rsplit('.',1)[1]
# Move to microPred directory and run microPred on all the smaller files (multi-threaded)
os.chdir('progs/microPred/progs')
threads = []
for i in range(numThreads):
	threads.append(myThread(threadPath+'.'+str(i)+'.'+threadExt))

for thread in threads:
	thread.start()

for thread in threads:
	thread.join()