-
code
-
notebooks
-
sam
Notebook
/bin/sh: 1: cannot create myenvvars.sh: Permission denied
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-1c01af6a0009> in <module>()
1 #check permissions of directory
----> 2 ls -ld
NameError: name 'ls' is not defined
drwxr-xr-x 2 root root 4096 Oct 16 12:02 .
Don't have permissions, so have to use "sudo" to do this, which I can't do in IPython because it doens't allow password entry.
Be right back; going to Terminal to do this.
Ran this command in Terminal: samb@Mephisto://etc/profile.d$ sudo chmod -R 775 /etc/profile.d
drwxrwxr-x 2 root root 4096 Oct 16 12:02 .
/bin/sh: 1: cannot create myenvvars.sh: Permission denied
After Googling, changed permissions back to 755 using: samb@Mephisto://etc/profile.d$ sudo chmod -R 755 /etc/profile.d
drwxr-xr-x 2 root root 4096 Mar 7 16:57 .
Created file called "myenvvars.sh" using: samb@Mephisto://etc/profile.d$ sudo touch myenvvars.sh
bash_completion.sh myenvvars.sh vte.sh
Couldn't figure out how to write to the file using Terminal; permission denied on all my various attempts.
Tried each of these:
sudo cat '#!/bin/bash' > myenvvars.sh
sudo echo '#!/bin/bash' > myenvvars.sh
sudo '#!/bin/bash' > myenvvars.sh
Got this output from all of them:
bash: myenvvars.sh: Permission denied
So, I resorted to using the program gedit:
sudo gedit myenvvars.sh
This opens the gedit visual text editor. Added these three lines to make the script file:
!#/bin/bash
export PATH=$PATH:/media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/bin:
export BLASTDB=/media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/dbs
Probably have to restart the Terminal or even the computer to have these changes be implemented. Try just restarting Terminal first.
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Not listed. Will restart computer. BRB...
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/bin:
Cool! Restarting worked! Let's just do a quick BLAST check.
/bin/sh: 1: blastn: Permission denied
/bin/sh: 1: blastn: Permission denied
/bin/sh: 1: blastn: Permission denied
File "<ipython-input-5-10d9a82f3d19>", line 2
ls -ld /media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/bin
^
SyntaxError: invalid syntax
drwx------ 1 samb samb 4096 Dec 10 12:20 /media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/bin
Well, this is discouraging. Tried running blast in just the Terminal. Typing "blastn" simply printed
out the PATH to the blast folder. At the end of that output there was a colon; removed that colon from
myenvvars.sh file using gedit. Restarting computer.
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+/bin
/bin/sh: 1: blastn: Permission denied
Well, I think this is an issue of trying to use the Windows partition (which is the larger of the two partitions;
thus why I want to have blast and its databases stored there). Guess I'll have to move blast to the Linux partition.
File "<ipython-input-3-2ca7b6c926a7>", line 2
mv -v /media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+ /home/samb
^
SyntaxError: invalid syntax
mv: cannot stat ‘/media/B0FE4B1FFE4ADD6A/BioinformaticsTools/ncbi-blast-2.2.29+’: No such file or directory
Whoops! I HAD moved the blast folder to the "/home/samb" directory, but should've moved it
to the BioinformaticsTools folder, but forgot. Then, I edited the above line and that's why the
error message is spit out. Manually moved the blast folder from "/home/samb" to "/home/samb/BioinformaticsTools"Change the PATH in the myenvvars.sh file using gedit. Need to restart computer for changes to take effect.
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/samb/BioinformaticsTools/ncbi-blast-2.2.29+/bin
Looks good. Let's see if we can get a quick BLAST command to run.
/bin/sh: 1: blastn: Permission denied
Well, this blows. Going to just try reinstalling BLAST, but in this directory.
Maybe problem is that you can't just move the BLAST directory?
USAGE
blastn [-h] [-help] [-import_search_strategy filename]
[-export_search_strategy filename] [-task task_name] [-db database_name]
[-dbsize num_letters] [-gilist filename] [-seqidlist filename]
[-negative_gilist filename] [-entrez_query entrez_query]
[-db_soft_mask filtering_algorithm] [-db_hard_mask filtering_algorithm]
[-subject subject_input_file] [-subject_loc range] [-query input_file]
[-out output_file] [-evalue evalue] [-word_size int_value]
[-gapopen open_penalty] [-gapextend extend_penalty]
[-perc_identity float_value] [-xdrop_ungap float_value]
[-xdrop_gap float_value] [-xdrop_gap_final float_value]
[-searchsp int_value] [-max_hsps int_value] [-sum_statistics]
[-penalty penalty] [-reward reward] [-no_greedy]
[-min_raw_gapped_score int_value] [-template_type type]
[-template_length int_value] [-dust DUST_options]
[-filtering_db filtering_database]
[-window_masker_taxid window_masker_taxid]
[-window_masker_db window_masker_db] [-soft_masking soft_masking]
[-ungapped] [-culling_limit int_value] [-best_hit_overhang float_value]
[-best_hit_score_edge float_value] [-window_size int_value]
[-off_diagonal_range int_value] [-use_index boolean] [-index_name string]
[-lcase_masking] [-query_loc range] [-strand strand] [-parse_deflines]
[-outfmt format] [-show_gis] [-num_descriptions int_value]
[-num_alignments int_value] [-html] [-max_target_seqs num_sequences]
[-num_threads int_value] [-remote] [-version]
DESCRIPTION
Nucleotide-Nucleotide BLAST 2.2.29+
Use '-help' to print detailed descriptions of command line arguments
Yes! FINALLY! It works. Looks like BLAST package needs to be installed in the desired directory for it to function properly; can't simply move files to a new location after an initial install. Now, let's try an actual BLAST to see if the database directory works, too.
BLAST Database error: No alias or index file found for nucleotide database [RickettsiaGBnt20140228] in search path [/media/B0FE4B1FFE4ADD6A/Users/Samb/Dropbox/Lab/IPython_nbs/Sam::]
BLAST Database error: No alias or index file found for nucleotide database [RickettsiaGBnt20140228] in search path [/media/B0FE4B1FFE4ADD6A/Users/Samb/Dropbox/Lab/IPython_nbs/Sam::]
Wait, I didn't read the error message correctly. It's searching in the IPython Notebook directory? That's weird. Time for more troubleshooting.
OK, I think I fixed it. It turns out that the "myenvvars.sh" file was lacking the "export" command for the BLASTDB variable/location. Will restart
computer and try again.
Sweet! That worked; we're all set! Now, want to try using the "time" command with this, just for fun. The "time" command should
tell me how long it takes for a task to run.
1863.92user 9.40system 8:00.18elapsed 390%CPU (0avgtext+0avgdata 448928maxresident)k
0inputs+1720outputs (0major+7522623minor)pagefaults 0swaps