Please consider the following toy code:
In[1]:= toylist = {hyb["chip1"], hyb["chip2"], hyb["chip3"]};
toyindices = {{{3, 1}, {3, 2}}, {{2, 3}, {2, 3}}, {{1, 3}, {1, 2}}};
toydata = {{{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}}};
Table[Evaluate[toylist[[i]]] =
Extract[toydata[[i]], toyindices[[j]]], {i, 1, Length[toylist]}, {j,
1, Length[toyindices]}] (* Version B *)
During evaluation of In[1]:= Set::setraw: Cannot assign to raw object 7. >>
During evaluation of In[1]:= Set::setraw: Cannot assign to raw object 8. >>
During evaluation of In[1]:= Set::setraw: Cannot assign to raw object 7. >>
During evaluation of In[1]:= General::stop: Further output of Set::setraw will be suppressed during this calculation. >>
Out[4]= {{{7, 8}, {6, 6}, {3, 2}}, {{16, 17}, {15, 15}, {12,
11}}, {{25, 26}, {24, 24}, {21, 20}}}
In[5]:= hyb["chip2"]
Out[5]= {16, 17}
Even though the toy code above is producing the results I want, Mathematica throws the Set::setraw
error.
Question1: Is the error happening because I am using strings as indexes?
Question2: Would it be safe to ignore or even turn this error off?
The toy code above was designed to help troubleshoot a real-world problem I have. In the real-world case, I get two errors Set::setraw
and Set::shape
, from the following statement:
Table[Evaluate[mmsignalnames[[i]]] =
Extract[celvarnames[[i]], mmammindices[[j]]], {i, 1,
Length[celvarnames]}, {j, 1, Length[mmammindices]}];
Would you have any advice about the Set::shape
error? I can't tell if it is related to the Set::setraw
error.
More detail about the real-world problem....
I have 24 different biology datasets that have unique names. I have created a list called mmsignalnames which is composed of indexed symbols such as mmsignal["GSM356796"], mmsignal["GSM356797"] .... up to all 24 datasets. This is what I was trying to replicate in the toycode variable above.
My desire is to programmatically load each of these mmsignal["GSM356796"] etc symbols with specific data from each experiment. Each of the mmsignal[ .... ] symbols needs to receive a subset of data from a master list containing all 24 experiments worth of data, where each experiment is a sublist within the master list. This is what I was trying to replicate in the toydata variable above, where in the toydata varaiable I have 3 experiments worth of data entered as sublists.
The coordinates used to extract information from the masterlist (or toydata above) are contained within a list of indices that will be the same for each experiment. In other words, the same indices are used to extract data from the same position in 24 different experiments. So, in my toy code above, the output provided by my toy code, is actually what I want, and perhaps sloppily, does programmatically load specific information into the hyp["chip"] symbols.
Unfortunately, my real-world problem also has the Set::shape error which I can't seem to replicate in my toycode.