Commit d397d07b authored by Laure QUINTRIC's avatar Laure QUINTRIC

handle couples

parent 4d269168
......@@ -86,29 +86,31 @@ if __name__ == '__main__':
# Keep only fastq files type
readsfiles=[reads for reads in readsfiles if "fastq.gz" in reads]
treated=[]
patternGenoscope = re.compile("(.)+_[1-9]_[1-2]_(.)+fastq.gz")
patternGenoscope1 = re.compile("(.)+_[1-9]_[1]_(.)+fastq.gz")
patternGenoscope2 = re.compile("(.)+_[1-9]_[2]_(.)+fastq.gz")
patternClassique = re.compile("(.)+R[1-2].fastq.gz")
counter=0
for rf in readsfiles :
if rf not in treated :
counter=counter+1
R1 = rf
if patternGenoscope.match(rf):
if patternGenoscope1.match(rf):
R1 = rf
if '_1_1_' in str(rf):
R2 = rf.replace('_1_1_', '_1_2_')
elif '_1_2_' in str(rf) :
R2 = rf
R1 = rf.replace('_1_2_', '_1_1_')
elif '_1_' in str(rf) :
R2 = rf.replace('_1_', '_2_')
else :
logger.debug("No pair found for sample {}, exiting program...".format(R1))
sys.exit(1)
elif patternGenoscope2.match(rf):
R2 = rf
if '_2_2_' in str(rf):
R1 = rf.replace('_2_2_', '_2_1_')
elif '_2_' in str(rf) :
R1 = rf.replace('_2_', '_1_')
elif patternClassique.match(rf):
if "R2" in rf :
R2 = rf
R1 = rf.replace('R1', 'R2')
else :
R1 = rf
R2 = rf.replace('R1', 'R2')
else :
logger.debug("File {} does not match patterns .R[1-2].fastq.gz or _[1-9]_[1-2]XXX.fastq.gz".format(rf))
......
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