Skip to content

Commit

Permalink
bump to v0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
yufongpeng committed Jan 8, 2024
1 parent 247166b commit c5e938d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ChemistryQuantitativeAnalysis"
uuid = "3ed48883-6809-43ec-b77a-d23b0650d8c4"
authors = ["Yu-Fong Peng <[email protected]>"]
version = "0.3.0"
version = "0.3.1"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ value3
.
.
```
The config file in `batch_name.batch` must contain property `delim` which determines the default delimiter for all `table.txt` in this directory and subdirectories.
The property `delim` determines the default delimiter for `table.txt` in this directory and subdirectories.

`data.at` and `calibration` is not necessary for initializing a batch. The former can be added to the batch directly in julia, and the latter will be generated after calibration.

Expand All @@ -144,6 +144,9 @@ Config file for `ColumnDataTable` needs at least the following two properties.
[Type]
C
[delim]
\t
[Sample]
sample_col_name
Expand All @@ -159,6 +162,9 @@ Config file for `RowDataTable` needs at least the following two properties.
[Type]
R
[delim]
\t
[Analyte]
analyte_col_name
Expand All @@ -169,7 +175,6 @@ sample_col_name_2
.
.
```
User can also provide `delim` to overwrite the default one defined in `batch_name.batch/config.txt`.

### *.mt
It must contain two `*dt` files. `true_concentrstion.dt` contains true concentration for each analyte and level. The sample names must be integers.
Expand All @@ -180,6 +185,9 @@ Config file for `method.mt` needs two properties, `signal` and `pointlevel`.
[signal]
area
[delim]
\t
[pointlevel]
level_for_1st_point
level_for_2nd_point
Expand Down Expand Up @@ -208,13 +216,13 @@ It can contain multiple `*.dt`. The file names must start from an integer, `_` a
### Reading and writing Batch
To read a batch into julia, call `ChemistryQuantitativeAnalysis.read`.
```julia-repl
julia> batch = ChemistryQuantitativeAnalysis.read("batch_name.batch", T; table_type, analytetype)
julia> batch = ChemistryQuantitativeAnalysis.read("batch_name.batch", T; table_type, analytetype, delim)
```
`T` is the sink function for tabular data; it should create an object following `Tables.jl` interface. `table_type` is `T` parameter in the type signature of `Batch` which determines the underlying table type, and `analytetype` is a concrete type for `analyte` which msut have a method for string input.
`T` is the sink function for tabular data; it should create an object following `Tables.jl` interface. `table_type` is `T` parameter in the type signature of `Batch` which determines the underlying table type, `analytetype` is a concrete type for `analyte` which msut have a method for string input, and `delim` specifies delimiter for tabular data if `config[:delim]` does not exist.

To write project to disk, call `ChemistryQuantitativeAnalysis.write`. There is a keyword argument `delim` controling whether using "\t" or "," as delim for tables.
To write batch to disk, call `ChemistryQuantitativeAnalysis.write`. There is a keyword argument `delim` controling delimiter of tables.
```julia-repl
julia> ChemistryQuantitativeAnalysis.write("batch_name.batch", batch; delim = "\t")
julia> ChemistryQuantitativeAnalysis.write("batch_name.batch", batch; delim = '\t')
```
There will be a folder `calibration` containing multiple `*.mcal` or `*.scal` folders. The former is for `MultipleCalibration` and the latter is for `SingleCalibration`.

Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ end
@test all(isapprox.(cbatch.calibration[2].table.accuracy[1:3], [1, sqrt(1.1), sqrt(0.9)]))
@test all(isapprox.(rbatch.calibration[1].table.accuracy[1:3], [1, 1.1, 0.9]))
@test all(isapprox.(rbatch.calibration[2].table.accuracy[1:3], [1, sqrt(1.1), sqrt(0.9)]))
@test isapprox(update_calibration!(SingleCalibration((method.conctable.analyte[2], ), 100.0), method).conc, first(getanalyte(method.conctable, 2)))
end
@testset "Quantification" begin
@test all(isapprox_nan.(set_quantification!(rbatch.data, rbatch).estimated_concentration.S1, update_inv_predict!(rbatch, set_relative_signal(rbatch.data, rbatch)).data.estimated_concentration.S1))
@test all(isapprox.(quantification(cbatch, cbatch.data).var"G1(drug_a)", inv_predict(cbatch.calibration[1], relative_signal(cbatch, cbatch.data))))
@test all(isapprox_nan.(quantification(rbatch, rbatch.data).S2, update_quantification!(rbatch, rbatch.data).data.estimated_concentration.S2))
@test all(isapprox.(update_inv_predict!(update_relative_signal!(cbatch)).data.estimated_concentration.var"G1(drug_b)", set_quantification(cbatch.data, cbatch).estimated_concentration.var"G1(drug_b)"))
@test all(isapprox.(set_inv_predict(cbatch.data, cbatch).estimated_concentration.var"G1(drug_b)", cbatch.data.estimated_concentration.var"G1(drug_b)"))
set!(cbatch.data, :true_concentration, deepcopy(cbatch.data.estimated_concentration))
@test all(isapprox.(update_accuracy!(cbatch).data.accuracy.var"G1(drug_b)", [1.0, 1.0, 1.0]))
@test all(isapprox.(set_accuracy!(cbatch.data).accuracy.var"G1(drug_b)", [1.0, 1.0, 1.0]))
@test all(isapprox.(quantification(cbatch.calibration[1], cbatch.data.area), quantification(cbatch.calibration[1], cbatch.data.area, cbatch.calibration[1].analyte...)))
end
@testset "Utils" begin
@test getanalyte(cdata.area, AnalyteG1("G1(drug_b)")) == getanalyte(cdata.area, Symbol("G1(drug_b)"))
Expand Down

2 comments on commit c5e938d

@yufongpeng
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/98487

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.1 -m "<description of version>" c5e938de46f685bc6cc070952722eed869f3a3eb
git push origin v0.3.1

Please sign in to comment.