Commit 4d269168 authored by Laure QUINTRIC's avatar Laure QUINTRIC

handle couples

parent 80173300
......@@ -86,8 +86,8 @@ 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_(.)+fastq.gz")
patternClassique = re.compile("(.)+R1.fastq.gz")
patternGenoscope = re.compile("(.)+_[1-9]_[1-2]_(.)+fastq.gz")
patternClassique = re.compile("(.)+R[1-2].fastq.gz")
counter=0
for rf in readsfiles :
if rf not in treated :
......@@ -96,13 +96,20 @@ if __name__ == '__main__':
if patternGenoscope.match(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 patternClassique.match(rf):
R2 = rf.replace('R1', 'R2')
if "R2" in rf :
R2 = rf
R1 = rf.replace('R1', 'R2')
else :
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