Skip to content

Commit 8dd3a03

Browse files
committed
Added a "solexa" switch.
1 parent 45f51d1 commit 8dd3a03

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

4Pipe4.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@
6363
extraction\n\t2 - SeqClean\n\t3 - Mira\n\t4 - DiscoveryTCS\n\t5 - \
6464
SNP grabber\n\t6 - ORF finder\n\t7 - Blast2go\n\t8 - SSR finder\n\t9 - 7zip \
6565
the report")
66+
parser.add_argument("-d", dest="datatype", nargs=1, help="Declare the type of \
67+
data being used. Currentlly suported are 454 (454) and Illumina (solexa). \
68+
Default is 454.", required=False, metavar="454/solexa", default="454")
69+
parser.add_argument("-p", dest="paired", nargs="?", default=False, type=bool,
70+
help="Is the data paired end? True/False, default is \
71+
False.", required=False, metavar="True/False")
6672
arg = parser.parse_args()
6773

6874

@@ -80,8 +86,28 @@ def loading(current_state, size, prefix, width):
8086

8187

8288
def StartUp():
89+
"""
90+
Make some basic checks regarding user input.
91+
"""
8392
basefile = os.path.abspath("".join(arg.outfile))
84-
sff = os.path.abspath("".join(arg.infile))
93+
input_file = os.path.abspath("".join(arg.infile))
94+
95+
# Solexa checks
96+
if arg.datafile == "solexa":
97+
if "1" in arg.run_list or "2" in arg.run_list:
98+
quit("Please skip steps 1 and 2 for illumina data. They are not required.")
99+
if arg.infile.endswith("fastq") is False or arg.infile.endswith("fasq.gz") is False:
100+
quit("Infile must be in 'fastq' format for illumina data.")
101+
if os.path.isfile(basefile + ".fastq"):
102+
if basefile + ".fastq" == input_file:
103+
pass
104+
else:
105+
quit(basefile + " already exists. Please deal with it before \
106+
proceeding.")
107+
else:
108+
os.symlink(input_file, outfile + ".fastq")
109+
110+
85111
if arg.configFile is not None:
86112
rcfile = os.path.abspath("".join(arg.configFile))
87113
elif os.path.isfile('4Pipe4rc'):
@@ -101,7 +127,7 @@ def StartUp():
101127
except:
102128
print("\nERROR: Invalid configuration file\n")
103129
quit("Please run 4Pipe4.py -h for help with running the pipeline.")
104-
return basefile, sff, config
130+
return basefile, input_file, config
105131

106132

107133
def SysPrep(basefile):
@@ -205,7 +231,10 @@ def MiraRun(basefile):
205231
manifest.write(config.get('Mira Parameters', 'mira454') + "\n\n")
206232
manifest.write(config.get('Mira Parameters', 'mirareadgroup') + "\n")
207233
manifest.write(config.get('Mira Parameters', 'miratech') + "\n")
208-
manifest.write("data = " + basename + ".clean.fasta\n")
234+
if arg.datatype == "solexa":
235+
manifest.write("data = " + basename + ".fastq\n")
236+
else:
237+
manifest.write("data = " + basename + ".clean.fasta\n")
209238
manifest.close()
210239

211240
# Run mira
@@ -280,6 +309,7 @@ def ORFliner(basefile):
280309
print("\nRunning NCBI 'blastx' using the following command:")
281310
print(' '.join(cli))
282311
RunProgram(cli, 0)
312+
283313
# Then we write the metrics report:
284314
print("\nRunning the metrics calculator module...")
285315
seqclean_log_path = "%s/seqcl_%s.fasta.log" % (os.path.split(basefile)[0],

0 commit comments

Comments
 (0)