Monday, December 29, 2014

.Fasta Data Grabber

This will download .fasta files from a site and you can add the web crawler I demonstrated earlier or use a pseudo random string generator if the final ALPHANUMERIC piece is very diverse.


browser.Navigate("http://www.organization.org/whatever/ALPHANUMERIC.fasta")

Dim delLineIndex As New List(Of Integer)
delLineIndex.Add(1)


Adress.text=browser.document.Title;
Adress.text=Replace(Adress.text,"http://www.ORGANIZATION.org/WHATEVER/","")
Adress.text=Replace(Adress.text,".fasta","")



Dim openStream = New StreamReader("F:\Latest.txt")
Dim saveStream = New StreamWriter("F:\"+Adress.text+".txt")


Dim lineStr As String = ""
Dim lineIndex As Integer = 0
Do
    lineStr = openStream.ReadLine()
    If lineStr Is Nothing Then
        Exit Do
    Else
        lineIndex += 1
        If Not delLineIndex.Contains(lineIndex) Then
            saveStream.WriteLine(lineStr)


        End If


    End If
Loop Until lineStr Is Nothing
openStream.Close()
saveStream.Close()

Friday, December 12, 2014

Online VD Updates



Programmers and researchers alike can now collaborate in real time to work on computer or genetic code.

Thursday, December 11, 2014

Computerized DNA Alignment with Compression Variables

I wanted to include a DNA alignment operation in the VD program so I the following algorithm:

DNA can easily be aligned by computerized manipulation of multilevel symbolic variables. For example, if we take a strand:

Actgcaatgccctcagcatgcatatagga

And wish to compare it with:

Tcaaaactgactaaccctcagcatacgta

Then we can start with string a by creating each set of three into letters:
Act=A and so on.


Then we apply these values to the second string. The letters will match up as they do in the first. Then we repeat the matching step so that strings of matching letters are folded and compressed repeatedly, like ladders. Once the minima is reached, the appropriate ladders are expanded and the sequence is thus aligned.

Wednesday, December 10, 2014

Gene Editor

The VD Editor is very good at making coding a faster and slicker process. I thought it to be time to make it an editor of genes, creating tools for analyzing sequences as well as ways of designing custom genomes. Here is how it works:

We start with some Jquery to handle the lightweight text operations, like switching out acronyms and words for protein sequences. First make some html:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<body bgcolor = "#303030 ">


<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script>

<style>
  #sideBar { vertical-align:top;}
  #contentArea { vertical-align:top;}
</style>
<table>
  <tr>
    <td id="sideBar">
 
      </td>
    <td id="contentArea">
      
      
<textarea name="texty" id="field_id_29" rows="40" cols="100" style="color: #0086f7; background-color: black;font-weight: bold; font-family: source code pro; font-size:11; "></textarea>

Note the linking of the jquery source into the file. This demands that our application work online. I used this method for future cross platform building ease:

We can add some JS and JQ:

1
2
3
4
5
         $("#field_id_29").bind("keyup", function() {
    var text = $(this).val();
    text = text.replace("alanine", "A" )
    $(this).val(text);
});

The above allows direct addition of amino acids into the sequence following using the Uniprot coding system.

Now for the big switcharoo:


1
2
3
4
5
6
7
8
       
var capsacine_synthase="MIFILTVNFRWRYLILLICKSLMLLEISCPVKYPERFLGVCDTLIFRQTCLQEIFRGTCRICLSCFLLIFLTIVFPAKFRRVLVGFSSFSTFGSRIMTWLELCLRQLLTVRRWFIECLRKCYSRCYSSGNCCFTKASGDIFITYYSVWFFASFIVLQCFDLSSFPWDCSVGFQWVYGYCQARVSKMFYFLANFGSSTQPNTWCVSFDFDEQFCIDVVGRIVEFVLWENPKCHWELVEIGVTENGKQFIDRWSPVFDYELVQLEGSCSIRESNEGENSNVFRLSQKLEDIITGKKSVFGFHSFAFVKFD"

  $("#field_id_29").bind("keyup", function() {
    var text = $(this).val();
    text = text.replace("capsacine synthase", capsacine_synthase )
    $(this).val(text);
});

Now we employ VB for heavy text operations so integrate the js doc via a we bowser.  Before we start messing with whole genomes lets add a method to identify major sequences. this is the basic method:



1
            buildbox.Text = Replace(buildbox.Text, "tata", "tataSTARTSTART")
Let's make sure we are online:



1
2
3
4
5
6
7
   If My.Computer.Network.IsAvailable Then
            adder.ForeColor = Color.Green
            adder.Text = "Internet Connected"
        Else
            adder.ForeColor = Color.Red
            adder.Text = "Internet Disconnected"
        End If


And we load text files for large data segments such as the entire genome of synechocystis. And there you have it , a basic sketch of the gene editor. It willb e embedded int he next VD release.



Sunday, November 30, 2014

Komputer Kite I

Today I decided to use the Arduino cell shield and sensors to make a flying telecommunication and monitoring unit. Below is the kite. It takes two people to launch, it will only require one person once I make the launching stand.


Plastic sheeting and composite plexiglass  cylinders create the kite. Simple and lightweight often go hand in hand.

As far as code goes the shield has a lib available. For power I'll be using a solar panel with a 9 volt rechargeable:

Sample code:

#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;

void setup()
{
  // initialize serial communications
  Serial.begin(9600);

  Serial.println("SMS Messages Sender");

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
}

void loop()
{

  Serial.print("Enter a mobile number: ");
  char remoteNumber[20];  // telephone number to send sms
  readSerial(remoteNumber);
  Serial.println(remoteNumber);

  // sms text
  Serial.print("Now, enter SMS content: ");
  char txtMsg[200];
  readSerial(txtMsg);
  Serial.println("SENDING");
  Serial.println();
  Serial.println("Message:");
  Serial.println(txtMsg);

  // send the message
  sms.beginSMS(remoteNumber);
  sms.print(txtMsg);
  sms.endSMS(); 
  Serial.println("\nCOMPLETE!\n");
}

/*
  Read input serial
 */

int readSerial(char result[])
{
  int i = 0;
  while(1)
  {
    while (Serial.available() > 0)
    {
      char inChar = Serial.read();
      if (inChar == '\n')
      {
        result[i] = '\0';
        Serial.flush();
        return 0;
      }
      if(inChar!='\r')
      {
        result[i] = inChar;
        i++;
      }
    }
  }
}

Saturday, November 29, 2014

Random Dictionary Generation and Duplication

In over 43,000 samples only 4 strings were repeated in the random dictionary generation test. Inefficiency of  9.2263689624948101674585966692808e-5

Tested using filtering method

Biolistics Tip

Tip for Laucher, compresses fluid from surgical tubing and increases velocity:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
difference()
{
 for(i=[0:2])

 cylinder(r=50,h=70);

 for(i=[0:2])
 translate([0,0,-1])
 cylinder(r=40,h=72, r1=2, r2=12);
}
This is written in OpenSCAD, so constants may need changing for printers or CNC's


Cosmic Ray Telescope Secondary Stage

There has not been a true post in quite a while so here is an update on the Telescope, which is taking a while due to all the tinkering necessary for accuracy:

We start by aligning the lasers to the diode holes which we drilled out in CRT Stage 1 post.

Testing the alignment and trasparency of the plexi


Now we create the external panels for mounting the parallel power strips shown in picture 1.

The alignment of the system


Countersinking the nails into the wood allows the upper portion to be removal.
Further alignment with the lasers in a full system test



Adding the cover for the hermetic seal to prevent the escape of the alcohol vapor

Thursday, November 27, 2014

Killing double head virus

Preview:

:A
@echo off 
Taskkill /Im spd.exe -f 
Taskkill /Im pt.exe -f 
GOTO :A

Saturday, November 22, 2014

Updated VD Libs

void setup() {                

  pinMode(led, OUTPUT);     
}


void loop() {
  digitalWrite(led, HIGH);   
  delay(t);               
  digitalWrite(led, LOW);    
  delay(t);               
}


int led = 13;
int io=0;
// the setup routine runs once when you press reset:
void setup() {  
   

  pinMode(led, OUTPUT);
  
}



void loop() {


  Serial.write("I am Here \n");
    digitalWrite(led, HIGH);   
  delay(1000);               
  digitalWrite(led, LOW);   
  delay(1000);             
if (Serial.read()=="predetstring"){

    
    Serial.write("Roger Roger");
  Keyboard.print("longelaboratestring");
  Keyboard.print("\n");
  digitalWrite(led, HIGH);   
  delay(1000);              
  digitalWrite(led, LOW);   
  delay(1000);               
  Serial.flush();
  }
    }




#include <Servo.h> 
 
Servo myservo;  
                
 
int pos = 0;    
 
void setup() 
{ 
  Serial.begin(9600);
  myservo.attach(a); 
} 
 
 
void loop() 

{        
                       
    myservo.write(pos);              
    delay(t);                       
    pos=pos+1;

while(Serial.available>0) {

t=Serial.readline()
} 

}


float Count;
float Voltage;
float SensorReading;
int TimeBetweenReadings = 500; // in ms
int ReadingNumber=0;
float Time;
float Intercept = -19.295;
float Slope = 175.416;
void setup()
{
Serial.begin(9600); //starts serial @ 9600 sigs per second
Serial.println("Data Set");
Serial.print("time");
Serial.println ("EC"); //Sensor Name
Serial.print("sec"); //time units
Serial.println (units); //units(micro siemens=μS)
}
void loop()
{
//the print below does the division first to avoid overflow of Arduino
Serial.print(ReadingNumber/1000.0*TimeBetweenReadings);
Count = analogRead(A0);
Voltage = Count / 1024 * 5.0;// convert from count to raw voltage
SensorReading= Intercept + Voltage * Slope;
Serial.print("\t"); // tab character
Serial.println(SensorReading);
delay(TimeBetweenReadings);// delay in between reads for stability
ReadingNumber++;
}



#include <Servo.h> 
 
Servo myservo;  
                
 
int pos = 0;    
 
void setup() 
{ 
  myservo.attach(a); 
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < t; pos += 1) 
  {                                 
    myservo.write(pos);              
    delay(15);                       
  } 
  for(pos = t; pos>=1; pos-=1)     
  {                                
    myservo.write(pos);             
    delay(15);                       
  } 
}

PImage img;
import processing.video.*;
Capture glamcam;
float num=0;

void setup() {
 size (640,480);
 glamcam= new Capture(this,600,600);
 glamcam.start;
}
void draw(){
num=num+1;
if (glamcam.available){
 glamcam.read();
}
set(0,0,glamcam) //faster than image(glamcam,0,0)
save(num +".png");
}


import processing.video.*;
float a=0;
Capture dacam;
PImage img;
float[][] kernel = {{ -z, -z, -z}, 
                    { -z,  (9*z), -z}, 
                    { -z, -z, -z}};
void setup() {
  img=(loadImage(a+".png"));
  size (640,480);
  dacam= new Capture(this, 320, 240, 30);
  dacam.start();


}

void draw(){

  if(dacam.available()) {
    dacam.read();
  }
  a=a+1;
  image(dacam, 0, 0);
  save(a+".png");
  img=loadImage(a+".png");
 image(img, 0, 0); // Displays the image from point (0,0) 
  img.loadPixels();
  // Create an opaque image of the same size as the original
  PImage edgeImg = createImage(img.width, img.height, RGB);
  // Loop through every pixel in the image.
  for (int y = 1; y < img.height-1; y++) { // Skip top and bottom edges
    for (int x = 1; x < img.width-1; x++) { // Skip left and right edges
      float sum = 0; // Kernel sum for this pixel
      for (int ky = -1; ky <= 1; ky++) {
        for (int kx = -1; kx <= 1; kx++) {
          // Calculate the adjacent pixel for this kernel point
          int pos = (y + ky)*img.width + (x + kx);
          // Image is grayscale, red/green/blue are identical
          float val = red(img.pixels[pos]);
          // Multiply adjacent pixels based on the kernel values
          sum += kernel[ky+1][kx+1] * val;
        }
      }
      // For this pixel in the new image, set the gray value
      // based on the sum from the kernel
      edgeImg.pixels[y*img.width + x] = color(sum, sum, sum);
    }
  }
  // State that there are changes to edgeImg.pixels[]
  edgeImg.updatePixels();
  image(edgeImg, width/2, 0); // Draw the new image
  save(a+".png");
}
#legend-web

#include <SPI.h>
#include <Ethernet.h>

Ethernet Server server(80)
#stp
  Ethernet.begin(mac, ip);
  server.begin();

  /#

#lp

 while (client.connected()) {
    if (client.available()) {
client.print(HTML);

done
done

/#

num=num+1;
if (glamcam.available){
 glamcam.read();
}
set(0,0,glamcam) //faster than image(glamcam,0,0)
save(num +".png");

#server legend

#include <Servo.h>;
 
 
Servo myservo;  
                
 
int pos = 0;  



#include <Servo.h>;
 
 
Servo myservo;  
                
 
int pos = 0;  


PImage img;
import processing.video.*;
Capture glamcam;
float num=0;




  for(pos = 0; pos < t; pos += 1) 
  {                                 
    myservo.write(pos);              
    delay(15);                       
  } 
  for(pos = t; pos>=1; pos-=1)     
  {                                
    myservo.write(pos);             
    delay(15);                       
  }

int a=0;
float[][] kernel = {{ -z, -z, -z}, 
                    { -z,  (9*z), -z}, 
                    { -z, -z, -z}};