Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# thesis_tm
This will hold some of my notes, important links and snippets of codes for my thesis under prof Tobias Marschall
# VG related notes
* `vg snarls -r traversals_file_output graph.vg > snarls.pb`
The _snarls.pb_ file can then be turned to _json_ file with `vg view -R snarls.pb > snarls.json`
And the _traversals_file_output_ can be turned to _json_ file with `vg view -E traversals_file_output > traversals.json`
# Bandage related notes
# jq related notes
* If I wanted to selecte an object with a certain key and certain value. For example separating the ULTRABUBBLE from the snarls json file `jq 'select(.type | . and contains("ULTRABUBBLE"))' snarls.json` this will give back the objects that containe ultrabubbles.
* For _json_ files generated from the graphs, I have to read the files like this `jq '.[] | .[] | select(.id | . and contains("16534"))' graph.json`
# Python related notes
* Loading a json file with several dictionaries, I need to parse every line as one dictionary.
```python
with open("json_file.json", "r") as json_file:
json_data = [json.loads(line) for line in json_file]
# for parsing the vg graph as json
with open("graph.vg.json", "r") as json_file:
json_data = json.load(json_file)
# we'll get a dictionary with 2 keys, ['node', 'edge']
# each consisting of individual dictonaries
```
* For ipython to have auto reload, which means that we can just change a function in the imported file, and ipython will autmoaticaly reload the new functions in the file, no need to re-import it then.
```python
In [1]: %load_ext autoreload
In [2]: %autoreload 2
In [3]: from foo import some_function
```
# Vim related notes
* For searching and substituting, the following can be used to substitute foo with bar in only one line, to do it in all lines, we can add % before the s.
```
:s/foo/bar/g
```
* For Cut and paste, ctrl+v can be used for visual block, then d to cut (or y for copy) and p or P to paste.
* For mass indenting, use ctrl+v for visual block, the > character or < for un-indenting.
* For block commenting, also ctrl+v for visual block, the :s/^/# to insert the hash at the beginning of all the lines highlighted.