tidied and updated kd and dssp scripts & generated their respective outputs

This commit is contained in:
Tanushree Tunstall 2020-03-25 18:19:23 +00:00
parent 37e1d43b76
commit 73e0029b65
6 changed files with 209 additions and 181 deletions

View file

@ -1,51 +1,54 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 16 11:21:44 2020
#!/bin/bash
#=======================================================================
# Task: read a pdb file and generate a dssp output file
# Input:
# pdb file
@author: tanu
"""
#!/usr/bin/bash
# Run dssp exe
# Output:
# pdb_code.dssp
# needs dssp exe on linux
# more efficient to run dssp exe locally
#%%
# specify variables for input and output paths and filenames
drug="pyrazinamide"
#gene = "pnca"
# note: double quotes for variable interpolation
#=======================================================================
# #%%specify variables for input and output paths and filenames
drug='pyrazinamide'
gene='pncA'
#convert to lowercase for consistency in filenames
gene_l=$(printf $gene | awk '{print tolower($0)}')
gene_match="${gene}_p."
#printf "${gene_match}\n"
datadir="~git/Data"
basedir=${datadir}"/"${drug}
echo${basedir}
#==========
# data dir
#==========
#indir = 'git/Data/pyrazinamide/input/original'
#datadir="~git/Data"
datadir="${HOME}/git/Data"
#=======
# input
inpath="/original"
#=======
indir=${datadir}'/'${drug}'/input'
printf "Input dir: ${indir}\n"
in_filename='3pl1.pdb'
#infile=${basedir}${inpath}${in_filename}
infile=${indir}'/'${in_filename}
printf "Input file: ${infile}\n"
# uncomment as necessary
in_filename="/3pl1.pdb"
#=======
# output
#=======
outdir=${datadir}'/'${drug}$'/output'
printf "Output dir: ${outdir}"
#out_filename='3pl1.dssp'
out_filename="${gene_l}.dssp"
outfile=${outdir}'/'${out_filename}
printf "Output file: ${outfile}\n"
infile=${basedir}${inpath}${in_filename}
echo${infile}
# output file
outpath="/processed"
outdir=${datadir}"/"${drug}${outpath}
out_filename="/3pl1.dssp"
outfile=${outdir}${out_filename}
echo${outdir}
if not os.path.exists(datadir):
print('Error!', datadir, 'does not exist. Please ensure it exists. Dir struc specified in README.md')
os.makedirs(datadir)
exit()
if not os.path.exists(outdir):
print('Error!', outdir, 'does not exist.Please ensure it exists. Dir struc specified in README.md')
exit()
else:
print('Dir exists: Carrying on')
# end of variable assignment for input and output files
#%%
# ommand line args
dssp -i 3pl1.pdb -o 3pl1.dssp
dssp -i
#%%end of variable assignment for input and output files
#================================================================
# command line arg to run dssp and create output file
dssp -i ${infile} -o ${outfile}
printf "Finished writing: ${outfile}\n"
#printf "Filename: ${out_filename}\nlocated in: ${outdir}\n"