Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • venn/Ru_ChlamyHeatstress
  • thomas.naegele/Ru_ChlamyHeatstress
  • scholz/Ru_ChlamyHeatstress
3 results
Show changes
File deleted
//#r @"C:\Users\bvenn\source\repos\FSharp.Stats\bin\FSharp.Stats\net47\FSharp.Stats.dll"
//#r @"C:\Users\bvenn\source\repos\FSharp.Stats\bin\FSharp.Stats.MSF\net47\FSharp.Stats.MSF.dll"
//
//#r @"C:\Users\bvenn\source\repos\BioFSharp\bin\BioFSharp\netstandard2.0\BioFSharp.dll"
//#r @"C:\Users\bvenn\source\repos\BioFSharp\bin\BioFSharp.Stats\netstandard2.0\BioFSharp.Stats.dll"
//#r @"C:\Users\bvenn\source\repos\FSharp.Plotly\bin\FSharp.Plotly\netstandard2.0\FSharp.Plotly.dll"
//#r @"C:\Users\bvenn\source\repos\FSharp.Plotly\bin\FSharp.Plotly\netstandard2.0\Newtonsoft.Json.dll"
//#r @"C:\Users\bvenn\source\repos\FSharpAux\bin\FSharpAux\netstandard2.0\FSharpAux.dll"
//#r @"C:\Users\bvenn\source\repos\FSharpAux\bin\FSharpAux.IO\netstandard2.0\FSharpAux.IO.dll"
//#r @"C:\Users\bvenn\source\repos\FSharpGephiStreamer-developer\bin\FSharpGephiStreamer\netstandard2.0\FSharpGephiStreamer.dll"
#r "nuget: TMEA"
#r "nuget: Argu"
open Argu
open FSharp.Stats
//open FSharp.Plotly
open Plotly.NET
open System
open FSharpAux
//open FSharp.Plotly.Axis
open Plotly.NET.LayoutObjects
#time
type Arguments =
| [<Mandatory>][<AltCommandLine("-i")>] InputFolder of string
| [<Mandatory>][<AltCommandLine("-o")>] OutputFolder of string
interface IArgParserTemplate with
member s.Usage =
match s with
| InputFolder _ -> "InputFolder"
| OutputFolder _ -> "OutputFolder"
let parser = ArgumentParser.Create<Arguments>(programName = "RNA_OntologyEnrichment")
let results = parser.Parse(fsi.CommandLineArgs |> Array.skip 1)
let inputFolder = results.GetResult(Arguments.InputFolder)
let outputFolder = results.GetResult(Arguments.OutputFolder)
open StyleParam
let myAxis name = LinearAxis.init(Title=name,Mirror=StyleParam.Mirror.All,Ticks=StyleParam.TickOptions.Inside,ShowGrid=false,ShowLine=true)
let myAxisWODes name = LinearAxis.init(Title=name,Mirror=StyleParam.Mirror.All,Ticks=StyleParam.TickOptions.Inside,ShowGrid=false,ShowLine=true,TickFont=Font.init(StyleParam.FontFamily.Arial,Size=6.))
let myAxisRange name range = LinearAxis.init(Title=name,Range=StyleParam.Range.MinMax(range), Mirror=StyleParam.Mirror.All,Ticks=StyleParam.TickOptions.Inside,ShowGrid=false,ShowLine=true)
let myAxisRangeWODes name range = LinearAxis.init(Title=name,Range=StyleParam.Range.MinMax(range), Mirror=StyleParam.Mirror.All,Ticks=StyleParam.TickOptions.Inside,ShowGrid=false,ShowLine=true,TickFont=Font.init(StyleParam.FontFamily.Arial,Size=6.))
let styleChart x y chart = chart |> Chart.withXAxis (myAxis x) |> Chart.withYAxis (myAxis y)
let styleChartwR x y (min,max) chart = chart |> Chart.withXAxis (myAxisRange x (min,max)) |> Chart.withYAxis (myAxis y)
let getReg (vec:Vector<float>) rep = vec.[0..rep]
Vector.init 2 (fun _ -> 2.)
let getMap path =
System.IO.File.ReadAllLines (path)
|> Array.map (fun x ->
let tmp = x.Split '\t'
tmp.[0],tmp.[1]
)
|> Map.ofArray
let j2mD = getMap (System.IO.Path.Combine(inputFolder,@"mmSnapShot.txt"))
let j2GD = getMap (System.IO.Path.Combine(inputFolder,@"goSnapShot.txt"))
let j2S = getMap (System.IO.Path.Combine(inputFolder,@"SynonymSnapShot.txt"))
let j2L = getMap (System.IO.Path.Combine(inputFolder,@"LocalizationSnapShot.txt"))
let j2GDStr (str :String) =
let str' = (str.Split '.').[0..1] |> String.concat "."
if (str.Split '.').Length > 3 then ""
else
if j2GD.ContainsKey str' then j2GD.[str']
else
printfn "Error!!!%s" str'
""
let j2mDStr (str :String) =
let str' = (str.Split '.').[0..1] |> String.concat "."
if (str.Split '.').Length > 3 then ""
else
if j2mD.ContainsKey str' then j2mD.[str']
else
printfn "Error!!!%s" str'
""
let j2SStr (str :String) =
let str' = (str.Split '.').[0..1] |> String.concat "."
if (str.Split '.').Length > 3 then ""
else
if j2S.ContainsKey str' then j2S.[str']
else
printfn "Error!!!%s" str'
""
let j2LStr (str :String) =
let str' = (str.Split '.').[0..1] |> String.concat "."
if (str.Split '.').Length > 3 then ""
else
if j2L.ContainsKey str' then j2L.[str']
else
printfn "Error!!!%s" str'
""
open BioFSharp.Stats
let (set35,set40) =
System.IO.File.ReadAllLines(System.IO.Path.Combine(inputFolder,@"2020_01_29_DEGs.txt"))
|> Array.tail
|> Array.map (fun x ->
let tmp = x.Split '\t'
let id = tmp.[0]
let anno = j2mDStr id
let create id anno index = OntologyEnrichment.createOntologyItem id anno index id
let s35 = tmp.[1..28] |> Array.chunkBySize 2 |> JaggedArray.transpose |> Seq.head |> Array.map (fun x -> if x = "Down Regulated" then create id anno 1 elif x = "Up Regulated" then create id anno 2 else create id anno 0)
let s40 = tmp.[1..28] |> Array.chunkBySize 2 |> JaggedArray.transpose |> Seq.last |> Array.map (fun x -> if x = "Down Regulated" then create id anno 1 elif x = "Up Regulated" then create id anno 2 else create id anno 0)
s35,s40)
|> Array.unzip
|> fun (x,y) ->
let xs =
JaggedArray.transpose x
|> Array.map (fun t ->
Seq.collect (OntologyEnrichment.splitMultipleAnnotationsBy ';') t
|> OntologyEnrichment.expandOntologyTree
)
let ys =
JaggedArray.transpose y
|> Array.map (fun t ->
Seq.collect (OntologyEnrichment.splitMultipleAnnotationsBy ';') t
|> OntologyEnrichment.expandOntologyTree
)
xs,ys
System.IO.Directory.CreateDirectory(outputFolder)
set40
|> Seq.iteri (fun i x ->
let enriched =
OntologyEnrichment.CalcOverEnrichment 2 None None x
|> Testing.MultipleTesting.benjaminiHochbergFDRBy (fun x -> x,x.PValue)
|> Seq.choose (fun (x,pval) ->
if pval < 0.05 && x.NumberOfDEsInBin > 3 then
Some (sprintf "%s\t%i\t%f" x.OntologyTerm x.NumberOfDEsInBin pval)
else None)
let depleted =
OntologyEnrichment.CalcOverEnrichment 1 None None x
|> Testing.MultipleTesting.benjaminiHochbergFDRBy (fun x -> x,x.PValue)
|> Seq.choose (fun (x,pval) ->
if pval < 0.05 && x.NumberOfDEsInBin > 3 then
Some (sprintf "%s\t%i\t%f" x.OntologyTerm x.NumberOfDEsInBin pval)
else None)
System.IO.File.WriteAllLines(System.IO.Path.Combine(outputFolder, "Rna40Enrichments1vs" + string (i+1)+ "_enr.txt"),enriched)
System.IO.File.WriteAllLines(System.IO.Path.Combine(outputFolder, "Rna40Enrichments1vs" + string (i+1)+ "_dep.txt"),depleted)
)
set35.Length
//Seq.item 0 set35 |> Seq.map (fun x-> x.GroupIndex)
////down = 1
////up = 2
//let print inp co ix =
// let data =
// match inp with
// | "35" -> set35
// | "40" -> set40
// let con =
// match co with
// | "HS" -> [|0..7|]
// | "Re" -> [|8..13|]
// con
// |> Array.map (fun x-> data.[x])
// |> Array.map Array.ofSeq
// |> JaggedArray.transpose
// |> Array.map (fun x ->
// let pos = x |> Array.filter (fun t -> t.GroupIndex = ix) |> fun k -> k.Length >= 2
// if pos then {x.[0] with GroupIndex = ix}
// else {x.[0] with GroupIndex = 0})
// |> OntologyEnrichment.CalcOverEnrichment ix None None
// |> Testing.MultipleTesting.benjaminiHochbergFDRBy (fun x -> x,x.PValue)
// |> Seq.choose (fun (x,pval) ->
// if pval < 0.05 && x.NumberOfDEsInBin > 3 then
// Some (sprintf "%s\t%i\t%f" x.OntologyTerm x.NumberOfDEsInBin pval)
// else None)
// |> Seq.iter (printfn "%s")
//print "35" "HS" 1
//print "35" "HS" 2
//print "35" "Re" 1
//print "35" "Re" 2
//print "40" "HS" 1
//print "40" "HS" 2
//print "40" "Re" 1
//print "40" "Re" 2
cwlVersion: v1.2
class: CommandLineTool
hints:
DockerRequirement:
dockerPull: mcr.microsoft.com/dotnet/sdk:6.0
requirements:
- class: InitialWorkDirRequirement
listing:
- entryname: RNA_OntologyEnrichment.fsx
entry:
$include: RNA_OntologyEnrichment.fsx
- class: EnvVarRequirement
envDef:
- envName: DOTNET_NOLOGO
envValue: "true"
- class: NetworkAccess
networkAccess: true
baseCommand: [dotnet, fsi, RNA_OntologyEnrichment.fsx]
arguments: [-o, $(outputFolder)]
inputs:
inputFolder:
type: Directory
inputBinding:
prefix: -i
outputs:
outputFolder:
type: Directory
outputBinding:
glob: $(outputFolder)/*.*
arc:has technology type:
- class: arc:technology type
arc:annotation value: "Docker Container"
arc:technology platform: ".NET"
arc:performer:
- class: arc:Person
arc:first name: "Benedikt"
arc:last name: "Venn"
arc:email: "venn@bio.uni-kl.de "
arc:affiliation: "RPTU Kaiserslautern/Landau"
arc:has role:
- class: arc:role
arc:term accession: "https://credit.niso.org/contributor-roles/formal-analysis/"
arc:annotation value: "Formal analysis"
$namespaces:
arc: https://github.com/nfdi4plants/ARC_ontology
$schemas:
- https://raw.githubusercontent.com/nfdi4plants/ARC_ontology/main/ARC_v2.0.owl