Skip to content

Commit

Permalink
error if channels not unique; stricter xpath
Browse files Browse the repository at this point in the history
  • Loading branch information
gszep committed Nov 12, 2023
1 parent f17694e commit 6bedae1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "FlowWorkspace"
uuid = "93705cf0-0d0c-4207-9085-aa3a02725bf0"
authors = ["Grisha Szep", "Valerie Coppard", "Felix Feyertag"]
version = "0.1.16"
version = "0.1.17"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
6 changes: 5 additions & 1 deletion src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ function load(path::String, sample::Union{EzXML.Node,Nothing}; kwargs...)
transform!(channels, ["N", "S"] => ByRow((N, S) -> ~ismissing(S) ? S != "" ? S : N : N) => "name")
channelMap = Dict(param.N => ismissing(param.S) ? param.N : param.S for param eachrow(params))

# throw error listing duplicate channel names
duplicates = filter(x -> count(channels.name .== x) > 1, unique(channels.name))
@assert(isempty(duplicates), "Channel names must be unique. Please resolve duplicates: $duplicates")

###################################### biexponential transformation
data = DataFrame(data, channels.name)
transformationFunctions = transforms(sample; channelMap=channelMap)
Expand Down Expand Up @@ -79,7 +83,7 @@ end

function findchannels(sample::EzXML.Node)

params = DataFrame("keyword" => findall("..//Keywords/Keyword[starts-with(@name,'\$P') and contains(@name,'N')]", sample))
params = DataFrame("keyword" => findall("..//Keywords/Keyword[starts-with(@name, '\$P') and substring(@name, string-length(@name)) = 'N' and translate(substring-before(substring(@name, 3), 'N'), '0123456789', '') = '']", sample))
keys = ["G", "R", "V", "S", "B", "N", "E", "AR"]

for key keys
Expand Down

0 comments on commit 6bedae1

Please sign in to comment.