veg / hivclustering

Infer molecular transmission networks from pairwise distance files (part of HIV-TRACE)
2 stars 5 forks source link

Problems with hivnetworkannotate #35

Open Omnipotent32 opened 4 years ago

Omnipotent32 commented 4 years ago

Hi, I downloaded example files and tried to run hivnetworkannotate, however, there seems some problems. When I type '-n' , what kind of network files should I attach? a tn93. CSV or a network.json? and when I type '-f', what should I input? If it is effortless, an instruction of entirely operation with example files will be deeply grateful!

here are my manipulation record and error report:

(python3) passwordis1@ubuntu:~/下载/hivclustering-master/examples$ hivnetworkannotate -n network.json -t lanl.tsv -g network.json -o test Traceback (most recent call last): File "/home/passwordis1/anaconda3/envs/python3/bin/hivnetworkannotate", line 4, in import('pkg_resources').run_script('hivclustering==1.6.1', 'hivnetworkannotate') File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/site-packages/pkg_resources/init.py", line 665, in run_script self.require(requires)[0].run_script(script_name, ns) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/site-packages/pkg_resources/init.py", line 1463, in run_script exec(code, namespace, namespace) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/site-packages/hivclustering-1.6.1-py3.7.egg/EGG-INFO/scripts/hivnetworkannotate", line 72, in results_json = json.load (import_settings.network) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/json/init.py", line 296, in load parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/json/init.py", line 348, in loads return _default_decoder.decode(s) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/home/passwordis1/anaconda3/envs/python3/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) (python3) passwordis1@ubuntu:~/下载/hivclustering-master/examples$ hivnetworkannotate -n tn93-0.03.csv -t lanl.tsv -f plain -o test usage: hivnetworkannotate [-h] [-o [OUTPUT]] [-n [NETWORK]] [-x MISSING MISSING] [-X] [-i INDEX] [-r] (-a ATTRIBUTES | -t TAB | -c CSV) (-f FIELD FIELD FIELD FIELD | -g FIELDS_FILE) hivnetworkannotate: error: argument -f/--field: expected 4 arguments

Omnipotent32 commented 4 years ago

I`8D@JW 0XUZTU SBV}QBJK

spond commented 4 years ago

Dear @Omnipotent32,

When I type '-n' , what kind of network files should I attach? a tn93. CSV or a network.json?

network.json, which is produced by hivnetworkcsv with the -j option

and when I type '-f', what should I input?

You need to input four arguments per field

  1. The name of the column in the .csv or .tsv file that are you processing to read the values of the field form
  2. The name of the network attribute that you want to create with these values
  3. The type of the attribute; possible values are String, enum, Date, Number
  4. How to transform the input data into the field value

Examples

Best, Sergei

Omnipotent32 commented 4 years ago

Dear @Omnipotent32,

When I type '-n' , what kind of network files should I attach? a tn93. CSV or a network.json?

network.json, which is produced by hivnetworkcsv with the -j option

and when I type '-f', what should I input?

You need to input four arguments per field

  1. The name of the column in the .csv or .tsv file that are you processing to read the values of the field form
  2. The name of the network attribute that you want to create with these values
  3. The type of the attribute; possible values are String, enum, Date, Number
  4. How to transform the input data into the field value

Examples

  • -f "Country" "Country" "String" "x: 'N/A' f x=='-' else x" : store the country name/code from the Country column into the Country field, copying it unless the value is a - (which is replaced with N/A)
  • -f "Year" "Year" "Number" "" copy Year as a number
  • -f "RiskFactor" "Risk factor" "enum" '{"SG" : "homosexual", "SB" : "bisexual", "SM" : "male sex with male", "SH" : "heterosexual", "SW" : "sex worker", "SU" : "sexual transmission, unspecified type", "PH" : "hemophiliac", "PB" : "Blood transfusion", "PI" : "IV drug use", "MB" : "Mother-baby", "NO" : "Nosocomial", "EX" : "Experimental", "NR" : "not recorded (or unknown)", "OT" : "other", "-" : "N/A"}': enumeration field
  • -f "Year" "Diagnosis Year" "Date" YYYY : Date as year
  • -f "Year" "Diagnosis Date" "Date" YYYYMMDD : Date as year/month/date

Best, Sergei Dear Sergei, Thank you for detailed instruction! I'm going to try again! Best Omniotent32