<p><code>merge(a, b, by = &quot;Sequence&quot;)</code> would &quot;merge&quot; the two tables (as the name suggests) based on the <code>Sequence</code> column. The caveat is that sequences have to be exactly the same to be considered &quot;common to both samples&quot;, so even 1 aa difference would be missed.</p>
<p>Simplified output:</p>
<pre><code>1       EKNPLPSKETIEQEKQAGES   1    47.67   47.67     98         86         86 sp|P20065|TYB4_MOUSE
2 KKTETQEKNPLPSKETIEQEKQAGES   1    47.67   47.67     98         86         86 sp|P20065|TYB4_MOUSE
</code></pre>

CC BY-SA 4.0
2021-11-12T18:03:34.393Z
2021-11-12T18:03:34.393Z
haci
<p>I have to peptide output sample output i would give here ..</p>
<p>Sample A</p>
<pre><code>dput(head(B5_ILS_Mus_PeptideSummary))
structure(list(N = c(1, 1, 1, 1, 1, 1), Unused = c(47.67, 47.67, 
47.67, 47.67, 47.67, 47.67), Total = c(47.67, 47.67, 47.67, 47.67, 
47.67, 47.67), `%Cov` = c(98.0000019073486, 98.0000019073486, 
98.0000019073486, 98.0000019073486, 98.0000019073486, 98.0000019073486
), `%Cov(50)` = c(86.0000014305115, 86.0000014305115, 86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115), `%Cov(95)` = c(86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115, 86.0000014305115, 
86.0000014305115), Accessions = c(&quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, 
&quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, 
&quot;sp|P20065|TYB4_MOUSE&quot;), Names = c(&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;
), Used = c(NA, NA, NA, NA, NA, NA), Annotation = c(NA, NA, NA, 
NA, NA, NA), Contrib = c(2, 2, 2, 2, 2, 2), Conf = c(99.0000009536743, 
58.2899987697601, 97.5199997425079, 99.0000009536743, 98.9300012588501, 
73.7299978733063), Sequence = c(&quot;EKNPLPSKETIEQEKQAGES&quot;, &quot;KKTETQEKNPLPSKETIEQEKQAGES&quot;, 
&quot;KNPLPSKETIEQEKQAGES&quot;, &quot;KTETQEKNPLPSKETIEQEKQAGES&quot;, &quot;LKKTETQEKNPLPSKETIEQEKQAGES&quot;, 
&quot;PLPSKETIEQEKQAGES&quot;), Modifications = c(NA_character_, NA_character_, 
NA_character_, NA_character_, NA_character_, NA_character_), 
    ProteinModifications = c(NA_character_, NA_character_, NA_character_, 
    NA_character_, NA_character_, NA_character_), Cleavages = c(NA, 
    NA, NA, NA, NA, NA), dMass = c(-0.0625222995877266, 0.180465996265411, 
    -0.00865099020302296, -0.0651467964053154, -0.107698999345303, 
    -0.0186963994055986), `Obs MW` = c(2241.05004882813, 2956.67944335938, 
    2112.06127929688, 2828.3388671875, 3069.47534179688, 1869.91320800781
    ), `Obs m/z` = c(748.0239, 740.1771, 529.0226, 708.092, 768.3761, 
    624.3117), `Theor MW` = c(2241.11254882813, 2956.4990234375, 
    2112.06982421875, 2828.40405273438, 3069.5830078125, 1869.93200683594
    ), `Theor m/z` = c(748.044738769531, 740.132019042969, 529.024719238281, 
    708.108276367188, 768.403015136719, 624.317932128906), `Theor z` = c(3, 
    4, 4, 4, 4, 3), Sc = c(15, 8, 11, 21, 12, 10), Spectrum = c(&quot;1.1.1.372.12&quot;, 
    &quot;1.1.1.339.6&quot;, &quot;1.1.1.358.3&quot;, &quot;1.1.1.355.16&quot;, &quot;1.1.1.346.14&quot;, 
    &quot;1.1.1.384.8&quot;), `Acq Time` = c(4.2116, 3.539133, 3.91795, 
    3.867617, 3.68345, 4.45125), `Intensity (Peptide)` = c(3775.35, 
    110.58, 4374.93, 7285.52, 3073.51, 5776.43), PrecursorIntensityAcquisition = c(3626.33, 
    37.12, 4301.05, 7124.23, 2706.13, 5533.12), `Apex Time (Peptide)` = c(4.2, 
    3.59, 3.91, 3.85, 3.67, 4.44), `Elution Peak Width (Peptide)` = c(0.1, 
    0.06, 0.08, 0.1, 0.08, 0.08), MS2Counts = c(3077.868, 477.5326, 
    2262.827, 4694.357, 1759.267, 2618.842)), row.names = c(NA, 
-6L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
</code></pre>
<p>Sample B</p>
<pre><code>dput(head(B6_ILS_mus_PeptideSummary))
structure(list(N = c(1, 1, 1, 1, 1, 1), Unused = c(82.41, 82.41, 
82.41, 82.41, 82.41, 82.41), Total = c(82.41, 82.41, 82.41, 82.41, 
82.41, 82.41), `%Cov` = c(100, 100, 100, 100, 100, 100), `%Cov(50)` = c(87.9999995231628, 
87.9999995231628, 87.9999995231628, 87.9999995231628, 87.9999995231628, 
87.9999995231628), `%Cov(95)` = c(86.0000014305115, 86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115, 86.0000014305115
), Accessions = c(&quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, 
&quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, &quot;sp|P20065|TYB4_MOUSE&quot;, 
&quot;sp|P20065|TYB4_MOUSE&quot;), Names = c(&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;, 
&quot;Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1&quot;
), Used = c(NA, NA, NA, NA, NA, NA), Annotation = c(NA, NA, NA, 
NA, NA, NA), Contrib = c(2, 2, 2, 2, 2, 2), Conf = c(99.0000009536743, 
99.0000009536743, 99.0000009536743, 99.0000009536743, 94.4599986076355, 
99.0000009536743), Sequence = c(&quot;DKPDMAEIEKFDKSKLK&quot;, &quot;EKNPLPSKETIEQEKQAGES&quot;, 
&quot;ETQEKNPLPSKETIEQEKQAGES&quot;, &quot;IEKFDKSKLKKTETQEKNPLPSKETIEQEKQAGES&quot;, 
&quot;KKTETQEKNPLPSKETIEQEKQAGES&quot;, &quot;KNPLPSKETIEQEK&quot;), Modifications = c(NA_character_, 
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_
), ProteinModifications = c(NA_character_, NA_character_, NA_character_, 
NA_character_, NA_character_, NA_character_), Cleavages = c(NA, 
NA, NA, NA, NA, NA), dMass = c(0.0129736997187138, -0.0542825013399124, 
-0.0299271997064352, -0.107947997748852, -0.0191929005086422, 
-0.0046052997931838), `Obs MW` = c(2021.06335449219, 2241.05834960938, 
2599.2314453125, 4045.01391601563, 2956.47973632813, 1639.87341308594
), `Obs m/z` = c(506.2731, 748.0267, 650.8151, 810.0101, 592.3032, 
547.6318), `Theor MW` = c(2021.05029296875, 2241.11254882813, 
2599.26123046875, 4045.12182617188, 2956.4990234375, 1639.87805175781
), `Theor m/z` = c(506.269866943359, 748.044738769531, 650.822631835938, 
810.031677246094, 592.307067871094, 547.63330078125), `Theor z` = c(4, 
3, 4, 5, 5, 3), Sc = c(11, 12, 12, 26, 10, 10), Spectrum = c(&quot;1.1.1.858.2&quot;, 
&quot;1.1.1.621.5&quot;, &quot;1.1.1.640.9&quot;, &quot;1.1.1.643.4&quot;, &quot;1.1.1.597.3&quot;, &quot;1.1.1.604.4&quot;
), `Acq Time` = c(8.74735, 4.069217, 4.43505, 4.4987, 3.615083, 
3.7369), `Intensity (Peptide)` = c(1798.16, 2856.36, 1278.57, 
5833.81, 758.71, 599.21), PrecursorIntensityAcquisition = c(1603.78, 
443.55, 1104.72, 5265.07, 484.03, 423.02), `Apex Time (Peptide)` = c(8.72, 
4.19, 4.39, 4.45, 3.55, 3.78), `Elution Peak Width (Peptide)` = c(0.14, 
0.12, 0.12, 0.37, 0.1, 0.08), MS2Counts = c(456.3906, 313.663, 
712.3438, 2748.186, 351.0362, 228.9387)), row.names = c(NA, -6L
), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;))
</code></pre>
<p>Unlike genes expression where it can be intersected since i know the gene name or ensemble ID are consistent.</p>
<p>Here My objective is how many of the sequence are common or unique to these two condition.</p>
<p>In the <strong>accession</strong> column many ID are same but the differences are in the sequence column.</p>
<p>Is there any programmatic way of finding the elements that are common or different in both the conditions</p>

<proteomics>
How to match peptide sequence from two different condition
# How to match peptide sequence from two different condition

(Asked by: username_0 on 2021-11-11)

I have to peptide output sample output i would give here ..
Sample A
dput(head(B5_ILS_Mus_PeptideSummary))
structure(list(N = c(1, 1, 1, 1, 1, 1), Unused = c(47.67, 47.67, 
47.67, 47.67, 47.67, 47.67), Total = c(47.67, 47.67, 47.67, 47.67, 
47.67, 47.67), `%Cov` = c(98.0000019073486, 98.0000019073486, 
98.0000019073486, 98.0000019073486, 98.0000019073486, 98.0000019073486
), `%Cov(50)` = c(86.0000014305115, 86.0000014305115, 86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115), `%Cov(95)` = c(86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115, 86.0000014305115, 
86.0000014305115), Accessions = c("sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", 
"sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", 
"sp|P20065|TYB4_MOUSE"), Names = c("Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1"
), Used = c(NA, NA, NA, NA, NA, NA), Annotation = c(NA, NA, NA, 
NA, NA, NA), Contrib = c(2, 2, 2, 2, 2, 2), Conf = c(99.0000009536743, 
58.2899987697601, 97.5199997425079, 99.0000009536743, 98.9300012588501, 
73.7299978733063), Sequence = c("EKNPLPSKETIEQEKQAGES", "KKTETQEKNPLPSKETIEQEKQAGES", 
"KNPLPSKETIEQEKQAGES", "KTETQEKNPLPSKETIEQEKQAGES", "LKKTETQEKNPLPSKETIEQEKQAGES", 
"PLPSKETIEQEKQAGES"), Modifications = c(NA_character_, NA_character_, 
NA_character_, NA_character_, NA_character_, NA_character_), 
    ProteinModifications = c(NA_character_, NA_character_, NA_character_, 
    NA_character_, NA_character_, NA_character_), Cleavages = c(NA, 
    NA, NA, NA, NA, NA), dMass = c(-0.0625222995877266, 0.180465996265411, 
    -0.00865099020302296, -0.0651467964053154, -0.107698999345303, 
    -0.0186963994055986), `Obs MW` = c(2241.05004882813, 2956.67944335938, 
    2112.06127929688, 2828.3388671875, 3069.47534179688, 1869.91320800781
    ), `Obs m/z` = c(748.0239, 740.1771, 529.0226, 708.092, 768.3761, 
    624.3117), `Theor MW` = c(2241.11254882813, 2956.4990234375, 
    2112.06982421875, 2828.40405273438, 3069.5830078125, 1869.93200683594
    ), `Theor m/z` = c(748.044738769531, 740.132019042969, 529.024719238281, 
    708.108276367188, 768.403015136719, 624.317932128906), `Theor z` = c(3, 
    4, 4, 4, 4, 3), Sc = c(15, 8, 11, 21, 12, 10), Spectrum = c("1.1.1.372.12", 
    "1.1.1.339.6", "1.1.1.358.3", "1.1.1.355.16", "1.1.1.346.14", 
    "1.1.1.384.8"), `Acq Time` = c(4.2116, 3.539133, 3.91795, 
    3.867617, 3.68345, 4.45125), `Intensity (Peptide)` = c(3775.35, 
    110.58, 4374.93, 7285.52, 3073.51, 5776.43), PrecursorIntensityAcquisition = c(3626.33, 
    37.12, 4301.05, 7124.23, 2706.13, 5533.12), `Apex Time (Peptide)` = c(4.2, 
    3.59, 3.91, 3.85, 3.67, 4.44), `Elution Peak Width (Peptide)` = c(0.1, 
    0.06, 0.08, 0.1, 0.08, 0.08), MS2Counts = c(3077.868, 477.5326, 
    2262.827, 4694.357, 1759.267, 2618.842)), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))

Sample B
dput(head(B6_ILS_mus_PeptideSummary))
structure(list(N = c(1, 1, 1, 1, 1, 1), Unused = c(82.41, 82.41, 
82.41, 82.41, 82.41, 82.41), Total = c(82.41, 82.41, 82.41, 82.41, 
82.41, 82.41), `%Cov` = c(100, 100, 100, 100, 100, 100), `%Cov(50)` = c(87.9999995231628, 
87.9999995231628, 87.9999995231628, 87.9999995231628, 87.9999995231628, 
87.9999995231628), `%Cov(95)` = c(86.0000014305115, 86.0000014305115, 
86.0000014305115, 86.0000014305115, 86.0000014305115, 86.0000014305115
), Accessions = c("sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", 
"sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", "sp|P20065|TYB4_MOUSE", 
"sp|P20065|TYB4_MOUSE"), Names = c("Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1", 
"Thymosin beta-4 OS=Mus musculus OX=10090 GN=Tmsb4x PE=1 SV=1"
), Used = c(NA, NA, NA, NA, NA, NA), Annotation = c(NA, NA, NA, 
NA, NA, NA), Contrib = c(2, 2, 2, 2, 2, 2), Conf = c(99.0000009536743, 
99.0000009536743, 99.0000009536743, 99.0000009536743, 94.4599986076355, 
99.0000009536743), Sequence = c("DKPDMAEIEKFDKSKLK", "EKNPLPSKETIEQEKQAGES", 
"ETQEKNPLPSKETIEQEKQAGES", "IEKFDKSKLKKTETQEKNPLPSKETIEQEKQAGES", 
"KKTETQEKNPLPSKETIEQEKQAGES", "KNPLPSKETIEQEK"), Modifications = c(NA_character_, 
NA_character_, NA_character_, NA_character_, NA_character_, NA_character_
), ProteinModifications = c(NA_character_, NA_character_, NA_character_, 
NA_character_, NA_character_, NA_character_), Cleavages = c(NA, 
NA, NA, NA, NA, NA), dMass = c(0.0129736997187138, -0.0542825013399124, 
-0.0299271997064352, -0.107947997748852, -0.0191929005086422, 
-0.0046052997931838), `Obs MW` = c(2021.06335449219, 2241.05834960938, 
2599.2314453125, 4045.01391601563, 2956.47973632813, 1639.87341308594
), `Obs m/z` = c(506.2731, 748.0267, 650.8151, 810.0101, 592.3032, 
547.6318), `Theor MW` = c(2021.05029296875, 2241.11254882813, 
2599.26123046875, 4045.12182617188, 2956.4990234375, 1639.87805175781
), `Theor m/z` = c(506.269866943359, 748.044738769531, 650.822631835938, 
810.031677246094, 592.307067871094, 547.63330078125), `Theor z` = c(4, 
3, 4, 5, 5, 3), Sc = c(11, 12, 12, 26, 10, 10), Spectrum = c("1.1.1.858.2", 
"1.1.1.621.5", "1.1.1.640.9", "1.1.1.643.4", "1.1.1.597.3", "1.1.1.604.4"
), `Acq Time` = c(8.74735, 4.069217, 4.43505, 4.4987, 3.615083, 
3.7369), `Intensity (Peptide)` = c(1798.16, 2856.36, 1278.57, 
5833.81, 758.71, 599.21), PrecursorIntensityAcquisition = c(1603.78, 
443.55, 1104.72, 5265.07, 484.03, 423.02), `Apex Time (Peptide)` = c(8.72, 
4.19, 4.39, 4.45, 3.55, 3.78), `Elution Peak Width (Peptide)` = c(0.14, 
0.12, 0.12, 0.37, 0.1, 0.08), MS2Counts = c(456.3906, 313.663, 
712.3438, 2748.186, 351.0362, 228.9387)), row.names = c(NA, -6L
), class = c("tbl_df", "tbl", "data.frame"))

Unlike genes expression where it can be intersected since i know the gene name or ensemble ID are consistent.
Here My objective is how many of the sequence are common or unique to these two condition.
In the accession column many ID are same but the differences are in the sequence column.
Is there any programmatic way of finding the elements that are common or different in both the conditions

**Tags:** proteomics

---

## 1 answers

### Answer by username_1 on 2021-11-12. Score: 1 | Accepted answer

merge(a, b, by = "Sequence") would "merge" the two tables (as the name suggests) based on the Sequence column. The caveat is that sequences have to be exactly the same to be considered "common to both samples", so even 1 aa difference would be missed.
Simplified output:
1       EKNPLPSKETIEQEKQAGES   1    47.67   47.67     98         86         86 sp|P20065|TYB4_MOUSE
2 KKTETQEKNPLPSKETIEQEKQAGES   1    47.67   47.67     98         86         86 sp|P20065|TYB4_MOUSE


---

