4747 help = "Provide the full path to your target input file\n " ,
4848 metavar = "input_file" )
4949group .add_argument ("-p" , dest = "infile" , nargs = 2 , required = False ,
50- help = "Provide the full path to your target input pair files\n " ,
50+ help = "Provide the full path to your target input pair \
51+ files. Currentlly only woring for solexa data type.\n " ,
5152 metavar = "input_pair" )
5253
5354parser .add_argument ("-o" , dest = "outfile" , nargs = 1 , required = True ,
@@ -96,22 +97,23 @@ def StartUp():
9697 Make some basic checks regarding user input.
9798 """
9899 basefile = os .path .abspath ("" .join (arg .outfile ))
99- input_file = os .path .abspath ("" .join (arg .infile ))
100+ input_file = [ os .path .abspath ("" .join (x )) for x in arg .infile ]
100101
101102 # Solexa checks
102103 if arg .datatype == "solexa" :
103104 if "1" in arg .run_list or "2" in arg .run_list :
104105 quit ("Please skip steps 1 and 2 for illumina data. They are not required." )
105- if arg .infile .endswith ("fastq" ) is False or arg .infile .endswith ("fastq.gz" ) is False :
106- quit ("Infile must be in 'fastq' format for illumina data." )
107- if os .path .isfile (basefile + ".fastq" ):
108- if basefile + ".fastq" == input_file :
109- pass
106+ for inputs in input_file :
107+ if inputs .endswith (("fastq" , "fastq.gz" )) is False :
108+ quit ("Infile must be in 'fastq' format for illumina data." )
109+ if os .path .isfile (basefile + ".fastq" ):
110+ if basefile + ".fastq" == inputs :
111+ pass
112+ else :
113+ quit (basefile + " already exists. Please deal with it \
114+ before proceeding." )
110115 else :
111- quit (basefile + " already exists. Please deal with it before \
112- proceeding." )
113- else :
114- os .symlink (input_file , arg .outfile + ".fastq" )
116+ os .symlink (inputs , arg .outfile + ".fastq" )
115117
116118
117119 if arg .configFile is not None :
@@ -171,8 +173,10 @@ def RunProgram(cli, requires_output):
171173
172174
173175def SffExtraction (sff , basefile ):
174- '''Function for using the sff_extractor module. It will look for an "ideal"
175- clipping value using multiple runs before outputting the final files.'''
176+ """
177+ Function for using the sff_extractor module. It will look for an "ideal"
178+ clipping value using multiple runs before outputting the final files.
179+ """
176180 clip_found = 0
177181
178182 # Sff_extractor parameters:
@@ -192,7 +196,7 @@ def SffExtraction(sff, basefile):
192196 sff_config ["seq_fname" ] = basefile + ".fasta"
193197
194198 while clip_found < 2 :
195- extra_clip = sff_extractor .extract_reads_from_sff (sff_config , [ sff ])
199+ extra_clip = sff_extractor .extract_reads_from_sff (sff_config , sff [ 0 ])
196200 sff_config ["min_leftclip" ] += extra_clip
197201 if extra_clip == 0 :
198202 clip_found += 1
@@ -227,20 +231,31 @@ def SeqClean(basefile):
227231
228232
229233def MiraRun (basefile ):
230- '''Assemble the sequences and write the menifest file'''
234+ """
235+ Write the manifest file and assemble the sequences.
236+ """
231237 basename = os .path .basename (basefile )
232238 manifest = open (basefile + ".manifest" , 'w' )
233239 manifest .write ("project = " + basename + "\n " )
234240 manifest .write (config .get ('Mira Parameters' , 'mirajob' ) + "\n " )
235241 manifest .write (config .get ('Mira Parameters' , 'miracommon' ) + " -GE:not="
236242 + config .get ('Variables' , 'seqcores' ) + " \\ \n " )
237- manifest .write (config .get ('Mira Parameters' , 'mira454' ) + "\n \n " )
243+ if arg .datatype == "454" :
244+ manifest .write (config .get ('Mira Parameters' , 'mira454' ) + "\n \n " )
245+ elif arg .datatype == "solexa" :
246+ manifest .write (config .get ('Mira Parameters' , 'mirasolexa' ) + "\n \n " )
238247 manifest .write (config .get ('Mira Parameters' , 'mirareadgroup' ) + "\n " )
248+ if len (arg .infile ) == 2 :
249+ manifest .write ("autopairing\n " )
239250 manifest .write (config .get ('Mira Parameters' , 'miratech' ) + "\n " )
240- if arg .datatype == "solexa" :
241- manifest .write ("data = " + basename + ".fastq\n " )
242- else :
251+ if arg .datatype == "454" :
243252 manifest .write ("data = " + basename + ".clean.fasta\n " )
253+ elif arg .datatype == "solexa" :
254+ if len (arg .infile ) == 1 :
255+ manifest .write ("data = " + os .path .abspath (arg .infile [0 ]) + "\n " )
256+ else :
257+ manifest .write ("data = " + os .path .abspath (arg .infile [0 ]) + " " +
258+ os .path .abspath (arg .infile [1 ]) + "\n " )
244259 manifest .close ()
245260
246261 # Run mira
@@ -458,5 +473,4 @@ def RunMe(arguments):
458473
459474basefile , sff , config = StartUp ()
460475miraproject = SysPrep (basefile )
461- print (arg .infile )
462476RunMe (arg .run_list )
0 commit comments