summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2019-08-19 15:25:26 +0200
committerChristoph Helma <helma@in-silico.ch>2019-08-19 15:25:26 +0200
commita43af9e1d26d564fdbcf089977908a19299acd5a (patch)
treee4f67c7cd90746c09a1aa2932e6634cd64c82327
parentd87996495e118223419a83dc22cbac097253be7e (diff)
sdf export fixed
-rw-r--r--lib/dataset.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/dataset.rb b/lib/dataset.rb
index 49208ce..7037679 100644
--- a/lib/dataset.rb
+++ b/lib/dataset.rb
@@ -432,19 +432,20 @@ module OpenTox
# Convert dataset to SDF format
# @return [String] SDF string
def to_sdf
+
+ export_features = merged_features
+ export_features = transformed_bioactivity_features if export_features.empty?
+ export_features = bioactivity_features if export_features.empty?
+ export_feature = export_features.first
+
sdf = ""
compounds.each do |compound|
sdf_lines = compound.sdf.sub(/\$\$\$\$\n/,"").split("\n")
sdf_lines[0] = compound.smiles
sdf += sdf_lines.join("\n")
- bioactivity_features.each do |f|
- v = values(compound,f)
- unless v.empty?
- sdf += "\n> <#{f.name}>\n"
- sdf += v.uniq.join ","
- sdf += "\n"
- end
- end
+ sdf += "\n> <#{export_feature.name}>\n"
+ sdf += values(compound,export_feature).uniq.join ","
+ sdf += "\n"
sdf += "\n$$$$\n"
end
sdf