Commit 0d89f00c authored by Eric CHARPENTIER's avatar Eric CHARPENTIER 🐍
Browse files

updated config2inputs

parent 03ae2b8b
......@@ -22,7 +22,7 @@ else:
for s in d["samples"]:
args.samplesheet.write(s["well"]+"\t"+s["index"]+"\t"+s["name"]+"\t"+s["project"]+"\t"+s["condition"]+"\t"+s["species"])
if (s["factor"] is not None):
if ("factor" in s):
args.samplesheet.write("\t"+s["factor"])
args.samplesheet.write("\n")
......
......@@ -51,6 +51,7 @@ parser.add_argument('-w', '--workdir', metavar='DIR', help='Analysis working dir
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('-i', '--illumina-dir', metavar='DIR', help='Directory containing the fastq input files generated by Illumina. The fastq files should be in paired-end mode. If your fastq files are not coming from an Illumina sequencer, please use option -f to specify a file listing the fastq input files. (REQUIRED if no "-f")', dest='illuminadir')
group.add_argument('-f', '--fastq-file', metavar='FILE', help='File describing the fastq input file. This file should be tab delimited. First column: full path of Forward file; second column: full path of Reverse file. The fastq files should be in paired-end mode. If your fastq files were generated by an Illumina sequencer, you can use option "-i" to specify the directory containing the fastq input files. (REQUIRED if no "-i")', type=argparse.FileType('rt'), dest='fastqfile')
group.add_argument('-a', '--reanalyze',action='store_true', help='Flag to indicate that this run will be a re-analysis which needs the already demultiplexed fastq files (one per sample)', dest='reanalyze')
parser.add_argument('-r', '--reference-dir', metavar='DIR', help='Directory containing the reference files. It is recommended that you use this option if you have already used this pipeline and downloaded genome files.', dest='referencedir')
parser.add_argument('-c', '--conditions', metavar='FILE', help='Tab delimited file with no headers indicating which conditions to compare during differential expression analysis. Columns must be "project condition1 condition2". If not specified, only primary analysis will be performed', type=argparse.FileType('rt'), required=False, dest='conditions')
parser.add_argument('--minGenes', metavar='N', type=int, help='Minimum genes detected necessary for a sample to pass the filtering step in secondary analysis. (Default 5000)', default=5000, required=False, dest='minGenes')
......@@ -231,13 +232,7 @@ for project in d["comparisons"]:
# Write fastq input files
d["fastq_pairs"] = list()
if((args.illuminadir is None) and (args.fastqfile is None)):
eprint("ERROR make_srp_config.py: ","You must specify EITHER an illumina directory containing fastq input files with option \"-i\" or a file describing your fastq input files with option \"-f\"")
sys.exit()
elif((args.illuminadir is not None) and (args.fastqfile is not None)):
eprint("ERROR make_srp_config.py: ","You must specify EITHER an illumina directory containing fastq input files with option \"-i\" OR a file describing your fastq input files with option \"-f\", not both")
sys.exit()
elif((args.illuminadir is None) and (args.fastqfile is not None)):
if((args.illuminadir is None) and (args.fastqfile is not None)):
count = 0
try:
for f,r in csv.reader(args.fastqfile, delimiter='\t'):
......@@ -260,6 +255,11 @@ elif((args.illuminadir is not None) and (args.fastqfile is None)):
fastqRfile = os.path.join(args.illuminadir, s.group(1) + "_R2_" + s.group(2))
if(os.path.isfile(fastqRfile)):
d["fastq_pairs"].append(OrderedDict([("read1",os.path.abspath(fastqFfile)), ("read2",os.path.abspath(fastqRfile))]))
elif(args.reanalyze is not None):
d["reanalysis"] = True
else:
eprint("ERROR make_srp_config.py: ","Invalid argument, neither i,f and a defined.")
sys.exit()
# Verify that genome can be downloaded if it does not exist
genomes = set()
......
......@@ -24,7 +24,8 @@ def getSplitFastqOutputs():
files = list()
for s in config["samples"]:
files.append(os.path.join(MAINDIR,s["project"],config["fastq_folder"],s["name"]+".fastq"))
files.append(MAINDIR+"/unknown.fastq")
if("reanalysis" not in config or not config["reanalysis"]):
files.append(MAINDIR+"/unknown.fastq")
return files
SPLITFASTQFILES = getSplitFastqOutputs()
......@@ -117,9 +118,10 @@ def getTargetFiles():
targets.append(os.path.join(MAINDIR,project,config["de_folder"],"exprDatUPM.tsv"))
# Targets for whole run
targets.append(MAINDIR+"/"+config["multiqc_folder"]+"/multiqc_report.html")
targets.extend(expand(os.path.join(MAINDIR,config["expression_folder"],"run.{exp}.well_summary.pdf"),exp=["unq","all"]))
targets.append(MAINDIR+"/config_used_in_analysis.json")
if("reanalysis" not in config or not config["reanalysis"]):
targets.append(MAINDIR+"/"+config["multiqc_folder"]+"/multiqc_report.html")
targets.extend(expand(os.path.join(MAINDIR,config["expression_folder"],"run.{exp}.well_summary.pdf"),exp=["unq","all"]))
targets.append(MAINDIR+"/config_used_in_analysis.json")
return targets
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment