Entering edit mode
7.1 years ago
Burgenix
•
0
Hey,
I built this script to extract coverage around a certain threshold from a MIRA output file in one of the resulting assembly folders. It seems that my script creates the manifest file just once, and does not use, let's say, manifest_1.conf for a new run.
import os
import subprocess
name = raw_input("What is the project name? ") ' manifest = open('manifest_0.conf', 'w') manifest.write('project = ' + name + '\njob = genome,mapping,accurate\nparameters = -NW:mrnl=0 -AS:nop=1 SOLEXA_SETTINGS -CO:msr=no\nreadgroup\nis_reference\ndata = /home/manuel/Desktop/script_test/semele_matk.fasta\nstrain = semele_matk\nreadgroup = reads\ndata = /home/manuel/Desktop/script_test/Sem-20_S4_L001_less.assembled.fastq\ntechnology=solexa')
manifest.close()'
avg_cov = 0
count = 0
new_avg_cov = 0
coverage = []
while new_avg_cov <= avg_cov * 2 or avg_cov == 0:
command = 'mira manifest_' + str(count) + '.conf'
print(command)
avg_cov = new_avg_cov
print('Mira is really done!')
with open(name + '_assembly/' + name +'_d_info/'+ name +'_info_contigstats.txt') as f:
print('fishing coverage')
for line in f:
if not line.startswith('#'):
new_avg_cov = float(line.split('\t')[5])
count += 1
old_name = name
name = name + '_' + str(count)
new_bait = old_name + '_assembly' + '/' + old_name +'_d_results/'+ old_name +'_out_AllStrains.unpadded.fasta'
print('new bait is ' + new_bait)
manifest = open('manifest_' + str(count) +'.conf', 'w')
print('new manifest is ' + 'manifest_' + str(count) +'.conf')
manifest.write('project = ' + name +'\njob = genome,mapping,accurate\nparameters = -NW:mrnl=0 -AS:nop=1 SOLEXA_SETTINGS -CO:msr=no\nreadgroup\nis_reference\ndata = /home/manuel/Desktop/script_test/' + new_bait + '\nstrain = ' + name + '\nreadgroup = reads\ndata = /home/manuel/Desktop/script_test/Sem-20_S4_L001_less.assembled.fastq\ntechnology=solexa')'
I know the script isnt elegant as of yet, but this is the problem I am having since yesterday.
Any ideas? Thanks a lot !