Tuesday, June 28, 2016

Copy and paste a file from one location to another

I am trying to copy a file (that contains various contexts) from one area and paste it in another area.

I am using the cp command --> cp  /source.of.file /destination.of.file

The operator keeps responded omitting the /source.of.file  

OR

The operator responds the /source.of.file is not a directory (however when I cd to the /source.of.file it takes me right to the correct directory.

(Additional Information: I am in a node under cluster on command line.)

Saturday, June 25, 2016

Future Meetings (please note!)

I am away June 28, July 5 and July 12 ...!

But will monitor this blog and help best way I can


Wednesday, June 22, 2016

Elizabeth Andrew's code for reading molecular coordinates from a file

#!/usr/bin/python

import sys
from pybel import *


mol = readfile("g09", "stauranthine_GC_dimer_xyz_1.out").next()

atomtotal = 0
for mol in readfile("g09", "stauranthine_GC_dimer_xyz_1.out"):
atomtotal += len(mol.atoms)


atom_number = { 1 : 'H',
6 : 'C',
7 : 'N',
8 : 'O'
}

for atom in mol:

x = atom.coords[0]
y = atom.coords[1]
z = atom.coords[2]
print atom_number[atom.atomicnum]+'\t'+str(x)+'\t'+str(y)+'\t'+str(z)

#I am having trouble getting the xyz coordinates to form right aligned even columns. Some of the coordinates have negative signs which causes the misalignment. 

Monday, June 20, 2016

All in one packages (the good, the bad, the ugly)

I remember providing instructions on installing "all in one" packages for Windows systems - like anaconda, canopy and so on -

1) The good - well, they are all in one - so no need to look around for packages to install - you have everything you need in one grand package
2) The bad - sometimes, a package in that all in one may be buggy - and you may want to use an older version (or a newer version) - well, I am sure you can install any version of any package - but it may not be that easy (!) ... I discovered for example that the latest/greatest openpyxl package (functions to read/write xlsx files) has some bugs - and I discovered (accidentally) that 1.6.2 worked as I wanted to (and not the 2.x.x versions)
3) The ugly - often you may not know in any all in one package as to where the problem is - so if you install package by package you can debug easily


Thursday, June 16, 2016

How to do X? (add your own please!)

Here is a list of "X" (please add your own) (I would be happy to share my solutions/explain them)

1) Read a data file (containing rows and columns)
2) Plot one column of data against another column of data
3) plot data from one row against another row
4) Do a linear least squares fit (e.g. Y versus X) - calculate slope, intercept
5) Do a polynomial fit (Y versus X) (plot the data)
6) Read a protein (or DNA/RNA) sequence (from a data file in fasta OR genbank or ... formats)
7) Get information about a protein (or DNA/RNA) sequence (length of sequence, C+G, etc)
8) Read/write excel file (as xlsx, csv, txt)na
9) Solve vapor/liquid equilibrium problems (Antoine's equation, Raoult's law ...)
10) Solve set of linear equations (AX = B)
11) Solve non linear equations
12) Calculate volume roots of cubic equations of state
13) Set up and solve problems in enzyme kinetics (set of ordinary differential equations, Michaelis Menten form, etc)
14) Solve problems involving filtration (Darcy's Law)

And now for some "X"'s I have a very limited experience with/written software for

15) Read an image (tiff, jpg, png) - and run filters (low pass, high pass, band pass)
16) Locate spots on an image (microarray analysis of tiff images - locate center of spot, determine background intensities)
16) BLAST sequences at the NCBI - parse output according to defined criteria
17) Align two sequences using dynamic programming techniques (SmithWaterman (local) and Needleman Wunsch (global)




Wednesday, June 15, 2016

Beginner- Questions about a code

I am trying to make a program that asks questions and allows the user to answer them. When I try to use raw_input it gives me an error. Can anyone tell me what I am doing wrong?

name = raw_input("What is your name?")
color = raw_input("What is your favorite color?")

print = ("So your name is %s and your favorite color is %s." % (name, color))

I would like for it to allow the user to enter their name and favorite color and the output include the sentence with the information.

I have read online that raw_input might not work anymore but input did not allow me to answer to questions.



June 14, 2016 (What we did) (sort of did)

I was glad to see many pythonistas - welcome.

Reminder - come with/post problems, questions - "How do do X" or "Y" in python

My objective is not to "formally" teach python - but help you help yourself with python - and sure, I (and many others) can help you get to a point where you are comfortable with writing python scripts

(if you are reading this, post on what you heard/what you would like to hear/learn)


Monday, June 13, 2016

Tuesday June 14 2016 (Change of Venue)

Just a reminder

Tomorrow (June 14, 2016) we meet in the

auditorium at the

HudsonAlpha Institute for Biotechnology

http://hudsonalpha.org/directions

(Just come on in - sign in at the desk/as guest (if you do not see anyone, just
go to the auditorium)

Friday, June 10, 2016

Friday, June 3, 2016

Atomic Matrix 1: Letters vs. Numbers?

I am building up to solve a problem out of Dr. Cerro's 244 textbook.
First thing that I'd like to do is construct an "Atomic matrix" using molecules given by the user, something sort of like this:

                     Water    Carbon dioxide   Carbon monoxide    ...etc.
Carbon             0                   1                            1

Hydrogen         2                   0                            0

Oxygen            1                   2                            1
.
.
.


So, my goal is for the program to read the input molecular formulas (i.e. H2O for water, or CO2 for carbon dioxide), and construct the matrix with the appropriate values in the appropriate locations, combining the all the input information together.

I wrote this short program a week or so ago. It takes your name, and searches for a specified character, and returns the number of times that character appears in your name:

#Using a for-loop to run iterations through the characters of a scripts
name=raw_input("What is your name? ")
print " "
let=raw_input("What letter would you like to search for? ")
highlet=let.upper()
lowlet=let.lower()
#print highlet
#print lowlet
namelen=len(name)
#print namelen
totlets=0
for num in range (0,namelen):
    check=name[num]
    #print check
    if check==highlet or check==lowlet:
        totlets=totlets+1
    #print "totlets equals %s" %totlets
print " "
print "There are %s %s\'s in your name." %(totlets,highlet)

My plan is to modify the code so that instead of a user designated character, the code will automatically sum the number of times EACH charter appears in the string, using a similar method shown above.

The issue is that some atoms within a molecule occur more then the number of characters (There are two hydrogens in water, but only one H in  "H2O") So, my program will need to also take into account the numeric character following each letter (if there is one).

All that being said, is there a way to ask the code to distinguish between letters and numbers in a string?
I considered doing something involving an if-loop after counting the characters, which would ask if the character following a given letter within the for-loop was a number using something like:

for i in range (0,len(name):
       .
       .
       .
       if name[i+1]="1" or name[i+1]="2" or name[i+1]="3" or name[i+1]="3" or name[i+1]="4"....
            totlets=totlets + name[i+1] - 1  #Since the letter before the subscript would be counted twice.

I feel like there should be an easier way of doing it, like "if the character following name[i] is a number, add that number to the total number of name[i]'s in our count so far."

I'd appreciate any advice.

Thanks,

Elijah