I have the following code:
names = {"Gly", "Ala", "Ser", "Pro", "Val", "Thr", "Cys", "Leu/Ile",
"Asn", "Asp/isoAsp", "Gln", "Lys", "Glu", "Met", "His", "Phe",
"Arg", "Tyr", "Trp", "4-hydroxyPro", "5-hydroxyLys",
"6-N-methylLys", "\[Gamma]-carboxyGlu", "selenoCys", "phosphoSer",
"phosphoThr", "phosphoTyr", "\[Sigma]-N-methylArg",
"6-N-acetylLys", "Glu \[Gamma]-methyl ester", "Ornithine",
"Citrulline", "3-methylHis", "N,N,N-trimethylLys", "N-acetylAla",
"3-sulfinoAla", "N-acetylCys", "pyroGlu", "N-acetylGly",
"Met sulfoxide", "Met sulfone", "N-acetylSer", "N-acetylThr",
"Kynurenine", "Tyr O-sulfate"};
list = {57.0215, 71.0371, 87.0320, 97.0528, 99.0684, 101.0477,
103.0092, 113.0841, 114.0429, 115.0269, 128.0586, 128.0950,
129.0426, 131.0405, 137.0589, 147.0684, 156.1011, 163.0633,
186.0793, 113.048, 144.089, 142.110, 173.032, 150.954, 166.998,
181.014, 243.029, 170.116, 170.105, 143.058, 114.079, 157.085,
151.074, 170.141, 113.047, 134.999, 145.019, 111.032, 99.032,
147.035, 163.030, 129.042, 143.058, 190.047, 243.020};
subsets =
DeleteDuplicates@
Select[Subsets[list, {3}], 344.160 <= Total[#] <= 344.163 &]
which produces the expression:
{{71.0371, 103.009, 170.116}}
To display the parts of this expression as their names, I'm using:
seqNam = names[[Position[list, subsets[[1]][[1]]] [[1]][[1]]]]
seqNam = names[[Position[list, subsets[[1]][[2]]] [[1]][[1]]]]
seqNam = names[[Position[list, subsets[[1]][[3]]] [[1]][[1]]]]
but I would like do display all parts as one line of output, and I don't know how. Any help would be appreciated!
names[[Position[list, #][[1, 1]]]] & /@ subsets[[1]]
$\endgroup$