mirror of
http://43.156.76.180:8026/YuuMJ/EukPhylo.git
synced 2025-12-27 07:50:25 +08:00
Update Trim_Reads.py
This commit is contained in:
parent
ef6b633de7
commit
d33ac6c2c3
@ -37,27 +37,35 @@ else:
|
|||||||
if not os.path.isdir('ToAssemble/'):
|
if not os.path.isdir('ToAssemble/'):
|
||||||
os.system('mkdir ToAssemble')
|
os.system('mkdir ToAssemble')
|
||||||
|
|
||||||
### takes your downloaded data and renames the file so that it has taxonomic information in the filename
|
### takes your raw read data and renames the files with your assigned new names and alters the end to either FwdPE or RevPE
|
||||||
def rename(code):
|
def rename(code):
|
||||||
for filename in os.listdir(os.curdir):
|
for filename in os.listdir(os.curdir):
|
||||||
if filename.endswith('.fastq.gz'):
|
if filename.endswith('.fastq.gz'):
|
||||||
### check name code here for forward reads
|
# Forward read patterns
|
||||||
if '_FwdPE' in filename or '_R1' in filename:
|
forward_tags = ['_FwdPE', '_R1', '_FPE']
|
||||||
cur_name = filename.split('_FwdPE')[0] if '_FwdPE' in filename else filename.split('_R1')[0]
|
if any(tag in filename for tag in forward_tags):
|
||||||
|
for tag in forward_tags:
|
||||||
|
if tag in filename:
|
||||||
|
cur_name = filename.split(tag)[0]
|
||||||
|
break
|
||||||
if cur_name in code:
|
if cur_name in code:
|
||||||
new_name = code[cur_name]
|
new_name = code[cur_name]
|
||||||
print(cur_name, new_name)
|
print(cur_name, new_name)
|
||||||
os.system(f'mv {filename} {new_name}_FwdPE.fastq.gz')
|
os.system(f'mv {filename} {new_name}_FwdPE.fastq.gz')
|
||||||
os.system(f'mkdir -p {new_name}')
|
os.system(f'mkdir -p {new_name}')
|
||||||
### check name code here for reverse reads
|
|
||||||
elif '_RevPE' in filename or '_R2' in filename:
|
# Reverse read patterns
|
||||||
cur_name = filename.split('_RevPE')[0] if '_RevPE' in filename else filename.split('_R2')[0]
|
reverse_tags = ['_RevPE', '_R2', '_RPE']
|
||||||
|
if any(tag in filename for tag in reverse_tags):
|
||||||
|
for tag in reverse_tags:
|
||||||
|
if tag in filename:
|
||||||
|
cur_name = filename.split(tag)[0]
|
||||||
|
break
|
||||||
if cur_name in code:
|
if cur_name in code:
|
||||||
new_name = code[cur_name]
|
new_name = code[cur_name]
|
||||||
print(cur_name, new_name)
|
print(cur_name, new_name)
|
||||||
os.system(f'mv {filename} {new_name}_RevPE.fastq.gz')
|
os.system(f'mv {filename} {new_name}_RevPE.fastq.gz')
|
||||||
|
|
||||||
|
|
||||||
### Uses the adapters.fa file in the bbtools resources folder (and BBDuK) to remove adapter sequences -- update if necessary
|
### Uses the adapters.fa file in the bbtools resources folder (and BBDuK) to remove adapter sequences -- update if necessary
|
||||||
### Uses BBDuK to quality trim reads so the average is q24 and the min length is 100 -- adjust if needed ... flags will be added eventually
|
### Uses BBDuK to quality trim reads so the average is q24 and the min length is 100 -- adjust if needed ... flags will be added eventually
|
||||||
def QualityTrim(qtrim, minlen):
|
def QualityTrim(qtrim, minlen):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user