VIM visual block sort numerically using Vissort - sorting

I need help using the Vissort plugin to visual block sort numberically.
The documentation states that I can use the 'VSO n' command to set sort to 'n' for numeric but I'm having no success.
I'm on a windows machine.
The below example only has one column, but in the real world I need to be able to numerically sort on any column within a text file. For now my work around is using '!gsort.exe -k 10 -n' to sort by the 10th column.
After using 'VSO n' and running Vissort, this is how my list is sorted:
1
11
13
15
17
19
2
21
23
25
27
29
3
31
33
35
37
39

You can use GNU sort. First select visual block and then:
:'<,'>!sort -k 1 -n

Apparently, the :VSO option only applies to the :Vissort command, not to :'<,'>B sort.
So, either of these should work:
:VSO n
:'<,'>Vissort
or
:'<,'>B sort n

Related

How to enforce bash to recognize letters case in files names in MacOS bash?

I bumped into the fact that MacOS GNU bash5.1.16 "ls" command doesn't differentiate between lower and upper case in the files names ( weird, I know)
e.g.
[17:39:28:~/Work/cloud-formation/output/templates$] ls -l Man*
-rw-r--r-- 1 geoku staff 71244 31 Jan 17:23 ManagementProd.json
-rw-r--r-- 1 geoku staff 67569 31 Jan 17:23 ManagementStage.json
Now, I can get the exactly same file listed with a different command:
[17:44:19:~/Work/cloud-formation/output/templates$] cksum ManagementStage.json Managementstage.JsOn
cksum ManagementStage.json Managementstage.JsOn
3327010753 67569 ManagementStage.json
3327010753 67569 Managementstage.JsOn
Is it some sort of bash settings?
OK, it turns out MacOS disk partitions can be created case-sensitive or not, and default is apparently the second one
Disk utility shows the options when one is trying to create a new partition
enter image description here

error when trying to create new menu item / Joomla! 3.8.10

I hope somebody can help me .. I try to open a new entry in a joomla menu and get the following error output:
0 Cannot use object of type stdClass as array
/mnt/web208/e2/01/56797301/htdocs/plugins/system/helix3/helix3.php:55
error output
Function Location 1 () JROOT/plugins/system/helix3/helix3.php:55 2 plgSystemHelix3->onContentPrepareForm() JROOT/libraries/joomla/event/event.php:70
3 JEvent->update() JROOT/libraries/joomla/event/dispatcher.php:160
4 JEventDispatcher->trigger() JROOT/libraries/src/MVC/Model/FormModel.php:321
5 Joomla\CMS\MVC\Model\FormModel->preprocessForm() JROOT/administrator/components/com_menus/models/item.php:1254
6 MenusModelItem->preprocessForm() JROOT/libraries/src/MVC/Model/FormModel.php:242
7 Joomla\CMS\MVC\Model\FormModel->loadForm() JROOT/administrator/components/com_menus/models/item.php:552
8 MenusModelItem->getForm() JROOT/libraries/src/MVC/View/HtmlView.php:423
9 Joomla\CMS\MVC\View\HtmlView->get() JROOT/administrator/components/com_menus/views/item/view.html.php:58
10 MenusViewItem->display() JROOT/libraries/src/MVC/Controller/BaseController.php:672
11 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_menus/controller.php:75 12 MenusController->display() JROOT/libraries/src/MVC/Controller/BaseController.php:710
13 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_menus/menus.php:18
14 require_once() JROOT/libraries/src/Component/ComponentHelper.php:382
15 Joomla\CMS\Component\ComponentHelper::executeComponent() JROOT/libraries/src/Component/ComponentHelper.php:357
16 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:101
17 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:159
18 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:195
19 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/index.php:51
The error occurred in the file helix3.php on line 55. Plugging the displayed notation ("helix3.php:55", with the quotes) into Google yields this page as first result:
https://www.joomshaper.com/forums/helix3-plugins-causing-joomal-menu-to-not-work-0-cannot-use-object-of-type-stdclass-as-array
This site states it's a known bug and an update will be released soon. Try to update the plugin, or modify the helix3.php file as explained.
And please use Google (or another search engine of your liking) before posting a question. Filenames + Line numbers as well as paths and the first sentence of error messages make for great search terms.
PS: Welcome on StackOverflow!

Hadoop Mapreduce: TextInputFormat: Meaning of position

I am trying to understand the doc which says "The TextInputFormat works as An InputFormat for plain text files. Files are broken into lines. Either linefeed or carriage-return are used to signal end of line. Keys are the position in the file, and values are the line of text"
What does "position" mean? does it mean the line number in the file?
Given data in a file
dobbs 2007 20 18 15
dobbs 2008 22 20 12
doctor 2007 545525 366136 57313
doctor 2008 668666 446034 72694
Would it produce a map input like this?
(1, "dobbs 2007 20 18 15")
(2, "dobbs 2008 22 20 12")
(3, "doctor 2007 545525 366136 57313")
(4, "doctor 2008 668666 446034 72694")
In TextInputFormat, Keys are the byte offset in the file from the beginning of the file to the line
i.e., for the first line, offset or key will be 0
for the second line the offset or key will be length of first line for the third line offset will be offset of first line + length of first line
No, it will not produce map input as you expects,
(assuming each word is separated by single space) it would rather be something like
(0,dobbs 2007 20 18 15)
(20,dobbs 2008 22 20 12)
(40,doctor 2007 545525 366136 57313)
(71,doctor 2008 668666 446034 72694)

orthAgogue incorrectly processing BLAST files

Need to recruit the help of any budding bioinformaticians that are lurking in the shadows here.
I am currently in the process of formatting some .fasta files for use in a set of grouping programs but I cannot for the life of me get them to work. First things first, all the files have to have a 3 or 4 character name such as the following:
PP41.fasta
PP59.fasta
PPBD.fasta
...etc...
The files must have headers for each gene sequence that look like so: >xxxx|yyyyyyyyyy where xxxx is the same 3 or 4 letter 'taxon' identifier as the file names I put above and yyyyyyy is a numerical identifier for each of the proteins within each of the taxons (the pipe symbol can also be replaced with an _ as below). I then cat all of these in to one file which has a header that looks correct like so:
>PP49_00001
MIENFNENNDMSDMFWEVEKGTGEVINLVPNTSNTVQPVVLMRLGLFVPTLKSTKRGHQG
EMSSMDATAELRQLAIVKTEGYENIHITGARLDMDNDFKTWVGIIHSFAKHKVIGDAVTL
SFVDFIKLCGIPSSRSSKRLRERLGASLRRIATNTLSFSSQNKSYHTHLVQSAYYDMVKD
TVTIQADPKIFELYQFDRKVLLQLRAINELGRKESAQALYTYIESLPPSPAPISLARLRA
RLNLRSRVTTQNAIVRKAMEQLKGIGYLDYTEIKRGSSVYFIVHARRPKLKALKSSKSSF
KRKKETQEESILTELTREELELLEIIRAEKIIKVTRNHRRKKQTLLTFAEDESQ*
>PP49_00002
MQNDIILPINKLHGLKLLNSLELSDIELGELLSLEGDIKQVSTGNNGIVVHRIDMSEIGS
FLIIDSGESRFVIKAS*
Next step is to construct a blast database which I do as follows, using the formatdb tool of NCBI Blast:
formatdb -i allproteins.fasta -p T -o T
This produces a set of files for the database. Next I conduct an all-vs-all BLAST of the concatenated proteins against the database that I made of them like so, which outputs a tabular file which I suspect is where my issues are beginning to arise:
blastall -p blastp -d allproteins.fasta -i allproteins.fasta -a 6 -F '0 S' -v 100000 -b 100000 -e 1e-5 -m 8 -o plasmid_allvall_blastout
These files have 12 columns and look like the below. It appears correct to me, but my supervisor suspects the error is in the blast file - I don't know what I'm doing wrong however.
PP49_00001 PP51_00025 100.00 354 0 0 1 354 1 354 0.0 552
PP49_00001 PP49_00001 100.00 354 0 0 1 354 1 354 0.0 552
PP49_00001 PPTI_00026 90.28 288 28 0 1 288 1 288 3e-172 476
PP49_00001 PPNP_00026 90.28 288 28 0 1 288 1 288 3e-172 476
PP49_00001 PPKC_00016 89.93 288 29 0 1 288 1 288 2e-170 472
PP49_00001 PPBD_00021 89.93 288 29 0 1 288 1 288 2e-170 472
PP49_00001 PPJN_00003 91.14 79 7 0 145 223 2 80 8e-47 147
PP49_00002 PPTI_00024 100.00 76 0 0 1 76 1 76 3e-50 146
PP49_00002 PPNP_00024 100.00 76 0 0 1 76 1 76 3e-50 146
PP49_00002 PPKC_00018 100.00 76 0 0 1 76 1 76 3e-50 146
SO, this is where the problems really begin. I now pass the above file to a program called orthAgogue which analyses the paired sequences I have above using parameters laid out in the manual (still no idea if I'm doing anything wrong) - all I know is the several output files that are produced are all just nonsense/empty.
Command looks like so:
orthAgogue -i plasmid_allvsall_blastout -t 0 -p 1 -e 5 -O .
Any and all ideas welcome! (Hope I've covered everything - sorry about the long post!)
EDIT Never did manage to find a solution to this. Had to use an alternative piece of software. If admins wish to close this please do, unless it is worth having open for someone else (though I suspect its a pretty niche issue).
Discovered this issue (of orthAgogue) first today:
though my reply may be old, I hope it may help future users;
issue is due to a missing parameter: seems like you forgot to specify the separator: -s '_', ie, the following set of command-line parameters should do the trick*:
orthAgogue -i plasmid_allvsall_blastout -t 0 -p 1 -e 5 -O -s '_'
(* Under the assumption that your input-file is a tabular-seperated file of columns.)
A brief update after comment made by Joe:
In brief, the problem described in the intiail error report (by Joe) is (in most cases) not a bug. Instead it is one of the core properties of the Inparanoid algorithm which orthAgogue implements: if your ortholog-result-file is empty (though constructed), this (in most cases) implies that there are no reciprocal best match between a protein-pair from two different taxa/species.
One (of many) explanations for this could be that your blastp-scores are too similar, a case where I would suggest a combined tree-based/homology clustering as in TREEFAM.
Therefore, when I receive your data, I'll send it to one of the biologists I'm working with, with goal of identifying the tool proper for your data: hope my last comment makes your day ;)
Ole Kristian Ekseth, developer of orthAgogue

Passing alias as argument in bash

You can use built in command cal for example in this way:
cal 10 2013
and you will get a calendar of Octber 2013. My teacher made and assignment to change first argument in a way, that we could call this function in our native language. For example:
cal spalis 2013
cal gruodis 1999
and so on..
(spalis means october, and gruodis -december in my country)
And we would see same result as cal 10 2013 or cal gruodis 1999
Same goes with others months. I am newbie in shell, and thought that i could make an alias:
alias spalis=10
and then i tried to use cal spalis 2013, but i got error:
cal: spalis is neither a month number (1..12) nor a name
So, after googling for a while, i guess there is no way to pass alias as an argument? Or i'am doing something wrong? Maybe there is some other way? I'll be very thankful for an advice and sorry for bad english :)
Aliases only work for the command name, not for arguments. What you'll want to do is write a function cal which replaces the first argument with the appropriate number and then calls the regular cal binary.
cal() {
local month=$1
local year=$2
# replace named $month with a numeric $month here
...
# Call the real cal. `command' ignores this function and calls the underlying binary.
command cal "$month" "$year"
}
cal accepts month names in the language specified by the current locale. To accept Lithuanian month names, use
$ LANG=lt_LT cal spalis 2013
Spalio 2013
Sk Pr An Tr Kt Pn Št
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
This depends on the version of cal you are using. The above works on my MacOS X 10.9 machine, but not on one of my Linux boxes (where cal doesn't accept month names at all, only numbers).
This may not be exactly what your teacher is looking for, as it only requires using the program as intended. :)

Resources