ran struc param analysis
This commit is contained in:
parent
e21635fe02
commit
8d1daabff4
5 changed files with 373 additions and 382 deletions
|
@ -57,8 +57,8 @@ args = arg_parser.parse_args()
|
|||
|
||||
drug = args.drug
|
||||
gene = args.gene
|
||||
|
||||
gene_match = gene + '_p.'
|
||||
|
||||
# building cols to extract
|
||||
dr_muts_col = 'dr_mutations_' + drug
|
||||
other_muts_col = 'other_mutations_' + drug
|
||||
|
@ -80,8 +80,8 @@ datadir = homedir + '/' + 'git/Data'
|
|||
#=======
|
||||
# input
|
||||
#=======
|
||||
#in_filename = 'original_tanushree_data_v2.csv'
|
||||
in_filename = 'mtb_gwas_v3.csv'
|
||||
in_filename = 'original_tanushree_data_v2.csv'
|
||||
#in_filename = 'mtb_gwas_v3.csv'
|
||||
infile = datadir + '/' + in_filename
|
||||
print('Input file: ', infile
|
||||
, '\n============================================================')
|
||||
|
@ -1028,25 +1028,25 @@ del(k, v, wt, mut, lookup_dict)
|
|||
|
||||
########
|
||||
# combine the wild_type+poistion+mutant_type columns to generate
|
||||
# Mutationinformation (matches mCSM output field)
|
||||
# mutationinformation (matches mCSM output field)
|
||||
# Remember to use .map(str) for int col types to allow string concatenation
|
||||
#########
|
||||
gene_LF1['Mutationinformation'] = gene_LF1['wild_type'] + gene_LF1.position.map(str) + gene_LF1['mutant_type']
|
||||
print('Created column: Mutationinformation'
|
||||
gene_LF1['mutationinformation'] = gene_LF1['wild_type'] + gene_LF1.position.map(str) + gene_LF1['mutant_type']
|
||||
print('Created column: mutationinformation'
|
||||
, '\n====================================================================='
|
||||
, gene_LF1.Mutationinformation.head(10))
|
||||
, gene_LF1.mutationinformation.head(10))
|
||||
|
||||
#%% Write file: mCSM muts
|
||||
snps_only = pd.DataFrame(gene_LF1['Mutationinformation'].unique())
|
||||
snps_only = pd.DataFrame(gene_LF1['mutationinformation'].unique())
|
||||
snps_only.head()
|
||||
# assign column name
|
||||
snps_only.columns = ['Mutationinformation']
|
||||
snps_only.columns = ['mutationinformation']
|
||||
|
||||
# count how many positions this corresponds to
|
||||
pos_only = pd.DataFrame(gene_LF1['position'].unique())
|
||||
|
||||
print('Checking NA in snps...')# should be 0
|
||||
if snps_only.Mutationinformation.isna().sum() == 0:
|
||||
if snps_only.mutationinformation.isna().sum() == 0:
|
||||
print ('PASS: NO NAs/missing entries for SNPs'
|
||||
, '\n===============================================================')
|
||||
else:
|
||||
|
@ -1090,27 +1090,27 @@ print('Finished writing:', out_filename3
|
|||
del(out_filename3)
|
||||
|
||||
#%% write file: mCSM style but with repitions for MSA and logo plots
|
||||
all_muts_msa = pd.DataFrame(gene_LF1['Mutationinformation'])
|
||||
all_muts_msa = pd.DataFrame(gene_LF1['mutationinformation'])
|
||||
all_muts_msa.head()
|
||||
# assign column name
|
||||
all_muts_msa.columns = ['Mutationinformation']
|
||||
all_muts_msa.columns = ['mutationinformation']
|
||||
|
||||
# make sure it is string
|
||||
all_muts_msa.columns.dtype
|
||||
|
||||
# sort the column
|
||||
all_muts_msa_sorted = all_muts_msa.sort_values(by = 'Mutationinformation')
|
||||
all_muts_msa_sorted = all_muts_msa.sort_values(by = 'mutationinformation')
|
||||
|
||||
# create an extra column with protein name
|
||||
all_muts_msa_sorted = all_muts_msa_sorted.assign(fasta_name = '3PL1')
|
||||
all_muts_msa_sorted.head()
|
||||
|
||||
# rearrange columns so the fasta name is the first column (required for mutate.script)
|
||||
all_muts_msa_sorted = all_muts_msa_sorted[['fasta_name', 'Mutationinformation']]
|
||||
all_muts_msa_sorted = all_muts_msa_sorted[['fasta_name', 'mutationinformation']]
|
||||
all_muts_msa_sorted.head()
|
||||
|
||||
print('Checking NA in snps...')# should be 0
|
||||
if all_muts_msa.Mutationinformation.isna().sum() == 0:
|
||||
if all_muts_msa.mutationinformation.isna().sum() == 0:
|
||||
print ('PASS: NO NAs/missing entries for SNPs'
|
||||
, '\n===============================================================')
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue