Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating #119

Merged
merged 10 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added ngs_id_script.py and template dataset
  • Loading branch information
Jgergely11 authored and HadleyKing committed Oct 16, 2022
commit ae255472f76a8f25d5eda0a28ea7103d6059452f
26 changes: 13 additions & 13 deletions lib/ngs_id_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
pd.options.mode.chained_assignment = None # removes warning message from overwriting --- I think

#Read through HIVE Lab ngs_QC and pull out relevant data
with open("c:/users/jgerg/data.argosdb/home/template_ngsQC_HL.tsv", 'r') as inFile1:
with open("c:/users/jgerg/data.argosdb/data_files/template_ngsQC_HL.tsv", 'r') as inFile1:
tsvreader = csv.reader(inFile1, delimiter="\t")
with open('trimmed_HL.tsv', 'w', newline='') as outFile:
with open('c:/users/jgerg/data.argosdb/home/trimmed_HL.tsv', 'w', newline='') as outFile:
tsvwriter = csv.writer(outFile, delimiter="\t")
#remove headers from ngs_QC file
headings=next(tsvreader)
Expand All @@ -20,55 +20,55 @@
### For example the different SARS variants - none of them have genome assembly ids - maybe also removing duplicate SRRs will suffice
###
###
data_hl = pd.read_table('trimmed_HL.tsv', sep='\t')
data_hl = pd.read_table('c:/users/jgerg/data.argosdb/home/trimmed_HL.tsv', sep='\t')
df_hl = data_hl
df_hl=df_hl[df_hl['genome_assembly_id'].isnull() | ~df_hl[df_hl['genome_assembly_id'].notnull()].duplicated(subset='genome_assembly_id',keep='first')]
df_hl.lab_name = 'Hive Lab'
df_hl.files_processed = 'ngsQC_HL'

###Will print tsv for unique genome assemly ids for HIVE Lab
#df_hl.to_csv('trimmed_HL.tsv', sep = '\t', index = False)
df_hl.to_csv('c:/users/jgerg/data.argosdb/home/trimmed_HL.tsv', sep = '\t', index = False)

#Repeat for Pond Lab
with open("c:/users/jgerg/data.argosdb/home/template_ngsQC_Pond.tsv", 'r') as inFile2:
with open("c:/users/jgerg/data.argosdb/data_files/template_ngsQC_Pond.tsv", 'r') as inFile2:
tsvreader = csv.reader(inFile2, delimiter="\t")
with open('trimmed_Pond.tsv', 'w', newline='') as outFile:
with open('c:/users/jgerg/data.argosdb/home/trimmed_Pond.tsv', 'w', newline='') as outFile:
tsvwriter = csv.writer(outFile, delimiter="\t")
#remove headers from ngs_QC file
headings=next(tsvreader)
#append headers for ngs_id
tsvwriter.writerow(['organism_name', 'leaf_node', 'genome_assembly_id', 'taxonomy_id', 'bioproject','sra_run_id','ref_org','selection_notes','lab_name','files_processed'])
for row in tsvreader:
tsvwriter.writerow([row[0],row[1],row[2],row[3],row[9],row[11]])
data_p = pd.read_table('trimmed_Pond.tsv', sep='\t')
data_p = pd.read_table('c:/users/jgerg/data.argosdb/home/trimmed_Pond.tsv', sep='\t')
df_p = data_p
df_p=df_p[df_p['genome_assembly_id'].isnull() | ~df_p[df_p['genome_assembly_id'].notnull()].duplicated(subset='genome_assembly_id',keep='first')]
df_p.lab_name = 'Pond Lab'
df_p.files_processed = 'ngsQC_Pond'

###Will print tsv for unique genome assemly ids for Pond Lab
#df_p.to_csv('trimmed_Pond.tsv', sep = '\t', index = False)
df_p.to_csv('c:/users/jgerg/data.argosdb/home/trimmed_Pond.tsv', sep = '\t', index = False)


#Repeat for Crandall Lab
with open("c:/users/jgerg/data.argosdb/home/template_ngsQC_Crandall.tsv", 'r') as inFile3:
with open("c:/users/jgerg/data.argosdb/data_files/template_ngsQC_Crandall.tsv", 'r') as inFile3:
tsvreader = csv.reader(inFile3, delimiter="\t")
with open('trimmed_Crandall.tsv', 'w', newline='') as outFile:
with open('c:/users/jgerg/data.argosdb/home/trimmed_Crandall.tsv', 'w', newline='') as outFile:
tsvwriter = csv.writer(outFile, delimiter="\t")
#remove headers from ngs_QC file
headings=next(tsvreader)
#append headers for ngs_id
tsvwriter.writerow(['organism_name', 'leaf_node', 'genome_assembly_id', 'taxonomy_id', 'bioproject','sra_run_id','ref_org','selection_notes','lab_name','files_processed'])
for row in tsvreader:
tsvwriter.writerow([row[0],row[1],row[2],row[3],row[9],row[11]])
data_c = pd.read_table('trimmed_Crandall.tsv', sep='\t')
data_c = pd.read_table('c:/users/jgerg/data.argosdb/home/trimmed_Crandall.tsv', sep='\t')
df_c = data_c
df_c=df_c[df_c['genome_assembly_id'].isnull() | ~df_c[df_c['genome_assembly_id'].notnull()].duplicated(subset='genome_assembly_id',keep='first')]
df_c.lab_name = 'Crandall Lab'
df_c.files_processed = 'ngsQC_Crandall'

###Will print tsv for unique genome assemly ids for HIVE Lab
#df_c.to_csv('trimmed_Crandall.tsv', sep = '\t', index = False)
df_c.to_csv('c:/users/jgerg/data.argosdb/home/trimmed_Crandall.tsv', sep = '\t', index = False)



Expand Down Expand Up @@ -104,4 +104,4 @@ def selection_notes(row):
dfinal=dfinal.assign(selection_notes=dfinal.apply(selection_notes, axis=1))
dfinal=dfinal.drop('bioproject', axis=1)
dfinal=dfinal[dfinal['genome_assembly_id'].isnull() | ~dfinal[dfinal['genome_assembly_id'].notnull()].duplicated(subset='genome_assembly_id',keep='first')]
dfinal.to_csv('c:/users/jgerg/data.argosdb/home/test_ngs_id_list.tsv', sep = '\t', index = False)
dfinal.to_csv('c:/users/jgerg/data.argosdb/data_files/test_ngs_id_list.tsv', sep = '\t', index = False)
126 changes: 0 additions & 126 deletions lib/trimmed_Crandall.tsv

This file was deleted.

Loading