trying to resolve copy warning in code
This commit is contained in:
parent
5655af42c0
commit
da0c03c2e0
1 changed files with 10 additions and 9 deletions
|
@ -34,8 +34,8 @@ arg_parser.add_argument('-i', '--input_dir', help = 'Input dir containing pdb fi
|
||||||
arg_parser.add_argument('-o', '--output_dir', help = 'Output dir for results. By default, it assmes homedir + <drug> + output')
|
arg_parser.add_argument('-o', '--output_dir', help = 'Output dir for results. By default, it assmes homedir + <drug> + output')
|
||||||
|
|
||||||
# FIXME: remove defaults
|
# FIXME: remove defaults
|
||||||
arg_parser.add_argument('-s', '--start_coord', help = 'start of coding region (cds) of gene', default = 2288681) # pnca cds
|
arg_parser.add_argument('-sc', '--start_coord', help = 'start of coding region (cds) of gene', default = None, type = int) # pnca cds
|
||||||
arg_parser.add_argument('-e', '--end_coord', help = 'end of coding region (cds) of gene', default = 2289241) # pnca cds
|
arg_parser.add_argument('-ec', '--end_coord', help = 'end of coding region (cds) of gene', default = None, type = int) # pnca cds
|
||||||
|
|
||||||
arg_parser.add_argument('--debug', action ='store_true', help = 'Debug Mode')
|
arg_parser.add_argument('--debug', action ='store_true', help = 'Debug Mode')
|
||||||
|
|
||||||
|
@ -314,18 +314,21 @@ print('No. of cols pre-formatting data:', df_ncols
|
||||||
#1) Add column: OR for kinship calculated from beta coef
|
#1) Add column: OR for kinship calculated from beta coef
|
||||||
ncols_add = 0
|
ncols_add = 0
|
||||||
if not 'or_kin' in dfm2_mis.columns:
|
if not 'or_kin' in dfm2_mis.columns:
|
||||||
dfm2_mis['or_kin'] = np.exp(dfm2_mis['beta'])
|
#dfm2_mis['or_kin'] = np.exp(dfm2_mis['beta']) # gives copy warning
|
||||||
|
dfm2_mis.loc[:,'or_kin'] = np.exp(dfm2_mis.loc[:,'beta'])
|
||||||
|
|
||||||
print(dfm2_mis['or_kin'].head())
|
print(dfm2_mis['or_kin'].head())
|
||||||
ncols_add+=1
|
ncols_add+=1
|
||||||
print('Calculating OR from beta coeff by exponent function and adding column:'
|
print('Calculating OR from beta coeff by exponent function and adding column:'
|
||||||
, '\nNo. of cols added:', ncols_add, '\n'
|
, '\nNo. of cols added:', ncols_add
|
||||||
, dfm2_mis['beta'].head()
|
, '\n', dfm2_mis['beta'].head()
|
||||||
|
, '\nNo. of cols after adding OR_kin:', len(dfm2_mis.columns)
|
||||||
, '\n===================================================================')
|
, '\n===================================================================')
|
||||||
|
|
||||||
if dfm2_mis.shape[1] == df_ncols + ncols_add:
|
if dfm2_mis.shape[1] == df_ncols + ncols_add:
|
||||||
print('PASS: Dimension of df match'
|
print('PASS: Dimension of df match'
|
||||||
, '\nDim of df:', dfm2_mis.shape
|
, '\nDim of df:', dfm2_mis.shape
|
||||||
, 'n================================================================')
|
, '\n================================================================')
|
||||||
else:
|
else:
|
||||||
print('FAIL: Dim mismatch'
|
print('FAIL: Dim mismatch'
|
||||||
, '\nOriginal no. of cols:', df_ncols
|
, '\nOriginal no. of cols:', df_ncols
|
||||||
|
@ -333,8 +336,6 @@ else:
|
||||||
, '\nGot:', dfm2_mis.shape[1])
|
, '\nGot:', dfm2_mis.shape[1])
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
print('No. of cols after adding OR_kin:', len(dfm2_mis.columns))
|
|
||||||
|
|
||||||
#2) rename columns to reflect that it is coming from kinship matrix adjustment
|
#2) rename columns to reflect that it is coming from kinship matrix adjustment
|
||||||
dfm2_mis.rename(columns = {'af': 'af_kin'
|
dfm2_mis.rename(columns = {'af': 'af_kin'
|
||||||
, 'beta': 'beta_kin'
|
, 'beta': 'beta_kin'
|
||||||
|
@ -399,7 +400,7 @@ else:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
del(df_ncols)
|
del(df_ncols)
|
||||||
#%%
|
#%%=====================================================================
|
||||||
#4) reorder columnn
|
#4) reorder columnn
|
||||||
print('Reordering', dfm2_mis.shape[1], 'columns'
|
print('Reordering', dfm2_mis.shape[1], 'columns'
|
||||||
, '\n===============================================')
|
, '\n===============================================')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue