Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update internal_analysis.py #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/post_processing/internal_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def cleansequence(s):
p = re.compile(r'\.(?P<cleanseq>[A-Z\*@#]+)\.')
m = p.search(s)
return m.group('cleanseq')

# Find # of missed cleavages from clean peptide
def MissedCleavages(s):
mc = 0
for i in range(len(s)-1):
if (s[i]=="K" or s[i]=="R") and (s[i+1]!="P"):
mc = mc +1
return mc

def process_data(self):
'''
Expand Down Expand Up @@ -133,6 +141,12 @@ def parameter_optimization(dataset_ID):
"_forward_peptide_identification.csv")
data_r = pd.read_csv("Results/Data/" + str(dataset_ID) + \
"_reversed_peptide_identification.csv")

# Only fully tryptic and maximum of 2 missed cleavages
data_f["MissedCleavage"] = data_f["Clean Peptide Sequence"].apply(MissedCleavages)
data_r["MissedCleavage"] = data_r["Clean Peptide Sequence"].apply(MissedCleavages)
data_f = data_f[(data_f["NTT"]==2)&(data_f["MissedCleavage"]<=2)].copy()
data_r = data_r[(data_r["NTT"]==2)&(data_r["MissedCleavage"]<=2)].copy()

# Fit a 1-D data of DelM_PPM and get the peak ppm_shift
ppm_shift_df = data_f[(data_f["DelM_PPM"] < 10) & (data_f["DelM_PPM"] > -10)].copy()
Expand Down Expand Up @@ -289,4 +303,4 @@ def constraint3(Params):
df_Intensity.reset_index(inplace=True)
df_Intensity['Dataset_ID'] = dataset_ID

return df_Metadata, df_SpecID_f, df_SpecID_r, df_SpectraCount, df_Intensity
return df_Metadata, df_SpecID_f, df_SpecID_r, df_SpectraCount, df_Intensity