Created
September 12, 2018 01:12
-
-
Save asalt/82548c387e68dc228bb8b2124268a913 to your computer and use it in GitHub Desktop.
Simple script to separate MaxQuant experiments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simple script to separate MaxQuant experiments | |
""" | |
import os | |
import sys | |
import numpy as np | |
import pandas as pd | |
def main(f): | |
df = pd.read_table(f) | |
cols = df.filter(like='LFQ intensity').columns | |
for col in cols: | |
subdf = df.copy() | |
name = col.split('LFQ intensity ')[1] | |
subdf['PrecursorArea'] = df[col] | |
subdf.loc[ subdf['Identification type ' + name] == 'By matching', 'IonScore' ] = np.nan | |
subdf.loc[ subdf['Identification type ' + name] == 'By matching', 'PEP' ] = np.nan | |
x = os.path.splitext(f) | |
outname = '{}_{}{}'.format(x[0], name, x[1]) | |
print('Writing', outname) | |
subdf.to_csv(outname, sep='\t', index=False) | |
if __name__ == '__main__': | |
main(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment