correcting indendation

This commit is contained in:
Tanushree Tunstall 2020-04-08 12:43:37 +01:00
parent 30aa64fd2b
commit c025a22343
3 changed files with 33 additions and 27 deletions

View file

@ -202,12 +202,15 @@ def dssp_to_csv(inputdsspfile, outfile, pdbchainlist):
#%% #%%
#======================================================================= #=======================================================================
def main(): 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") dssp_file_from_pdb(infile, dssp_file, DSSP = "dssp")
my_chains = extract_chain_dssp(infile) my_chains = extract_chain_dssp(infile)
dssp_to_csv(dssp_file, dsspcsv_file, my_chains) dssp_to_csv(dssp_file, dsspcsv_file, my_chains)
if __name__ == "__main__": if __name__ == '__main__':
main() main()
#%% end of script #%% end of script
#======================================================================= #=======================================================================
#=======================================================================

View file

@ -94,15 +94,11 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
@param windowsize: windowsize to perform KD calcs on (Kyte&-Doolittle) @param windowsize: windowsize to perform KD calcs on (Kyte&-Doolittle)
@type DSSP: numeric @type DSSP: numeric
@return: writes df of kd values as csv @return: none, writes kd values df as csv
@type: .csv
""" """
#=================== #========================
#calculate KD values: same as the expasy server # read input fasta file
#=================== #========================
my_window = windowsize
offset = round((my_window/2)-0.5)
fh = open(inputfasta) fh = open(inputfasta)
for record in SeqIO.parse(fh, 'fasta'): for record in SeqIO.parse(fh, 'fasta'):
@ -111,10 +107,16 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
num_residues = len(seq) num_residues = len(seq)
fh.close() fh.close()
sequence = str(seq) sequence = str(seq)
X = ProteinAnalysis(sequence) 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%) # edge weight is set to default (100%)
kd_values = (X.protein_scale(ProtParamData.kd , window = my_window)) kd_values = (X.protein_scale(ProtParamData.kd , window = my_window))
# sanity checks # sanity checks
print('Sequence Length:', num_residues) print('Sequence Length:', num_residues)
@ -181,6 +183,7 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
print('Checking dtype for after conversion:\n' print('Checking dtype for after conversion:\n'
, '\ndtype is:', kd_df.index.dtype , '\ndtype is:', kd_df.index.dtype
, '\n=========================================================') , '\n=========================================================')
#=============== #===============
# writing file # writing file
#=============== #===============
@ -215,14 +218,14 @@ def kd_to_csv(inputfasta, outputkdcsv, windowsize):
#kd_to_csv(infile, outfile, windowsize = 3) #kd_to_csv(infile, outfile, windowsize = 3)
#======================================================================= #=======================================================================
def main(): def main():
print('Running hydropathy calcs', in_filename, 'output csv:', out_filename) print('Running hydropathy calcs with following params\n'
kd_to_csv(infile, outfile, 3) , in_filename
, '\noutfile:', out_filename)
kd_to_csv(infile, outfile, 3)
print('Finished writing file:' print('Finished writing file:'
, '\nFilename:', outfile , '\nFilename:', out_filename
, '\nPath:', outdir , '\nPath:', outdir
# , '\nNo. of rows:', '' , '\n=============================================================')
# , '\nNo. of cols:', ''
, '\n=============================================================')
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -81,8 +81,7 @@ def rd_to_csv(inputtsv, outputrdcsv):
@param outputrdsv: csv file with rd values @param outputrdsv: csv file with rd values
@type outfile: string @type outfile: string
@return: writes df of kd values as csv @return: none, writes rd values df as csv
@type: .csv
""" """
#======================== #========================
# read downloaded tsv file # read downloaded tsv file
@ -142,6 +141,7 @@ def rd_to_csv(inputtsv, outputrdcsv):
, '\nExpected no. of rows:', len(rd_data) , '\nExpected no. of rows:', len(rd_data)
, '\nGot no. of rows:', len(rd_df) , '\nGot no. of rows:', len(rd_df)
, '\n=====================================================') , '\n=====================================================')
#=============== #===============
# writing file # writing file
#=============== #===============
@ -160,14 +160,14 @@ def rd_to_csv(inputtsv, outputrdcsv):
#rd_to_csv(infile, outfile) #rd_to_csv(infile, outfile)
#======================================================================= #=======================================================================
def main(): def main():
print('Running hydropathy calcs', in_filename, 'output csv:', out_filename) print('residue depth using the following params\n'
rd_to_csv(infile, outfile) , in_filename
, '\noutfile:', out_filename)
rd_to_csv(infile, outfile)
print('Finished Writing file:' print('Finished Writing file:'
, '\nFilename:', outfile , '\nFilename:', out_filename
, '\nPath:', outdir , '\nPath:', outdir
## , '\nNo. of rows:', '' , '\n=============================================================')
## , '\nNo. of cols:', ''
, '\n=============================================================')
if __name__ == '__main__': if __name__ == '__main__':
main() main()