...
 
Commits (3)
......@@ -79,10 +79,15 @@ def fetch_attribute(args):
bio_samples_attributes = {k: v for k, v in
sorted(bio_samples_attributes.items(), key=lambda item: item[1]["cpt"], reverse=True)}
with open("bio_samples_attributes.csv", 'w') as bio_samples_attributes_txt:
bio_samples_attributes_txt.write("Attribute\tFilledCount\tExample1\tExample2\tExample3\tExample4\tExample5")
csv_writer = csv.writer(bio_samples_attributes_txt, delimiter=args.delimiter)
csv_writer.writerow([
"Attribute",
"NbEntriesWhereAttributeIsFilled",
"PercentageEntriesWhereAttributeIsFilled",
])
for k, v in bio_samples_attributes.items():
v["values"] = list(v["values"])
bio_samples_attributes_txt.write("%s\t%i\t%s\n" % (k, v["cpt"], "\t".join(v["values"][:5])))
csv_writer.writerow([k, v["cpt"], 1.0 * v["cpt"] / len(strains)])
with open("bio_samples_attributes_raw.json", 'w') as output_json:
output_json.write(json.dumps(bio_samples_attributes_raw, indent=4))
......
Attribute NbEntriesWhereAttributeIsFilled PercentageEntriesWhereAttributeIsFilled
collection_date 7943 0.9610405323653962
strain 7853 0.950151240169389
geo_loc_name 7593 0.9186932849364792
host 7495 0.9068360556563824
isolation_source 7071 0.855535390199637
sample_name 3622 0.4382335148215366
lat_lon 3518 0.42565033272837266
Alias 3431 0.415124016938899
INSDC center name 3428 0.4147610405323654
INSDC first public 3428 0.4147610405323654
INSDC last update 3428 0.4147610405323654
INSDC status 3428 0.4147610405323654
SRA accession 3428 0.4147610405323654
Title 3428 0.4147610405323654
ENA checklist 3427 0.4146400483968542
collected_by 3267 0.3952813067150635
host_health_state 3164 0.38281911675741076
INSDC center alias 3158 0.3820931639443436
host_disease 3007 0.36382335148215367
supplier_name 2990 0.3617664851784634
anonymized_name 2708 0.3276467029643073
serovar 2578 0.3119177253478524
sample_type 1084 0.13115547489413187
sub_species 800 0.09679370840895342
isolate 730 0.08832425892316999
host_sex 625 0.07562008469449485
host_age 585 0.07078039927404718
genotype 498 0.0602540834845735
culture_collection 419 0.05069570477918935
host_disease_outcome 342 0.041379310344827586
env_broad_scale 333 0.040290381125226864
env_medium 328 0.0396854204476709
env_local_scale 325 0.03932244404113733
isol_growth_condt 310 0.03750756200846945
num_replicons 310 0.03750756200846945
host_tissue_sampled 304 0.0367816091954023
host_description 292 0.035329703569268
host_disease_stage 264 0.031941923774954625
serotype 264 0.031941923774954625
SUBJECT_ID 261 0.031578947368421054
pathotype 253 0.030611010284331518
ref_biomaterial 248 0.03000604960677556
passage_history 242 0.02928009679370841
host_subject_id 241 0.029159104658197217
subtype 239 0.028917120387174835
specimen_voucher 238 0.028796128251663642
subgroup 237 0.02867513611615245
description 231 0.0279491833030853
project_name 216 0.026134301270417423
estimated_size 71 0.008590441621294615
propagation 65 0.007864488808227465
ploidy 65 0.007864488808227465
geographic location (latitude) 62 0.00750151240169389
geographic location (longitude) 62 0.00750151240169389
sample_number 50 0.006049606775559589
panel_id 48 0.005807622504537205
Bar Code No 42 0.005081669691470054
note 33 0.003992740471869328
relative_week 33 0.003992740471869328
collection_room 33 0.003992740471869328
locus_tag_prefix 32 0.0038717483363581366
environmental_sample 32 0.0038717483363581366
geographic location (region and locality) 30 0.003629764065335753
investigation_type 28 0.0033877797943133695
env_package 27 0.003266787658802178
encoded_traits 23 0.0027828191167574108
strain_name_alias 22 0.002661826981246219
identification method 22 0.002661826981246219
sequencing method 22 0.002661826981246219
Sample number 21 0.002540834845735027
Broker name 20 0.0024198427102238356
isolate_name_alias 20 0.0024198427102238356
identified_by 20 0.0024198427102238356
subsrc_note 19 0.0022988505747126436
BioSampleModel 19 0.0022988505747126436
host_taxid 18 0.002177858439201452
geographic location (altitude) 17 0.00205686630369026
Is the sequenced pathogen host associated? 17 0.00205686630369026
metagenomic 16 0.0019358741681790683
assembly_method 14 0.0016938898971566847
assembly_method_version 14 0.0016938898971566847
completeness_estimated 14 0.0016938898971566847
contamination_estimated 14 0.0016938898971566847
genome_coverage 14 0.0016938898971566847
mapping_method 14 0.0016938898971566847
mapping_method_version 14 0.0016938898971566847
metagenome_source 14 0.0016938898971566847
quality_assessment_method 14 0.0016938898971566847
quality_assessment_method_version 14 0.0016938898971566847
value 14 0.0016938898971566847
attribute_package 13 0.001572897761645493
sample_id 13 0.001572897761645493
type-material 12 0.0014519056261343012
biomaterial_provider 11 0.0013309134906231096
beta_lactamase_family 10 0.0012099213551119178
carbapenemase 10 0.0012099213551119178
edta_inhibitor_tested 10 0.0012099213551119178
source_material_id 8 0.0009679370840895341
alternate_ID 7 0.0008469449485783424
Panel_ID 6 0.0007259528130671506
phenotype 5 0.0006049606775559589
finishing strategy (depth of coverage) 5 0.0006049606775559589
project_type 5 0.0006049606775559589
misc_param: HMP body site 5 0.0006049606775559589
nucleic acid extraction 5 0.0006049606775559589
assembly 5 0.0006049606775559589
misc_param: HMP supersite 5 0.0006049606775559589
sop 5 0.0006049606775559589
pubmed_id-0 4 0.0004839685420447671
pubmed_id-1 4 0.0004839685420447671
age 4 0.0004839685420447671
output_dir 4 0.0004839685420447671
genotype_method 4 0.0004839685420447671
susceptibility 3 0.0003629764065335753
Laboratory Host 3 0.0003629764065335753
Extraction Method 3 0.0003629764065335753
Extraction Date 3 0.0003629764065335753
Passage Date 3 0.0003629764065335753
Genus 2 0.00024198427102238354
ProjectAccession 2 0.00024198427102238354
PublicAccession 2 0.00024198427102238354
Species 2 0.00024198427102238354
alias 2 0.00024198427102238354
MLST 2 0.00024198427102238354
depth 2 0.00024198427102238354
label 2 0.00024198427102238354
metagenome-source 2 0.00024198427102238354
wastewater_type 1 0.00012099213551119177
biotic_relationship 1 0.00012099213551119177
extrachrom_elements 1 0.00012099213551119177
type 1 0.00012099213551119177
alt_ID 1 0.00012099213551119177
fecal 1 0.00012099213551119177
sample comment 1 0.00012099213551119177
completeness score 1 0.00012099213551119177
contamination score 1 0.00012099213551119177
sample derived from 1 0.00012099213551119177
orgmod_note 1 0.00012099213551119177
urine_collect_meth 1 0.00012099213551119177
tissue 1 0.00012099213551119177
MLST Sequence Type 1 0.00012099213551119177
abs_air_humidity 1 0.00012099213551119177
air temperature 1 0.00012099213551119177
build_occup_type 1 0.00012099213551119177
building_setting 1 0.00012099213551119177
carb_dioxide 1 0.00012099213551119177
filter_type 1 0.00012099213551119177
heating and cooling system type 1 0.00012099213551119177
indoor_space 1 0.00012099213551119177
light_type 1 0.00012099213551119177
occup_samp 1 0.00012099213551119177
occupant_dens_samp 1 0.00012099213551119177
organism count 1 0.00012099213551119177
relative air humidity 1 0.00012099213551119177
space_typ_state 1 0.00012099213551119177
typical occupant density 1 0.00012099213551119177
ventilation type 1 0.00012099213551119177
component_organism 1 0.00012099213551119177
Jinru Ji 1 0.00012099213551119177
Yonghong Xiao 1 0.00012099213551119177
environmental-sample 1 0.00012099213551119177
locus_tag prefix 1 0.00012099213551119177
......@@ -30,6 +30,9 @@ if __name__ == '__main__':
coverage_output_pos = output_header.index('Coverage')
assembling_output_pos = output_header.index('Assembling')
with open(args.output, 'w') as csv_output_file: # open(args.input, 'r') as csv_input_file,
csv_output_file.write("# Input File:%s\n"%args.input)
csv_output_file.write("# Max row to read (--limit):%s\n" % args.limit)
csv_output_file.write("# Min percentage attribute expressed (--attribute-threshold):%s\n" % args.threshold)
# csv_reader = csv.reader(csv_input_file, delimiter=args.delimiter, quotechar='|')
csv_writer = csv.writer(csv_output_file, delimiter=args.delimiter)
# strain_pos = header.index('Strain')
......
This diff is collapsed.