-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior
Description
Bug Description
If the metadata in a file in misformatted (i.e., does not contain six lines), read_file()
and read()
returns the incorrect output. Currently, we lose information and, instead of being treated as rows, samples are treated as columns.
# Metadata contains only four lines
misformatted <- tibble::tribble(
~Gene, ~atp6, ~mdr1,
"Mutation Name", "atp6-Ala623Glu", "mdr1-Asn86Tyr",
"AA Change", "Ala623Glu", "Asn86Tyr",
"Targeted", "Yes", "Yes",
"D10-JJJ-23", "0", "13",
"D10-JJJ-43", "0", "0",
"D10-JJJ-50", "15", "0"
)
path <- tempfile()
readr::write_csv(misformatted, path)
MIPr::read_file(path)
#> # A tibble: 2 × 8
#> sample gene mutation_name aa_change targeted d10_jjj_23 d10_jjj_43 value
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 D10-JJJ-50 atp6 atp6-Ala623Glu Ala623Glu Yes 0 0 15
#> 2 D10-JJJ-50 mdr1 mdr1-Asn86Tyr Asn86Tyr Yes 13 0 0
unlink(path)
Created on 2021-09-14 by the reprex package (v2.0.1)
Expected Behavior
We would expect to see six rows in our final dataset with all the metadata represented as columns, as shown below:
MIPr::read_file(path)
#> # A tibble: 6 × 8
#> sample gene mutation_name aa_change targeted value
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 D10-JJJ-23 atp6 atp6-Ala623G… Ala623Glu Yes 0
#> 2 D10-JJJ-43 atp6 atp6-Ala623G… Ala623Glu Yes 0
#> 3 D10-JJJ-50 atp6 atp6-Ala623G… Ala623Glu Yes 15
#> 4 D10-JJJ-23 mdr1 mdr1-Asn86Tyr Asn86Tyr Yes 13
#> 5 D10-JJJ-43 mdr1 mdr1-Asn86Tyr Asn86Tyr Yes 0
#> 6 D10-JJJ-50 mdr1 mdr1-Asn86Tyr Asn86Tyr Yes 0
Metadata
Metadata
Assignees
Labels
bugunexpected problem or unintended behaviorunexpected problem or unintended behavior