Skip to content

Commit 0a8a851

Browse files
committed
Changed the location of the short tcs file
1 parent 373c30e commit 0a8a851

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

4Pipe4.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,13 @@ def DiscoveryTCS(basefile):
177177
CAF_to_TCS.RunModule(basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.caf')
178178
TCS.RunModule(basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.tcs',int(config.get('Variables','minqual')),int(config.get('Variables','mincov')))
179179

180+
180181
def SNPgrabber(basefile):
181182
#Grabs suitable SNPs in the short TCS output DiscoveryTCS and outputs a fasta with only the relevant contigs, tagged with SNP info.
182183
os.chdir(os.path.split(basefile)[0])
183184
print("\nRunning SNP Grabber tool module...")
184-
SNPg.RunModule(basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.short.tcs', basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.unpadded.fasta', int(config.get('Variables','minqual')))
185-
shutil.move(miraproject + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.short.fasta', basefile + '.SNPs.fasta')
185+
SNPg.RunModule(basefile + '_out.short.tcs', basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.unpadded.fasta', basefile + '.SNPs.fasta', int(config.get('Variables', 'minqual')))
186+
186187

187188
def ORFliner(basefile):
188189
#This will run EMBOSS 'getorf' and use 2 scripts to filter the results and write a report. The paramters for 'getorf' are changed here.
@@ -208,7 +209,8 @@ def ORFliner(basefile):
208209
Metrics.Run_module(seqclean_log_path, basefile + '.fasta', basefile + '.clean.fasta', basefile + '.fasta.qual', basefile + '.clean.fasta.qual', basefile + '_assembly/' + miraproject + '_d_info/' + miraproject + '_info_assembly.txt', basefile + '.SNPs.fasta', basefile + '.BestORF.fasta', basefile + '.Metrics.html')
209210
#Finally we write down our report using the data gathered so far:
210211
print("\nRunning Reporter module...")
211-
Reporter.RunModule(basefile + '.BestORF.fasta', basefile + '.SNPs.fasta', basefile + '.ORFblast.html', basefile + '.Report.html', basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.short.tcs')
212+
Reporter.RunModule(basefile + '.BestORF.fasta', basefile + '.SNPs.fasta', basefile + '.ORFblast.html', basefile + '.Report.html', basefile + '_out.short.tcs')
213+
212214

213215
def B2G(basefile):
214216
#This will make all necessary runs to get a B2go anottation ready for the GUI aplication. Bummer...
@@ -230,11 +232,13 @@ def B2G(basefile):
230232
else:
231233
quit("\nERROR:Program not found... exiting. Check your configuration file.\n")
232234

235+
233236
def SSRfinder(basefile):
234237
#Runs the SSR finder in batch mode and generates an HTML. It's mostly disk I/O stress and not CPU intensive:
235238
print("\nRunning SSR finder module...")
236239
ssr.RunModule(basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.unpadded.fasta',basefile + '_assembly/' + miraproject + '_d_results/' + miraproject + '_out.unpadded.fasta.qual',basefile + '.SSR.html',config.get('Program paths','Etandem_path'),config.get('Variables','min_ssr_qual'))
237240

241+
238242
def TidyUP(basefile):
239243
#Tidy up the report folder:
240244
os.chdir(os.path.split(basefile)[0])
@@ -277,6 +281,7 @@ def TidyUP(basefile):
277281
print(' '.join(cli))
278282
RunProgram(cli,0)
279283

284+
280285
def RunMe(arguments):
281286
#Function to parse which parts of 4Pipe4 will run.
282287
for option,number in zip(list(arguments),range(len(arguments))):
@@ -299,6 +304,8 @@ def RunMe(arguments):
299304
if option == "9":
300305
TidyUP(basefile)
301306
print("\nPipeline finished.\n")
307+
308+
302309
basefile,sff,config = StartUp()
303310
miraproject = SysPrep(basefile)
304-
RunMe(arg.run_list)
311+
RunMe(arg.run_list)

SNPgrabber.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,21 @@ def FASTAtoDict(fasta_file):
5555
fasta.close()
5656
return Dict
5757

58-
def ShortListFASTA(names,fasta,tcs_file):
58+
def ShortListFASTA(names, fasta, tcs_file, snp_fasta):
5959
#Grabs the contig names and SNP positions from the TCS file and trims the fasta to match only these.
6060
shortfasta = {}
6161
for name in names:
6262
if name in fasta.keys():
6363
namepos = name + '#' + names[name] #namepos = contigname + #positions
6464
shortfasta[namepos] = fasta[name] #shortfasta = namepos : sequence from fasta file
65-
newfile = re.match('^.*\.', tcs_file).group(0) + 'fasta'
66-
outfile=open(newfile,'w')
65+
outfile=open(snp_fasta, 'w')
6766
for k in shortfasta:
6867
outfile.write('>' + k + '\n')
6968
outfile.write(shortfasta[k] + '\n')
7069
outfile.close()
7170

72-
def RunModule(tcs_file,fasta_file,minqual):
71+
def RunModule(tcs_file, fasta_file, snp_fasta, minqual):
7372
#Function to run the whole module:
74-
Names=TCStoDict(tcs_file,minqual)
73+
Names=TCStoDict(tcs_file, minqual)
7574
Sequences=FASTAtoDict(fasta_file)
76-
ShortListFASTA(Names,Sequences,tcs_file)
75+
ShortListFASTA(Names, Sequences, tcs_file, snp_fasta)

0 commit comments

Comments
 (0)