Montag, 26. März 2018

Blast Web Interface and Python script for automatic update


BLAST ("Basic Local Alignment Search Tool") finds regions of similarity between biological sequences. The task was to do this with local oligos and to establish a web interface.

General Webinterface you find here
https://blast.ncbi.nlm.nih.gov/Bblast viroblastlast.cgi

A stand alone program for BLAST called blast+
https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=Download

I found the nice Web interface Viroblast from Deng et al. 2007
https://indra.mullins.microbiol.washington.edu/viroblast/docs/aboutviroblast.html
You can download the software from
James Mullins
Department of Microbiology
University of Washington
https://els.comotion.uw.edu/express_license_technologies/viroblast

The most important thing is to fix the path to your blast+ programs in the vironblast.ini file.

 blast+: /usr/bin/
for example.

 Create a new database for your Viroblast

To create a new database out of the fasta file you had to install
blast+ from NCBI
https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=Download

You need the program makeblastdb.

1. Type in in the terminal:
makeblastdb -in   -dbtype 'nucl' -out

makeblastdb - program from blast+ NCBI
in - input
out -output
dbtype - 'nucl' for nucleotides, 'prot' for proteins

2. Copy the new database files to
viroblast/db ,protein or nucleitides sub folder

3. That viroblast know something about the new database, you had to configure the viroblast.ini file.

You can use several databases.
Here write for a nucleotide database (in one line!)

blastn: database_name1 => name_to_display1,database_name1 => name_to_display1,and so on


Python script to automate the tasks

Here is a Python script to automate the task.
The script starts with cron job daily.


import pandas as pd
import re
import os 

import time

path_excel=''
path_viroblast_db='
'
path_viroblast_ini='
'

file = path_excel + 'AG_XX.xlsx' 



# Read the Excel file
xl = pd.ExcelFile(file)


# Read the sheet names in the excel file
sheets_excel=xl.sheet_names

# Load a sheet into a DataFrame by name: df1
df1 = xl.parse(sheets_excel[0])

# slice columns 1- 3
df1=df1.iloc[:,0:3]
# rename column title
df1.columns=['primer_index','primer_name','sequence']

# create a fasta format string for the fasta file
primer_number=''
fasta=''

#find empty cells in  Excel, NaN, Not a number
def isNaN(num):
    return num != num
# fasta format
for index,row in df1.iterrows():
    if not isNaN(row['sequence']):
        # delete all white spaces in sequence
        sequence = ''.join(row['sequence'].split())
        primer_number=row['primer_index']

        fasta=fasta+'>'+str(row['primer_index'])+"|"+str(row['primer_name'])+'\n'+str(sequence)+'\n'


#write to fasta file
with open(path_viroblast_db+ primer_number+'.fa','w') as my_file:
    my_file.write(fasta)



#makeblastdb execute with fasta file and output name
os.system('makeblastdb'+' -in '+ path_viroblast_db+primer_number +'.fa'+" -dbtype 'nucl' -out "+path_viroblast_db+primer_number)

#viroblast.ini update
ini_txt=''
with open(path_viroblast_ini+'viroblast.ini','r') as ini_file:
    for line in ini_file:
        m=re.search(r"XXX_\d{5}",line)
        if m:
            old=m.group()
            #print(m)
            line=line.replace(old,primer_number)
            ini_txt=ini_txt + line
        else:
            ini_txt=ini_txt + line

# write the new viroblast.ini    
with open(path_viroblast_ini+'viroblast.ini','w') as ini_file_new:
    ini_file_new.write(ini_txt) 


time_now=time.asctime()
# write log-file
with open(path_viroblast_ini+'lui.log','a') as log_file:
    log_file.write(primer_number+';'+time_now+'\n')












Freitag, 29. Dezember 2017

Raspberry Pi Public Display - Infoboard - broadcast messages and information for students, lecturers, teachers, staff and visitors

Raspberry Pi Public Display - broadcast messages and information for students, lecturers, teachers, staff and visitors 

Version 14.3.21

Montag, 13. November 2017

Mac OSX SFTP Server

You had to upload big files to your Mac. Macs offers an build in SFTP Server.
Port is 22, which is open at University.

see following webpage:

https://www.chainsawonatireswing.com/2012/08/09/how-to-set-up-an-sftp-server-on-a-mac-then-enable-a-friend-to-upload-files-to-it-from-their-iphone-ipad-or-other-idevice/


1. Create a folder for SFTP files

In Finder crate a folder, for example /sftpupload on your Mac System Hard disk.
With Command + I open the "get info" window.
Sharing and Permission -> everyone to "Read & Write"


2. Create User for SFTP

Open System Preferences
Users & Groups
After unlock for Administrator add an user by click to the "+"
"New Account" -> "Sharing only"
Type in a name for example "sftpuser" (FTP as name does not work!)
After user is created click to the user with right mouse and "advanced options"
Login shell: /bin/bash
Home directory:

3. File Sharing

Open System Preferences
Sharing
Activate "File Sharing"
Shared Folders: add your created folder, for example "sftpupload "
Mark "sftpupload" and go to Users:
Add your created user sftpuser.
Permit Read (Only), write (dropbox) or Read & Write permission

4. Activate SFTP

 Open System Preferences
Sharing
Activate "Remote Login"
Allow Access for : add your created user sftpuser


Donnerstag, 20. April 2017

Windows Server 2016 Install - BW-PC5 - Error 0x80300024

I tried to install Windows Server 2016 on
BW-PC5
Fujitsu P957.
128 GB SSD.

Install Windows Server 2016.
Choose the hard disk to install, I got the message
Error 0x80300024

To create a partition on the SSD produce the error 0xe7d8f710

I did the following.

1. Unplug all additional had drives (in my case a 1 TB Hard drive)

2. Windows install program, go to repair
command prompt
diskpart

list disk
select disk 0 (in my case the SSD is number 0)
list part
select part 1 (I had 2 partitions)
delete part
select part 2
delete part

clean (very important this deletes the mbr partition table)

Restart the windows installation program

Choose Custom installation.

Create the partition on your SSD.

Successfully install Windows 2016 on SSD.

Freitag, 10. März 2017

GUS Staining - Python program

GUS Staining - Python program


Download - GUS staining Python.

The task is automatically quantify the images of GUS staining.
https://en.wikipedia.org/wiki/GUS_reporter_system

Normally you can do this with ImageJ
http://www.ipb.uni-tuebingen.de/kurs/comp/5_bildbearb/kurs05_06.html#gus


I wrote a program in Python (2.7 and 3.x)
This program measure all files beginning with 'GUS' and ending with 'png' in the actual folder. 
Write the result to a file.
For control the image and the marked areas will be shown. 





The complete program and example files, see download above.

Dienstag, 28. Februar 2017

Bacula restore Linux

bconsole

Thanks to Andreas Keck.

Default directory is /opt/bacula/working


Client name is tu-xxx

Preperation restore:


echo "list clients" | /opt/bacula/bin/bconsole | grep -i tu-xxx
echo "list jobtotals" | /opt/bacula/bin/bconsole | grep -i tu-xxx
echo "list jobs" | /opt/bacula/bin/bconsole | grep -i tu-xxx
  (you get jobid, first column)
echo "list joblog jobid=xxxxxx" | /opt/bacula/bin/bconsole | grep -i tu-xxx


Start Restore:


  Start bconlole
/opt/bacula/bin/bconsole
  Now you are connetet to bacula server. Prompt is *

restore client=tu-xxx where=
 6
     (6: Select backup for a client before a specified time)
2015-11-10 00:25:07
     (time stamp from previous output, list joblog jobid=xxxxxx)
cd
     (navigate to the file/directory which should be restored)
ls
     (shows listing of the cwd)
mark adjtime
     (mark file, in example /etc/adjtime)
Output:1 file marked.
done


Following message appear:

Bootstrap records written to /opt/bacula/working/unixxx.bsr

The Job will require the following (*=>InChanger):
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
  
    yyy-disk1-1271       FileChanger-yyy          FileChanger-yyy       

Volumes marked with "*" are in the Autochanger.


1 file selected to be restored.

Using Catalog "uniyyy"
Run Restore job
JobName:         DefaultRestore
Bootstrap:       /opt/bacula/working/unixxx.bsr
Where:          
Replace:         Always
FileSet:         FullSet
Backup Client:   tu-xxx
Restore Client:  tu-xxx
Storage:         FileChanger-ZDV
When:            2015-11-20 16:39:07
Catalog:         uniyyy
Priority:        10
Plugin Options:  *None*
 

OK to run? (yes/mod/no):

  yes                      (restore starts, jobid will be shown)
  quit                     (leave the bconsole)

with
  echo "list joblog jobid=xxxxxx" | /opt/bacula/bin/bconsole

you can watch the restore

Montag, 27. Februar 2017

Bacula restore with Windows

Start bconsole


Default working directory
c:\Program files\bacula\working
 This will be altert by c:/temp see below.
Or you can choose any other folder. Create the folder before  you start bconsole.




Name of the client computer (tu-xxxx)

Open bconsole
Use Windows Start : Bacula : bconsole
or you can execute
c:\Program files\bacula\bconsole.exe



messages -i grep
print the recent messages.




Begin the restore:


 restore client=tu-wwwblast where=c:/temp
  Eingabe von:  6
     (6: Select backup for a client before a specified time)
  2015-11-10 00:25:07
     (time stamp from previous output, list joblog jobid=xxxxxx)
  cd
     (navigate to the file/directory which should be restored)
  ls
     (shows listing of the cwd)
 mark testfile
     (mark file, in example testfile)
  Output:1 file marked.
  done
  Output:

Bootstrap records written to /opt/bacula/working/xxx.bsr

The Job will require the following (*=>InChanger):
   Volume(s)                 Storage(s)                SD Device(s)
===========================================================================
  
    XXX-incr-disk1-1271       FileChanger-XXX           FileChanger-XXX       

Volumes marked with "*" are in the Autochanger.


1 file selected to be restored.

Using Catalog "xxxxxx"
Run Restore job
JobName:         DefaultRestore
Bootstrap:       /opt/bacula/working/xxx.bsr
Where:           c:/temp
Replace:         Always
FileSet:         FullSet
Backup Client:   tu-xxx
Restore Client:  tu-xxx
Storage:         FileChanger-ZDV
When:            2015-11-20 16:39:07
Catalog:         xxx
Priority:        10
Plugin Options:  *None*
OK to run? (yes/mod/no):

  yes                      (restore will be done, jobid will show)
  quit                     (quit bconsole)

with
  echo "list joblog jobid=xxxxxx" | /opt/bacula/bin/bconsole

you can show the log