Skip to content

Commit

Permalink
MB-251 Parameter Value[Scan polarity] CV check
Browse files Browse the repository at this point in the history
  • Loading branch information
komstat committed Mar 11, 2024
1 parent ee6cf70 commit e6b1737
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
5 changes: 4 additions & 1 deletion conf/controlled_terms.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
}
},
"sdrf": {
}
"warning": {
"Parameter Value[Scan polarity]": ["positive", "negative", "alternating"]
}
}
}
6 changes: 3 additions & 3 deletions conf/sdrf_required_columns_warning.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
"Comment\\[BioSample\\]",
"Comment\\[sample_title\\]",
"Comment[BioSample]",
"Comment[sample_title]",
"Raw Data File",
"Processed Data File",
"Metabolite Assignment File",
"Factor Value\\[[-_ A-Za-z0-9.]+\\]"
"Factor Value[[-_ A-Za-z0-9.]+]"
]
28 changes: 26 additions & 2 deletions exe/mb-validate
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,6 @@ sdrf_protocol_ref_index_a.each{|i|
protocol_type_in_ref_a.push(protocol_types_in_ref_a.sort.uniq[0])

### MB_SR0033 error ignore Missing protocol reference

if protocol_types_in_ref_a.sort.uniq.size == 0
error_ignore_sdrf_a.push(["MB_SR0033", "error_ignore", "Protocol name is not referenced in Protocol REF: #{sdrf_file} Protocol REF at column #{i}"])
end
Expand All @@ -1053,7 +1052,6 @@ if protocol_type_ref_from_columns_a.size > 0
warning_sdrf_a.push(["MB_SR0035", "warning", "Protocol type reference from different columns: #{sdrf_file} #{protocol_type_ref_from_columns_a.sort.uniq.join(",")}"])
end


# Protocol REF で指定されている name から全て type が回収できれば
sdrf_header_frame_a = []
sdrf_defined_comment_a = []
Expand Down Expand Up @@ -1096,6 +1094,32 @@ if sdrf_protocol_ref_index_a.size == protocol_type_in_ref_a.size

end

## SDRF CV チェック
## MB_SR0045 error Invalid value for controlled terms
# 未だルールなし

## MB_SR0046 warning Invalid value for controlled terms
sdrf_not_cv_warning_h = {}
open("#{conf_path}/controlled_terms.json"){|f|
sdrf_not_cv_warning_h = JSON.load(f)["sdrf"]["warning"]
}

sdrf_field_not_cv_warning_h = {}
for field, cv_term_a in sdrf_not_cv_warning_h
if sdrf_transpose_h[field]
# 必須チェックは別で実施しているのでここでは空要素を除く
if (sdrf_transpose_h[field] - cv_term_a).reject(&:empty?).size > 0
sdrf_field_not_cv_warning_h.store(field, (sdrf_transpose_h[field] - cv_term_a).reject(&:empty?).join(","))
end
end
end

if sdrf_field_not_cv_warning_h.size > 0
for key, value in sdrf_field_not_cv_warning_h
warning_sdrf_a.push(["MB_SR0046", "warning", "Value is not in controlled terms: #{sdrf_file} #{key}:#{value}"])
end
end

## SDRF order チェック
## MB_SR0026 error ignore Invalid column order 全 Comment を削除した順序骨格の比較
if sdrf_column_order_h[submission_type] && sdrf_header_frame_a.uniq != sdrf_column_order_h[submission_type].reject{|e| e =~ /Comment\[.*\]/ || e =~ /Unit\[.*\]/}
Expand Down

0 comments on commit e6b1737

Please sign in to comment.