-
Notifications
You must be signed in to change notification settings - Fork 0
/
macse_python_use_this_one.py
32 lines (22 loc) · 1.05 KB
/
macse_python_use_this_one.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import sys
# Set the directory path where your input FASTA files are located
seq_dir = sys.argv[1]
# Set the directory path where you want the output aligned FASTA files to be written
out_dir = sys.argv[2]
# Set the path to the MACSE JAR file
macse_jar = "/scratch/jlamb/Bio_tools/macse_v2.06.jar"
# Set any additional MACSE options you want to use
macse_opts = "-prog alignSequences -out_NT"
# Create the output directory if it doesn't already exist
os.makedirs(out_dir, exist_ok=True)
# Loop through each file in the directory
for file in os.listdir(seq_dir):
if file.endswith(".fixed"):
input_file = os.path.join(seq_dir, file)
output_file = os.path.join(out_dir, "aligned_" + file)
# Load the Java module and run the MACSE command
macse_cmd = f"module load java/1.8.202 && java -jar {macse_jar} {macse_opts} {output_file} -seq {input_file}"
sbatch_cmd = f"sbatch --qos main --partition main --job-name=MACSE --mem=20G -n 1 -N 1 -c 4 --wrap='{macse_cmd}'"
print(sbatch_cmd)
os.system(sbatch_cmd)