diff --git a/scripts/dssp_df.py b/scripts/dssp_df.py index 0aa223f..ff97aa7 100755 --- a/scripts/dssp_df.py +++ b/scripts/dssp_df.py @@ -202,12 +202,15 @@ def dssp_to_csv(inputdsspfile, outfile, pdbchainlist): #%% #======================================================================= def main(): - print('Running dssp on', in_filename, 'extracting df and output csv:', dsspcsv_filename) + print('Running dssp with the following params:\n' + , in_filename + , 'outfile:', dsspcsv_filename) dssp_file_from_pdb(infile, dssp_file, DSSP = "dssp") my_chains = extract_chain_dssp(infile) dssp_to_csv(dssp_file, dsspcsv_file, my_chains) -if __name__ == "__main__": +if __name__ == '__main__': main() #%% end of script #======================================================================= +#======================================================================= diff --git a/scripts/kd_df.py b/scripts/kd_df.py index 4ee9825..2c3bd48 100755 --- a/scripts/kd_df.py +++ b/scripts/kd_df.py @@ -94,15 +94,11 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize): @param windowsize: windowsize to perform KD calcs on (Kyte&-Doolittle) @type DSSP: numeric - @return: writes df of kd values as csv - @type: .csv + @return: none, writes kd values df as csv """ - #=================== - #calculate KD values: same as the expasy server - #=================== - my_window = windowsize - offset = round((my_window/2)-0.5) - + #======================== + # read input fasta file + #======================== fh = open(inputfasta) for record in SeqIO.parse(fh, 'fasta'): @@ -111,10 +107,16 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize): num_residues = len(seq) fh.close() - sequence = str(seq) + sequence = str(seq) X = ProteinAnalysis(sequence) + #=================== + # calculate KD values: same as the expasy server + #=================== + my_window = windowsize + offset = round((my_window/2)-0.5) # edge weight is set to default (100%) + kd_values = (X.protein_scale(ProtParamData.kd , window = my_window)) # sanity checks print('Sequence Length:', num_residues) @@ -181,6 +183,7 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize): print('Checking dtype for after conversion:\n' , '\ndtype is:', kd_df.index.dtype , '\n=========================================================') + #=============== # writing file #=============== @@ -215,14 +218,14 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize): #kd_to_csv(infile, outfile, windowsize = 3) #======================================================================= def main(): - print('Running hydropathy calcs', in_filename, 'output csv:', out_filename) - kd_to_csv(infile, outfile, 3) + print('Running hydropathy calcs with following params\n' + , in_filename + , '\noutfile:', out_filename) + kd_to_csv(infile, outfile, 3) print('Finished writing file:' - , '\nFilename:', outfile - , '\nPath:', outdir -# , '\nNo. of rows:', '' -# , '\nNo. of cols:', '' - , '\n=============================================================') + , '\nFilename:', out_filename + , '\nPath:', outdir + , '\n=============================================================') if __name__ == '__main__': main() diff --git a/scripts/rd_df.py b/scripts/rd_df.py index b4d0f43..3b5ad1f 100755 --- a/scripts/rd_df.py +++ b/scripts/rd_df.py @@ -81,8 +81,7 @@ def rd_to_csv(inputtsv, outputrdcsv): @param outputrdsv: csv file with rd values @type outfile: string - @return: writes df of kd values as csv - @type: .csv + @return: none, writes rd values df as csv """ #======================== # read downloaded tsv file @@ -142,6 +141,7 @@ def rd_to_csv(inputtsv, outputrdcsv): , '\nExpected no. of rows:', len(rd_data) , '\nGot no. of rows:', len(rd_df) , '\n=====================================================') + #=============== # writing file #=============== @@ -160,14 +160,14 @@ def rd_to_csv(inputtsv, outputrdcsv): #rd_to_csv(infile, outfile) #======================================================================= def main(): - print('Running hydropathy calcs', in_filename, 'output csv:', out_filename) - rd_to_csv(infile, outfile) + print('residue depth using the following params\n' + , in_filename + , '\noutfile:', out_filename) + rd_to_csv(infile, outfile) print('Finished Writing file:' - , '\nFilename:', outfile - , '\nPath:', outdir -## , '\nNo. of rows:', '' -## , '\nNo. of cols:', '' - , '\n=============================================================') + , '\nFilename:', out_filename + , '\nPath:', outdir + , '\n=============================================================') if __name__ == '__main__': main()