Skip to content

Commit

Permalink
add "arc i create" deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Brilator committed Nov 21, 2023
1 parent 5d2a908 commit 23c0b88
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 49 deletions.
33 changes: 6 additions & 27 deletions src/ArcCommander/APIs/InvestigationAPI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module InvestigationAPI =
if other.SubmissionDate.IsSome || replaceWithEmptyValues then this.SubmissionDate <- other.SubmissionDate
if other.PublicReleaseDate.IsSome || replaceWithEmptyValues then this.PublicReleaseDate <- other.PublicReleaseDate




module InvestigationFile =
Expand All @@ -31,33 +31,12 @@ module InvestigationAPI =
IsaModelConfiguration.getInvestigationFilePath arcConfiguration
|> System.IO.File.Exists

///// Creates an investigation file in the ARC from the given investigation metadata contained in cliArgs that contains no studies or assays.
//let create (arcConfiguration : ArcConfiguration) (investigationArgs : Map<string,Argument>) =
/// Creates an investigation file in the ARC from the given investigation metadata contained in cliArgs that contains no studies or assays.
let create (arcConfiguration : ArcConfiguration) (investigationArgs : ArcParseResults<InvestigationCreateArgs>) =

// let log = Logging.createLogger "InvestigationCreateLog"

// log.Info("Start Investigation Create")

// if InvestigationFile.exists arcConfiguration then
// log.Error("Investigation file does already exist.")

// else
// let investigation =

// let info =
// ArcInvestigation(getFieldValueByName "Identifier" investigationArgs)
// Investigation.InvestigationInfo.create
// ()
// (getFieldValueByName "Title" investigationArgs)
// (getFieldValueByName "Description" investigationArgs)
// (getFieldValueByName "SubmissionDate" investigationArgs)
// (getFieldValueByName "PublicReleaseDate" investigationArgs)
// []
// Investigation.fromParts info [] [] [] [] []

// let investigationFilePath = IsaModelConfiguration.tryGetInvestigationFilePath arcConfiguration |> Option.get

// Investigation.toFile investigationFilePath investigation
let log = Logging.createLogger "InvestigationCreateLog"

log.Error InvestigationCreateArgs.deprecationWarning

/// Updates the existing investigation file in the ARC with the given investigation metadata contained in cliArgs.
let update (arcConfiguration : ArcConfiguration) (investigationArgs : ArcParseResults<InvestigationUpdateArgs>) =
Expand Down
40 changes: 21 additions & 19 deletions src/ArcCommander/CLIArguments/InvestigationArgs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,27 @@
open Argu
open ArcCommander.ArgumentProcessing

///// CLI arguments for creating a new investigation file for the arc
//// in the case of investigations 'empty' does not mean empty file but rather an
//// investigation without studies/assays. To reflect the need for metadata here,
//// this command is called `create` instead of `init`
//type InvestigationCreateArgs =
// | [<Mandatory>][<AltCommandLine("-i")>][<Unique>][<FileName>] Identifier of investigation_identifier:string
// | [<Unique>] Title of title:string
// | [<Unique>] Description of description:string
// | [<Unique>] SubmissionDate of submission_date:string
// | [<Unique>] PublicReleaseDate of public_release_date:string

// interface IArgParserTemplate with
// member this.Usage =
// match this with
// | Identifier _-> "An identifier or an accession number provided by a repository. This SHOULD be locally unique. Hint: If you're unsure about this, you can use the name of the ARC or any name that roughly hints to what your experiment is about."
// | Title _-> "A concise name given to the investigation"
// | Description _-> "A textual description of the investigation"
// | SubmissionDate _-> "The date on which the investigation was reported to the repository"
// | PublicReleaseDate _-> "The date on which the investigation was released publicly"
/// CLI arguments for creating a new investigation file for the arc
// in the case of investigations 'empty' does not mean empty file but rather an
// investigation without studies/assays. To reflect the need for metadata here,
// this command is called `create` instead of `init`
type InvestigationCreateArgs =
| [<Mandatory>][<AltCommandLine("-i")>][<Unique>][<FileName>] Identifier of investigation_identifier:string
| [<Unique>] Title of title:string
| [<Unique>] Description of description:string
| [<Unique>] SubmissionDate of submission_date:string
| [<Unique>] PublicReleaseDate of public_release_date:string

static member deprecationWarning = "DEPRECATED: isa.investigation.xlsx is now created during \"arc init\". To update isa.investigation top-level metadata, please use \"arc i update\""

interface IArgParserTemplate with
member this.Usage =
match this with
| Identifier _-> "An identifier or an accession number provided by a repository. This SHOULD be locally unique. Hint: If you're unsure about this, you can use the name of the ARC or any name that roughly hints to what your experiment is about."
| Title _-> "A concise name given to the investigation"
| Description _-> "A textual description of the investigation"
| SubmissionDate _-> "The date on which the investigation was reported to the repository"
| PublicReleaseDate _-> "The date on which the investigation was released publicly"

/// CLI arguments updating the arc's existing investigation file
type InvestigationUpdateArgs =
Expand Down
4 changes: 2 additions & 2 deletions src/ArcCommander/Commands/InvestigationCommand.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open InvestigationPublications

type InvestigationCommand =

//| [<CliPrefix(CliPrefix.None)>] Create of create_args : ParseResults<InvestigationCreateArgs>
| [<CliPrefix(CliPrefix.None)>] Create of create_args : ParseResults<InvestigationCreateArgs>
| [<CliPrefix(CliPrefix.None)>] Update of update_args : ParseResults<InvestigationUpdateArgs>
| [<CliPrefix(CliPrefix.None)>] [<SubCommand()>] Edit
//| [<CliPrefix(CliPrefix.None)>] Delete of delete_args : ParseResults<InvestigationDeleteArgs>
Expand All @@ -19,7 +19,7 @@ type InvestigationCommand =
interface IArgParserTemplate with
member this.Usage =
match this with
//| Create _ -> "Create a new investigation with the given Metadata"
| Create _ -> InvestigationCreateArgs.deprecationWarning
| Update _ -> "Update the ARC's investigation with the given Metdadata"
| Edit _ -> "Open an editor window to directly edit the ARC's investigation file"
//| Delete _ -> "Delete the ARC's investigation file (DANGER ZONE!)"
Expand Down
2 changes: 1 addition & 1 deletion src/ArcCommander/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ let handleInvestigationPublicationsSubCommands arcConfiguration publicationVerb

let handleInvestigationSubCommands arcConfiguration investigationVerb =
match investigationVerb with
//| InvestigationCommand.Create r -> processCommand arcConfiguration InvestigationAPI.create r
| InvestigationCommand.Create r -> processCommand arcConfiguration InvestigationAPI.create r
| InvestigationCommand.Update r -> processCommand arcConfiguration InvestigationAPI.update r
| InvestigationCommand.Edit -> processCommandWithoutArgs arcConfiguration InvestigationAPI.edit
//| InvestigationCommand.Delete r -> processCommand arcConfiguration InvestigationAPI.delete r
Expand Down

0 comments on commit 23c0b88

Please sign in to comment.