tidy kd_df script
This commit is contained in:
parent
ae541ca16a
commit
73ae22e8a2
1 changed files with 23 additions and 17 deletions
|
@ -78,7 +78,8 @@ print('Output filename:', out_filename
|
||||||
, '\n=============================================================')
|
, '\n=============================================================')
|
||||||
#%% end of variable assignment for input and output files
|
#%% end of variable assignment for input and output files
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
def kd_to_csv(inputfasta, outputkdcsv, windowsize):
|
#%% kd values from fasta file and output csv
|
||||||
|
def kd_to_csv(inputfasta, outputkdcsv, windowsize, plot=False):
|
||||||
"""
|
"""
|
||||||
Calculate kd (hydropathy values) from input fasta file
|
Calculate kd (hydropathy values) from input fasta file
|
||||||
|
|
||||||
|
@ -181,17 +182,14 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
|
||||||
#===============
|
#===============
|
||||||
# writing file
|
# writing file
|
||||||
#===============
|
#===============
|
||||||
print('Writing file:', out_filename
|
print('Writing file:'
|
||||||
, '\nFilename:', out_filename
|
, '\nFilename:', outputkdcsv
|
||||||
, '\nPath:', outdir
|
# , '\nPath:', outdir
|
||||||
|
, '\nExpected no. of rows:', len(kd_df)
|
||||||
|
, '\nExpected no. of cols:', len(kd_df.columns)
|
||||||
, '\n=============================================================')
|
, '\n=============================================================')
|
||||||
|
|
||||||
kd_df.to_csv(outfile, header = True, index = True)
|
kd_df.to_csv(outputkdcsv, header = True, index = True)
|
||||||
|
|
||||||
print('Finished writing:', out_filename
|
|
||||||
, '\nNo. of rows:', len(kd_df)
|
|
||||||
, '\nNo. of cols:', len(kd_df.columns)
|
|
||||||
, '\n=============================================================')
|
|
||||||
|
|
||||||
#===============
|
#===============
|
||||||
# plot: optional!
|
# plot: optional!
|
||||||
|
@ -201,12 +199,14 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
|
||||||
# FIXME: save fig
|
# FIXME: save fig
|
||||||
# extract just pdb if from 'id' to pass to title of plot
|
# extract just pdb if from 'id' to pass to title of plot
|
||||||
# foo = re.match(r'(^[0-9]{1}\w{3})', id).groups(1)
|
# foo = re.match(r'(^[0-9]{1}\w{3})', id).groups(1)
|
||||||
plot(kd_values, linewidth = 1.0)
|
if plot:
|
||||||
#axis(xmin = 1, xmax = num_residues)
|
plot(kd_values, linewidth = 1.0)
|
||||||
xlabel('Residue Number')
|
#axis(xmin = 1, xmax = num_residues)
|
||||||
ylabel('Hydrophobicity')
|
xlabel('Residue Number')
|
||||||
title('K&D Hydrophobicity for ' + id)
|
ylabel('Hydrophobicity')
|
||||||
show()
|
title('K&D Hydrophobicity for ' + id)
|
||||||
|
show()
|
||||||
|
|
||||||
#%% end of function
|
#%% end of function
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
#%% call function
|
#%% call function
|
||||||
|
@ -214,7 +214,13 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
|
||||||
#=======================================================================
|
#=======================================================================
|
||||||
def main():
|
def main():
|
||||||
print('Running hydropathy calcs', in_filename, 'output csv:', out_filename)
|
print('Running hydropathy calcs', in_filename, 'output csv:', out_filename)
|
||||||
kd_to_csv(infile, outfile, windowsize = 3)
|
kd_to_csv(infile, outfile, 3)
|
||||||
|
print('Finished writing file:'
|
||||||
|
, '\nFilename:', outfile
|
||||||
|
, '\nPath:', outdir
|
||||||
|
# , '\nNo. of rows:', ''
|
||||||
|
# , '\nNo. of cols:', ''
|
||||||
|
, '\n=============================================================')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue