Mageck Pscript demo.pdf

From Array Suite Wiki

Jump to: navigation, search


Contents

Overview

This wiki page will introduce the users to implement Mageck package into PScript, specify the input files in GUI, and run the job on ArrayServer.

Pre-requirement, MAGECK has been properly installed on the Linux OS with the ArrayServer. MAGECK Link

Mageck installed.png

Write PScript and load it to the server

the PScript

<Info>
Label= Call Mageck from PScript DEMO2 Design 0418
Description=PS to Call Mageck with fastqs, DEMO2 Design
Category=NGS\Mageck_test
 
 
<Input>
ExternalScriptInputType=Files
ExternalScriptMenuText= Mageck Demo2 Design 0418
ExternalScriptMenuStructure=NGS\Mageck_test
ExternalScriptFileFilter=TXT files|*.fastq|*.gz|*.txt|*.sh
 
 
@PairedSamples@=False
~@PairedSamples@=Data is paired. Options are True or False (False by default)
~@PairedSamples@Levels=True,False
~@PairedSamples@ExclusiveLevels=True
 
 
@ThreadNumberPerJob@=4
~@ThreadNumberPerJob@=Number of threads to run for each of the steps.
~@ThreadNumerPerJob@Levels=1,2,3,4,5,6,7,8
~@ThreadNumberPerJob@ExclusiveLevels=True
 
 
@ParallelJobNumber@=8
~@ParallelJobNumber@=Number of parallel jobs to run for each of the steps
 
@Gzip@=Gzip
~@Gzip@=Set to Gzip if input files are gzipped or None
~@Gzip@Levels=Gzip,None
~@Gzip@ExclusiveLevels=True
 
 
//Sample ID Mapping FileName
@DesignFile@=
~@DesignFile@=DesignFile for lables and fastqs
~@DesignFile@Type=FileName
 
 
@LibraryFileName@=
~@LibraryFileName@=Specify the Library txt file
 
~@LibraryFileName@Type=FileName
 
 
#@OutputFolderName@=
#~@OutputFolderName@Type=FilePath
#~@OutputFolderName@=Output folder for count table txt files
 
 
@InputFolderName@=
~@InputFolderName@Type=FilePath
~@InputFolderName@=Input folder for library txt and fastq files
 
@Prefix@=
~@Prefix@Type=String
 
@Treatment@=
~@Treatment@Type=String
 
@Control@=
~@Control@Type=String
 
<Script>
//Call mageck section
Begin RunEScript /RunonServer=True;
Files
"@FileNames@";
#"@DesignFile@"
EScriptName MageckDemo3;
Command cd "@InputFolderName@";
Command pwd;
Command SampleFiles="$(cat @DesignFile@ | awk '(NR>1) {print$1}'| paste -s | sed 's/\t/ /g')";
Command echo $SampleFiles;
Command SampleLabels="$(cat @DesignFile@ | awk '(NR>1) {print$2}'| paste -s | sed 's/\t/,/g')";
Command echo $SampleLabels;
Command mageck count -l "@LibraryFileName@" -n @Prefix@ --sample-label $SampleLabels --fastq $SampleFiles;
Command mkdir output;
Command mv @Prefix@* output/;
Options /ParallelJobNumber=1 /ThreadNumberPerJob=1 /ErrorOnStdErr=False;
End;
 
Begin SaveProject;
End;
 
 
//Call mageck section
Begin RunEScript /RunonServer=True;
Files
"@FileNames@";
EScriptName MageckDemo22;
Command mageck "test" -k "@InputFolderName@/output/@Prefix@.count.txt" -t @Treatment@ -c @Control@ -n @Prefix@;
Options /ParallelJobNumber=1 /ThreadNumberPerJob=8 /ErrorOnStdErr=False;
End;
 
Begin SaveProject;
End;
 
 
 
//import demo.sgrna_summary.txt table to server project;
Begin ImportTable /Namespace=Table /RunOnServer=True;
#Project 0406_Mageck_test;
File "@InputFolderName@/output/@Prefix@.count.txt";
Output @Prefix@.count;
Options  /Format=Txt;
End;
 
//import demo.sgrna_summary.txt table to server project;
Begin ImportTable /Namespace=Table /RunOnServer=True;
#Project 0406_Mageck_test;
File "@InputFolderName@/output/@Prefix@.count_normalized.txt";
Output @Prefix@.count_normalized;
Options  /Format=Txt;
End;
 
 
Begin SaveProject;
End;

Load Pscript to ArrayServer

Save the pscript txt file as a *.pscript file. Go to ArrayStudio -> Server -> Manage -> Manage Server Scripts

ManageServerScript.png

In the Manage Server Scripts window, click Add, and then choose Load from file:

AddPscriptFromFile.png

Go to Analysis -> Scripts, click Update Scripts, and then the newly added PScript will be available under the corresponding drop down menu.

UpdateScripts.png

Run Mageck with Pipeline Script

Run Mageck Pscript from GUI

In the Mageck Demo2 Design 0418 window, users could load fastq files, indicate DesignFile/LibraryFile/InputFolder, and set Prefix for all output files:

RunMageckPscript.png

Click Send To Queue, the job will run on the Server. Within this demo PScript, two Mageck commands would be submitted to the server, mageck count and mageck test

Output from Mageck Pscript

The output tables could be loaded into ArrayStudio project automatically.

Output mageck pscript.png

Put more OScript sections to the PScript, then more tables would be loaded into the current ArrayStudio project.