-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_DDA_libraryCreation.sh
executable file
·194 lines (164 loc) · 7.4 KB
/
01_DDA_libraryCreation.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/bash
# log
# touch current_log.txt
# echo swath analysis log > current_log.txt
# Prep: Get Software Containers
###############################
# Requirement: Working docker installation
# e.g. https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04#step-1-%E2%80%94-installing-docker
# Test if it is working correctly:
docker run hello-world
# get the containerized tools
docker pull biocontainers/diau-umpire:v2.1.2_cv4 # also contains comet, msgf+ and tpp
docker pull openswath/openswath:0.1.2
# remove containers that may exist in these names
# watch out, modifications made inside these containers will be lost!
docker stop ddalibcreate && \
docker stop openswath && \
docker rm ddalibcreate && \
docker rm openswath
# spawn containers on host machine
docker run -u 0 -dit --name ddalibcreate -v $PWD/:/data biocontainers/dia-umpire:v2.1.2_cv4
docker run -u 0 -dit --name openswath -v $PWD/:/data openswath/openswath:0.1.2
# say hello!
docker exec ddalibcreate echo hi there, ddalibcreate container is happy and alive
docker exec openswath echo hi there, openswath container is happy and alive
# STEP 1: DDALIBCREATE:
# DDA search to create sample-specific library
##############################################
# Make decoy fasta database
docker exec ddalibcreate subsetdb -R -DDECOY_ data_library/library_fwd.fasta && \
cat data_library/library_fwd.fasta library_fwd.fasta.new > data_library/library_fwd_with_decoys.fasta &&\
chmod 777 data_library/library_fwd_with_decoys.fasta
# Search via Comet
mkdir results
mkdir results/library
for file in data_dda/*.mzML; do \
docker exec ddalibcreate comet -Pparams/comet.params $file ;done
# copy result files to result folder
for file in data_dda/*pep.xml; do \
bname=$(echo ${file##*/} | cut -f 1 -d '.') && \
mv data_dda/$bname.pep.xml results/library && \
mv data_dda/$bname.txt results/library ; done
# run tpp peptideprophet per each DDA MSrun
for file in results/library/*pep.xml; do \
fname=$(echo ${file##*/}); \
docker exec ddalibcreate xinteract -dDECOY_ -OARPld -Nresults/library/"interact-"$fname $file; done
# OPTIONAL, when desired run proteinProphet and conversion to mzIdentML for
# full submission to PRIDE
# docker exec ddalibcreate idconvert --mzIdentML results/library/interact*.pep.xml
# .mzid files will be in top folder
# combine by InterProphetParser (iprophet)
docker exec ddalibcreate InterProphetParser DECOY=DECOY_ \
results/library/interact*.pep.xml results/library/iprophet.pep.xml
docker exec ddalibcreate ProteinProphet results/library/iprophet.pep.xml \
results/library/iprophet.prot.xml IPROPHET
# Perform Mayu FDR estimation
docker exec ddalibcreate chmod 777 /usr/local/tpp/bin/Mayu.pl
#Fix permission issue in container v2.1.2_cv4
docker exec ddalibcreate Mayu.pl -A results/library/iprophet.pep.xml \
-C data_library/library_fwd_with_decoys.fasta -E DECOY_ -I 2 -G 0.01 -H 100 \
-M Mayu -verbose -P pepFDR=0.01:td && mv Mayu* results/library
# prints out PSM results at designated FDR that can then be used to obtain the
# IP (i-probability) necessary to filter the library
# Retrieve maximal iprobability from mayu output table used for filtering
ip_cutoff=$(cat results/library/Mayu_psm_pepFDR0.01_td_1.07.csv \
| cut -d ',' -f5 | sort | head -n 1)
$ip_cutoff
echo $ip_cutoff > results/library/ip_cutoff.txt
# Spectrast Library generation
##############################
# extract spectra from mzXML and filter based on cutoff and remove decoys
docker exec ddalibcreate spectrast -cNresults/library/SpectrastStep1_all \
-cIHCD \
-cf "Protein! ~ DECOY_" \
-cP$ip_cutoff \
-c_IRTdata_library/cirtkit.txt \
-c_IRR results/library/iprophet.pep.xml
# Build Consensus spectra
docker exec ddalibcreate spectrast -cNresults/library/SpectrastStep2_consensus \
-cIHCD -cf'Protein!~DECOY' \
-cAC -cM results/library/SpectrastStep1_all.splib
# Legacy Script: Spectrast2Tsv:
# convert to tsv, picking the 4-6 highest-intense fragment ions and
# feeding in the swath window information
# broken
# docker exec openswath spectrast2tsv.py -l 400,2000 -k openswath \
# -s b,y -w/data/data_library/swathwindows_64vw_human.txt -o 4 -n 6 \
# -a /data/results/library/sslib.tsv /data/results/library/SpectrastStep2.sptxt
# Generate different flavors of the Library.. (optimized for DIANN)
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-swath_windows_file /data/data_library/swathwindows.txt \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-out /data/results/library/SSLibrary_target.TraML
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-swath_windows_file /data/data_library/swathwindows.txt \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-out /data/results/library/SSLibrary_target_6-6t_std.tsv
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-swath_windows_file /data/data_library/swathwindows.txt \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-enable_detection_unspecific_losses \
-out /data/results/library/SSLibrary_target_6-6t_losses.tsv
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-min_transitions 4 \
-max_transitions 6 \
-allowed_fragment_types b,y \
-enable_detection_unspecific_losses \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-swath_windows_file /data/data_library/swathwindows.txt \
-out /data/results/library/SSLibrary_target_4-6t_losses.tsv
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-min_transitions 4 \
-max_transitions 24 \
-allowed_fragment_types b,y \
-enable_detection_unspecific_losses \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-swath_windows_file /data/data_library/swathwindows.txt \
-out /data/results/library/SSLibrary_target_4-24t_losses.tsv
docker exec openswath OpenSwathAssayGenerator \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-min_transitions 4 \
-max_transitions 24 \
-allowed_fragment_types b,y,x,z \
-enable_detection_unspecific_losses \
-precursor_lower_mz_limit 350 \
-precursor_upper_mz_limit 1650 \
-product_lower_mz_limit 150 \
-swath_windows_file /data/data_library/swathwindows.txt \
-out /data/results/library/SSLibrary_target_4-24t_losses_byxz.tsv
## Classical pathway (5600, 400-1200 mz, b,y, 6-6t)
# Convert to TraML, generate and append decoys and convert to .pqp
docker exec openswath TargetedFileConverter \
-in /data/results/library/SpectrastStep2_consensus.mrm \
-out /data/results/library/SSLibrary_transitionlist_all.TraML
# Decoy generation and conversion (only for the standard parameter library..)
docker exec openswath OpenSwathDecoyGenerator \
-in /data/results/library/SSLibrary_target.TraML \
-out /data/results/library/SSLibrary_target_decoy.TraML \
-method shuffle
# Convert to pqp for osw analysis
docker exec openswath TargetedFileConverter \
-in /data/results/library/SSLibrary_target_decoy.TraML \
-out /data/results/library/SSLibrary_target_decoy.pqp
# And for easy viewing and processing in other tools to tsv
docker exec openswath TargetedFileConverter \
-in /data/results/library/SSLibrary_target_decoy.TraML \
-out /data/results/library/SSLibrary_target_decoy.tsv
# done
echo "done"