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

Problems with hivnetworkannotate #35

Open
Omnipotent32 opened this issue Aug 18, 2020 · 3 comments
Open

Problems with hivnetworkannotate #35

Omnipotent32 opened this issue Aug 18, 2020 · 3 comments

Comments

@Omnipotent32
Copy link

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
Copy link
Author

I`8D@JW 0XUZTU SBV}QBJK

@spond
Copy link
Member

spond commented Aug 18, 2020

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

@Omnipotent32
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants