具有添加的公式列的子集-几乎存在我正在尝试创建一个脚本来子集数据,该脚本还添加了带有公式的列。 我很近(有点)。 我可以使用新列创建子集,但是新列中仅包含点。
这是我到目前为止的内容:
Data Table( "Melt Curve Raw Data" ) << Subset(
By( :Well Position ),
All rows,
Selected columns only( 0 ),
columns( :Temperature, :Fluorescence, New Column( "Normalized Fluorescence", formula(
(:Fluorescence - Col Min(:Fluorescence )) / (Col Max(:Fluorescence )
-Col Min(:Fluorescence )))
))
);
搜索之后,我看到了有关eval命令的一些信息,但是作为一个初学者,我不知道如何添加它,因此它可以工作。
**理想情况下,我也可以直接在“温度”列之后而不是末尾添加新列
预先感谢您的任何建议!
数据表脚本编写回复:添加公式列的子集-几乎存在Subset()的列规范中不允许使用新的Column()。至少我在文档中找不到这样的方法,也没有在包含它的非常简单的子集示例中工作。因此,我修改了脚本,以在原始数据表中创建列,然后对表进行子集设置,然后返回并从原始表中将其删除。
Data Table( "Melt Curve Raw Data" ) <<
New Column( "Normalized Fluorescence",
formula(
(:Fluorescence - Col Min( :Fluorescence )) / (
Col Max( :Fluorescence ) - Col Min( :Fluorescence ))
)
);
Data Table( "Melt Curve Raw Data" ) <<
Subset(
By( :Well Position ),
All rows,
Selected columns only( 0 ),
columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
Data Table( "Melt Curve Raw Data" ) <<
delete columns( :Normalized Fluorescence );
回复:添加公式列的子集-几乎存在嗨,吉姆! 感谢您的建议。 我希望可以使用您的方法,但是不幸的是,当我在做子集之前添加列时,新列使用了以前的最大值和最小值,因此计算错误。
在子集后添加新列对我有用,不知道为什么,并且标题正确,但是公式没有“计算”,这就是为什么我认为这可能是我所看到的“评估”的原因。 当我进入新列时,它具有“抑制评估”功能,但是我不知道如何手动解决所有子集并对其进行更正,因此无法解决该问题。
我附上了一张屏幕截图,显示了我的外观。 出现该列,但带有点。 当我进入列信息时,它选中了“抑制评估”,而取消选中它可以解决该错误,但是不理想的情况是必须单独进入所有子集来取消选中该框。 我尝试向脚本中添加不同的代码以关闭抑制评估,但是到目前为止,它们均无法正常工作。
回复:添加了公式列的子集 - 几乎就在那里这里有 2 种解决方案。第一个更改计算以使用正在评估的特定井位的最小值和最大值。
Data Table( "Melt Curve Raw Data" ) << New Column( "Normalized Fluorescence",
formula(
(:Fluorescence - Col Min( :Fluorescence, :Well Position )) / (
Col Max( :Fluorescence, :Well Position )
-Col Min( :Fluorescence, :Well Position ))
)
);
Data Table( "Melt Curve Raw Data" ) << Subset(
By( :Well Position ),
All rows,
Selected columns only( 0 ),
columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
Data Table( "Melt Curve Raw Data" ) << delete columns( :Normalized Fluorescence );
第二个创建子集数据表,然后返回并为每个新数据表添加新列
new tables = Data Table( "Melt Curve Raw Data" ) <<
Subset(
By( :Well Position ),
All rows,
Selected columns only( 0 ),
columns( :Temperature, :Fluorescence, :Normalized Fluorescence )
);
For( i = 1, i <= N Items( new tables ), i++,
new tables[i] << New Column( "Normalized Fluorescence",
formula(
(:Fluorescence - Col Min( :Fluorescence, :Well Position )) / (
Col Max( :Fluorescence, :Well Position )
-Col Min( :Fluorescence, :Well Position ))
)
)
);