Skip to content

Instantly share code, notes, and snippets.

@kylebarlow
Created October 25, 2016 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylebarlow/648b5392c1a74ca45696e02b624518f6 to your computer and use it in GitHub Desktop.
Save kylebarlow/648b5392c1a74ca45696e02b624518f6 to your computer and use it in GitHub Desktop.
import pandas as pd
def get_mutant_part_of_string(s):
return s.split()[1][-1]
df = pd.read_csv('/home/kyle/Downloads/uby_1ubq.tsv', sep='\t')
print df.head()
df.loc[:,'mut_aa'] = pd.Series(df['Mutation'].apply(get_mutant_part_of_string), index=df.index)
print df.head()
print df[ df.mut_aa == 'C' ].head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment