#!/home/asiimwe/anaconda3/bin/python #Extracting data for comparative analyses between STAR_WASP and WASP - Leveraging data from the 32 thread runs import sys import csv import os import string import subprocess from itertools import chain import pandas as pd from os import mkdir import shutil import glob import fileinput import stat samples = ["HG00512", "HG00731", "HG00733", "NA12878_Nucleus_nonPolyA_Rep", "NA12878_Nucleus_PolyA_Rep", "NA12878_PolyA_Rep", "NA12878_RAMPAGE_Rep", "NA12878_Total", "NA19238", "NA19240","HG00513", "HG00732", "NA12878_Nucleus_nonPolyA", "NA12878_Nucleus_PolyA", "NA12878_PolyA", "NA12878_RAMPAGE", "NA12878_Small", "NA12878_Total_Rep","NA19239"] #samples_path = "/scratch/asiimwe/STAR-WASP_forRebecca/FASTQ/" base_dir = "/home/asiimwe/projects/run_env/alpha_star_wasp_comparison/STAR_WASP_Runs/" #os.chdir(base_dir) #star_wasp_dir = "STAR_WASP_Runs" #shutil.rmtree(star_wasp_dir) #mkdir(star_wasp_dir) #os.chdir(star_wasp_dir) #base_code = base_dir + "/BaseCode_WASP_Runs.sh" file = "/home/asiimwe/projects/run_env/alpha_star_wasp_comparison/comp_runs.sh" run_file_name = "comp_runs.sh" for i in samples: #print(i) path = base_dir + i +"/32threads/" #print(path) #/home/asiimwe/projects/run_env/alpha_star_wasp_comparison/STAR_WASP_Runs/NA12878_Nucleus_nonPolyA/32threads/ os.chdir(path) #shutil.copy(file, path) run = path + run_file_name #print("run file is ",run) with fileinput.FileInput(run, inplace=True) as file: for line in file: print(line.replace("sample", i), end='') subprocess.call(run, shell = True)