PoonLab / sierra-local

Retrieve HIVdb algorithm as XML and apply locally to HIV sequences
GNU General Public License v3.0
6 stars 3 forks source link

JSON to CSV conversion Error: json2csv.py #94

Closed gpcr closed 1 year ago

gpcr commented 1 year ago

python3 /sierra-local/scripts/json2csv.py /hiv/Fastq/Test_001.report.json Test_001_001.report.json.csv


 /sierra-local/scripts/json2csv.py", line 42, in <module>
    json2csv(infile=args.json, outfile=args.csv)
  File "/sierra-local/scripts/json2csv.py", line 14, in json2csv
    for d in result['drugResistance']:
TypeError: string indices must be integers
ArtPoon commented 1 year ago

@WilliamZekaiWang can you please try reproducing this problem? @gpcr can you please provide version information?

gpcr commented 1 year ago

@WilliamZekaiWang I am using the report.Json generated by sierrapy using the codfreq

SierraPy 0.4.3; Sierra 3.4.7 (2023-09-22); HIVdb HIVDB_9.5.0 (2023-08-22)

sierrapy seqreads test.codfreq -q hiv1_sequence_reads_analysis_default.gql

WilliamZekaiWang commented 1 year ago

Hi,

I have managed to duplicate the error.

However, I don't believe the json2csv.script was made for the sierrapy seqreads output. I believe the original script was made to turn the fasta file output from either sierralocal fasta.fa or sierrapy fasta fasta.fa.

I've tried the json2csv.script from the fasta output of sierrapy and sierralocal and they both worked

gpcr commented 1 year ago

Thanks for the update @WilliamZekaiWang , any suggestions for using seqreads output conversion?

ArtPoon commented 1 year ago

Hi @gpcr - converting between seqread format and other formats is not covered by sierra-local and unfortunately we do not have the bandwidth to do this right now, sorry. Closing issue.