예제 #1
0
# locates all reconstructed files

reconstructed_files = comp_directory_name+"/reconstructed_single_contigs.fasta "
for comp in new_components:
	dir_base = comp_directory_name + "/" + sample_name + str(comp)
	dir_out = dir_base + "algo_output"
	reconstructed_files +=  (dir_out + '/' + 'reconstructed.fasta ')
	
# Creates new directory with concatenation of all reconstructed files
dir_base = comp_directory_name + "/" + sample_name + "all"
dir_out = dir_base + "algo_output"
run_cmd("mkdir " + dir_out)
out_file = dir_out + "/" + "all_reconstructed.fasta"
run_cmd("cat " + reconstructed_files + " > " + out_file)
process_concatenated_fasta(out_file, dir_out + "/reconstructed_org.fasta",original_ds)
f_log.write(str(time.asctime()) + ': All partitions completed.\n')

#run_cmd('cp ' + dir_out + "/reconstructed.fasta " + dir_out + "/reconstructed_org.fasta")

if find_reps:
	f_log.write(str(time.asctime()) + ': Finding representative outputs\n')
	run_cmd('cat ' +  dir_out + "/reconstructed_org.fasta | perl -e 'while (<>) {$h=$_; $s=<>; $seqs{$h}=$s;} foreach $header (sort {length($seqs{$a}) <=> length($seqs{$b})} keys %seqs) {print $header.$seqs{$header}}' > " +  dir_out +  "/reconstructed_sorted.fasta " )
	run_cmd(python_path + ' ' + shannon_dir + 'faster_reps.py -d ' + dir_out + "/reconstructed_sorted.fasta " + dir_out + "/reconstructed.fasta ")
	f_log.write(str(time.asctime()) + ': Representative outputs found.\n')
else:	
	run_cmd('mv '  + dir_out + "/reconstructed_org.fasta " + dir_out + "/reconstructed.fasta ")

#------Filter using Kallisto-------#
if run_kallisto:
	run_cmd('mv ' + dir_out+"/reconstructed.fasta " + dir_out+"/rec_before_kallisto.fasta")
예제 #2
0
                                                'reconstructed.fasta')
        else:
            reconstructed_files[comp[0]] = [dir + '/' + 'reconstructed.fasta']

# Creates new directory with concatenation of all reconstructed files
dir_base = comp_directory_name + "/" + sample_name + "_all"
dir_out = dir_base + "algo_output"
run_cmd("mkdir " + dir_out)
temp_file = dir_out + "/" + "all_reconstructed.fasta"
temp_file_args = ""
for comp in reconstructed_files:
    for file_name in reconstructed_files[comp]:
        temp_file_args = temp_file_args + file_name + " "

run_cmd("cat " + temp_file_args + " > " + temp_file)
process_concatenated_fasta(temp_file, dir_out + "/reconstructed_org.fasta")

#run_cmd('cp ' + dir_out + "/reconstructed.fasta " + dir_out + "/reconstructed_org.fasta")

run_cmd(
    'cat ' + dir_out +
    "/reconstructed_org.fasta | perl -e 'while (<>) {$h=$_; $s=<>; $seqs{$h}=$s;} foreach $header (sort {length($seqs{$a}) <=> length($seqs{$b})} keys %seqs) {print $header.$seqs{$header}}' > "
    + dir_out + "/reconstructed_sorted.fasta ")

run_cmd('python ' + shannon_dir + 'fast_reps.py -d ' + dir_out +
        "/reconstructed_sorted.fasta " + dir_out + "/reconstructed.fasta ")

# Compares reconstructed file against reference
if compare_ans:
    run_cmd("cp " + ref_file + ' ' + dir_out + "/reference.fasta")
    run_cmd("python " + shannon_dir + "run_MB_SF.py " + dir_base +
예제 #3
0
파일: shannon.py 프로젝트: yihanj/Shannon
			reconstructed_files[comp[0]].append(dir + '/' + 'reconstructed.fasta')
		else:
			reconstructed_files[comp[0]] = [dir + '/' + 'reconstructed.fasta']

# Creates new directory with concatenation of all reconstructed files
dir_base = comp_directory_name + "/" + sample_name + "_all"
dir_out = dir_base + "algo_output"
run_cmd("mkdir " + dir_out)
temp_file = dir_out + "/" + "all_reconstructed.fasta"
temp_file_args = "" 
for comp in reconstructed_files:    
	for file_name in reconstructed_files[comp]:
		temp_file_args = temp_file_args + file_name + " "
		
run_cmd("cat " + temp_file_args + " > " + temp_file)
process_concatenated_fasta(temp_file, dir_out + "/reconstructed_org.fasta")

#run_cmd('cp ' + dir_out + "/reconstructed.fasta " + dir_out + "/reconstructed_org.fasta")

run_cmd('cat ' +  dir_out + "/reconstructed_org.fasta | perl -e 'while (<>) {$h=$_; $s=<>; $seqs{$h}=$s;} foreach $header (sort {length($seqs{$a}) <=> length($seqs{$b})} keys %seqs) {print $header.$seqs{$header}}' > " +  dir_out +  "/reconstructed_sorted.fasta " )

run_cmd('python ' + shannon_dir + 'fast_reps.py -d ' + dir_out + "/reconstructed_sorted.fasta " + dir_out + "/reconstructed.fasta ")


# Compares reconstructed file against reference
if compare_ans:
	run_cmd("cp " + ref_file + ' ' +  dir_out + "/reference.fasta")
	run_cmd("python " + shannon_dir + "run_MB_SF.py " + dir_base + " --compare ")

# updates log
if os.path.exists(comp_directory_name+"/before_sp_log.txt"):
예제 #4
0
# locates all reconstructed files

reconstructed_files = comp_directory_name+"/reconstructed_single_contigs.fasta "
for comp in new_components:
	dir_base = comp_directory_name + "/" + sample_name + str(comp)
	dir_out = dir_base + "algo_output"
	reconstructed_files +=  (dir_out + '/' + 'reconstructed.fasta ')
	
# Creates new directory with concatenation of all reconstructed files
dir_base = comp_directory_name + "/" + sample_name + "all"
dir_out = dir_base + "algo_output"
run_cmd("mkdir " + dir_out)
out_file = dir_out + "/" + "all_reconstructed.fasta"
run_cmd("cat " + reconstructed_files + " > " + out_file)
process_concatenated_fasta(out_file, dir_out + "/reconstructed_org.fasta",original_ds)
f_log.write(str(time.asctime()) + ': All partitions completed.\n')

#run_cmd('cp ' + dir_out + "/reconstructed.fasta " + dir_out + "/reconstructed_org.fasta")

if find_reps:
	f_log.write(str(time.asctime()) + ': Finding representative outputs\n')
	run_cmd('cat ' +  dir_out + "/reconstructed_org.fasta | perl -e 'while (<>) {$h=$_; $s=<>; $seqs{$h}=$s;} foreach $header (sort {length($seqs{$a}) <=> length($seqs{$b})} keys %seqs) {print $header.$seqs{$header}}' > " +  dir_out +  "/reconstructed_sorted.fasta " )
	run_cmd(python_path + ' ' + shannon_dir + 'faster_reps.py -d ' + dir_out + "/reconstructed_sorted.fasta " + dir_out + "/reconstructed.fasta ")
	f_log.write(str(time.asctime()) + ': Representative outputs found.\n')
else:	
	run_cmd('mv '  + dir_out + "/reconstructed_org.fasta " + dir_out + "/reconstructed.fasta ")

#------Filter using Kallisto-------#
if run_kallisto:
	run_cmd('mv ' + dir_out+"/reconstructed.fasta " + dir_out+"/rec_before_kallisto.fasta")