Search Results

Search found 71 results on 3 pages for 'dna'.

Page 1/3 | 1 2 3  | Next Page >

  • Reading and conditionally updating N rows, where N > 100,000 for DNA Sequence processing

    - by makerofthings7
    I have a proof of concept application that uses Azure tables to associate DNA sequences to "something". Table 1 is the master table. It uniquely lists every DNA sequence. The PK is a load balanced hash of the RK. The RK is the unique encoded value of the DNA sequence. Additional tables are created per subject. Each subject has a list of N DNA sequences that have one reference in the Master table, where N is 100,000. It is possible for many tables to reference the same DNA sequence, but in this case only one entry will be present in the Master table. My Azure dilemma: I need to lock the reference in the Master table as I work with the data. I need to handle timeouts, and prevent other threads from overwriting my data as one C# thread is working with the information. Other threads need to realise that this is locked, and move onto other unlocked records and do the work. Ideally I'd like to get some progress report of how my computation is going, and have the option to cancel the process (and unwind the locks). Question What is the best approach for this? I'm looking at these code snippets for inspiration: http://blogs.msdn.com/b/jimoneil/archive/2010/10/05/azure-home-part-7-asynchronous-table-storage-pagination.aspx http://stackoverflow.com/q/4535740/328397

    Read the article

  • This Week in Geek History: Birth of NACA, Chemical Composition of DNA Discovered, Telephone Introduced

    - by Jason Fitzpatrick
    Every week we bring you new facts and figures from the annals of Geekdom. This week we’re taking a look at the birth of NASA’s forefather, the composition of DNA, and the first telephone. Latest Features How-To Geek ETC Learn To Adjust Contrast Like a Pro in Photoshop, GIMP, and Paint.NET Have You Ever Wondered How Your Operating System Got Its Name? Should You Delete Windows 7 Service Pack Backup Files to Save Space? What Can Super Mario Teach Us About Graphics Technology? Windows 7 Service Pack 1 is Released: But Should You Install It? How To Make Hundreds of Complex Photo Edits in Seconds With Photoshop Actions Access and Manage Your Ubuntu One Account in Chrome and Iron Mouse Over YouTube Previews YouTube Videos in Chrome Watch a Machine Get Upgraded from MS-DOS to Windows 7 [Video] Bring the Whole Ubuntu Gang Home to Your Desktop with this Mascots Wallpaper Hack Apart a Highlighter to Create UV-Reactive Flowers [Science] Add a “Textmate Style” Lightweight Text Editor with Dropbox Syncing to Chrome and Iron

    Read the article

  • DNA and Quantum computing

    - by Jacques
    I recently(A couple of weeks ago) read an article about the future of processing and how quantum-processors and DNA-processors(DNA-computing) are the future competitors of computing since both will completely outperform the computers of this era. In terms of processing speeds, what do we expect from these two different processing techniques ? Personally I believe that DNA-processing will be a major step towards AI. For labs and office work I think quantum-processing which will be more logical. I'm quite excited that i'm still so young - to see what the future of technology holds! Then again my parents will soon find out what the after-life holds... just as bloody exciting, if not more..

    Read the article

  • How (and where) to get aligned tRNA sequences (and import it into R)

    - by Tal Galili
    (This is a database / R commands question) I wish (for my thesis work), to import tRNA data into R and have it aligned. My questions are: 1) What resources can I use for the data. 2) What commands might help me with the import/alignment. So far, I found two nice repositories that holds such data: http://trnadb.bioinf.uni-leipzig.de/Resulthttp://trnadb.bioinf.uni-leipzig.de/Result http://gtrnadb.ucsc.edu/download.htmlhttp://gtrnadb.ucsc.edu/download.html And also the readFASTA command from Biostrings, that does basic importing of the data into R. My problem still remains with how to handle the alignment of the tRNA. Since I am not from the field, I might be missing a very basic answer (like where I should download the data from, or what command to use). If you might be willing to advice me, that would be most helpful. Many thanks in advance, Tal

    Read the article

  • conversion of DNA to Protein - c structure issue

    - by sam
    I am working on conversion of DNA sequence to Protein sequence. I had completed all program only one error I found there is of structure. dna_codon is a structure and I am iterating over it.In first iteration it shows proper values of structure but from next iteration, it dont show the proper value stored in structure. Its a small error so do not think that I havnt done anything and downvote. I am stucked here because I am new in c for structures. CODE : #include <stdio.h> #include<string.h> void main() { int i, len; char short_codons[20]; char short_slc[1000]; char sequence[1000]; struct codons { char amino_acid[20], slc[20], dna_codon[40]; }; struct codons c1 [20]= { {"Isoleucine", "I", "ATT, ATC, ATA"}, {"Leucine", "L", "CTT, CTC, CTA, CTG, TTA, TTG"}, {"Valine", "V", "GTT, GTC, GTA, GTG"}, {"Phenylalanine", "F", "TTT, TTC"}, {"Methionine", "M", "ATG"}, {"Cysteine", "C", "TGT, TGC"}, {"Alanine", "A", "GCT, GCC, GCA, GCG"}, {"Proline", "P", "CCT, CCC, CCA,CCG "}, {"Threonine", "T", "ACT, ACC, ACA, ACG"}, {"Serine", "S", "TCT, TCC, TCA, TCG, AGT, AGC"}, {"Tyrosine", "Y", "TAT, TAC"}, {"Tryptophan", "W", "TGG"}, {"Glutamine", "Q", "CAA, CAG"}, {"Aspargine","N" "AAT, AAC"}, {"Histidine", "H", "CAT, CAC"}, {"Glutamic acid", "E", "GAA, GAG"}, {"Aspartic acid", "D", "GAT, GAC"}, {"Lysine", "K", "AAA, AAG"}, {"Arginine", "R", "CGT, CGC, CGA, CGG, AGA, AGG"}, {"Stop codons", "Stop", "AA, TAG, TGA"} }; int count = 0; printf("Enter the sequence: "); gets(sequence); char *input_string = sequence; char *tmp_str = input_string; int k; char *pch; while (*input_string != '\0') { char string_3l[4] = {'\0'}; strncpy(string_3l, input_string, 3); printf("\n-----------%s & %s----------", string_3l, tmp_str ); for(k=0;k<20;k++) { //printf("@REAL - %s", c1[0].dna_codon); printf("@ %s", c1[k].dna_codon); int x; x = c1[k].dna_codon; pch = strtok(x, ","); while (pch != NULL) { printf("\n%d : %s with %s", k, string_3l, pch); count=strcmp(string_3l, pch); if(count==0) { strcat(short_slc, c1[k].slc); printf("\n==>%s", short_slc); } pch = strtok (NULL, " ,.-"); } } input_string = input_string+3; } printf("\nProtien sequence is : %s\n", short_slc); } INPUT : TAGTAG OUTPUT : If you see output of printf("\n-----------%s & %s----------", string_3l, tmp_str ); in both iterations, we found that values defined in structure are reduced. I want to know why structure reduces it or its my mistake? because I am stucked here

    Read the article

  • Given two sets of DNA, what does it take to computationally "grow" that person from a fertilised egg and see what they become? [closed]

    - by Nicholas Hill
    My question is essentially entirely in the title, but let me add some points to prevent some "why on earth would you want to do that" sort of answers: This is more of a mind experiment than an attempt to implement real software. For fun. Don't worry about computational speed or the number of available memory bytes. Computers get faster and better all of the time. Imagine we have two data files: Mother.dna and Father.dna. What else would be required? (Bonus point for someone who tells me approx how many GB each file will be, and if the size of the files are exactly the same number of bytes for everyone alive on Earth!) There would ideally need to be a way to see what the egg becomes as it becomes a human adult. If you fancy, feel free to outline the design. I am initially thinking that there'd need to be some sort of volumetric voxel-based 3D environment for simulation purposes.

    Read the article

  • Search for string allowing for one mismatches in any location of the string, Python

    - by Vincent
    I am working with DNA sequences of length 25 (see examples below). I have a list of 230,000 and need to look for each sequence in the entire genome (toxoplasma gondii parasite) I am not sure how large the genome is but much more that 230,000 sequences. I need to look for each of my sequences of 25 characters example(AGCCTCCCATGATTGAACAGATCAT). The genome is formatted as a continuous string ie (CATGGGAGGCTTGCGGAGCCTGAGGGCGGAGCCTGAGGTGGGAGGCTTGCGGAGTGCGGAGCCTGAGCCTGAGGGCGGAGCCTGAGGTGGGAGGCTT.........) I don't care where or how many times it is found, just yes or no. This is simple I think, str.find(AGCCTCCCATGATTGAACAGATCAT) But I also what to find a close match defined as wrong(mismatched) at any location but only 1 location and record the location in the sequnce. I am not sure how do do this. The only thing I can think of is using a wildcard and performing the search with a wildcard in each position. ie search 25 times. For example AGCCTCCCATGATTGAACAGATCAT AGCCTCCCATGATAGAACAGATCAT close match with a miss-match at position 13 Speed is not a big issue I am only doing it 3 times. i hope but it would be nice it was fast. The are programs that do this find matches and partial matches but I am looking for a type of partial match that is not available with these applications. Here is a similar post for pearl but they are only comparing sequnces not searching a continuous string Related post

    Read the article

  • How can I use R (Rcurl/XML packages ?!) to scrap this webpage ?

    - by Tal Galili
    Hi all, I have a (somewhat complex) webscraping challenge that I wish to accomplish and would love for some direction (to whatever level you feel like sharing) here goes: I would like to go through all the "species pages" present in this link: http://gtrnadb.ucsc.edu/ So for each of them I will go to: The species page link (for example: http://gtrnadb.ucsc.edu/Aero_pern/) And then to the "Secondary Structures" page link (for example: http://gtrnadb.ucsc.edu/Aero_pern/Aero_pern-structs.html) Inside that link I wish to scrap the data in the page so that I will have a long list containing this data (for example): chr.trna3 (1-77) Length: 77 bp Type: Ala Anticodon: CGC at 35-37 (35-37) Score: 93.45 Seq: GGGCCGGTAGCTCAGCCtGGAAGAGCGCCGCCCTCGCACGGCGGAGGcCCCGGGTTCAAATCCCGGCCGGTCCACCA Str: >>>>>>>..>>>>.........<<<<.>>>>>.......<<<<<.....>>>>>.......<<<<<<<<<<<<.... Where each line will have it's own list (inside the list for each "trna" inside the list for each animal) I remember coming across the packages Rcurl and XML (in R) that can allow for such a task. But I don't know how to use them. So what I would love to have is: 1. Some suggestion on how to build such a code. 2. And recommendation for how to learn the knowledge needed for performing such a task. Thanks for any help, Tal

    Read the article

  • ASP.Net Custom Field From Query In DataSet

    - by boruchsiper
    I added a new query to a table adapter in a DataSet. This query adds another field to the query whcih is a sum from another table. Here is the full query: SELECT (SELECT COUNT(donationID) AS Expr1 FROM Donations AS da WHERE (dn.donorID = donorID)) AS Count, Solicitor, address1, address2, city, companyName, country, donorID, email, first, last, phoneHome, phoneMobile, phoneWork, state, webURL, zip, (select sum(amount) from Donations as dna where dna.donorID = dn.donorID) as SumDonations FROM Donors AS dn order by last The new field is represented in the last part of the query: (select sum(amount) from Donations as dna where dna.donorID = dn.donorID) as SumDonations I can preview the data in the xsd but the last field "SumDonations" is not showing up as a field I can add to my gridview. I rebuilt the website but no luck. What am I missing?

    Read the article

  • Newly configured MSSQL2008, TIME_WAIT but no ESTABLISHED?

    - by 3molo
    Windows 2008 R2, standard. No firewall locally on it. Newly setup because an old SQL2000 had two disks die (or could it be the raid controller?) at the same time. Luckily, I had fresh backups. The databases have been restored, and SP2 for SQL2008 applied. I can see various hosts trying to establish a session, but the (customer) sites does not work and I don't see the expected established sessions. A wireshark reveals a full three-way handshake. Since it's customer machines connecting, I cannot logon to them and restart application pools.. What on earth could be causing this? No. Time Source Destination Protocol Info 1 0.000000 1.2.5.127 1.2.6.133 TCP desktop-dna > ms-sql-s [SYN] Seq=0 Win=65535 Len=0 MSS=1380 SACK_PERM=1 Frame 1: 62 bytes on wire (496 bits), 62 bytes captured (496 bits) Ethernet II, Src: Cisco_31:5e:09 (00:26:0b:31:5e:09), Dst: Vmware_b7:00:05 (00:50:56:b7:00:05) Internet Protocol, Src: 1.2.5.127 (1.2.5.127), Dst: 1.2.6.133 (1.2.6.133) Transmission Control Protocol, Src Port: desktop-dna (2763), Dst Port: ms-sql-s (1433), Seq: 0, Len: 0 No. Time Source Destination Protocol Info 2 0.000123 1.2.6.133 1.2.5.127 TCP ms-sql-s > desktop-dna [SYN, ACK] Seq=0 Ack=1 Win=8192 Len=0 MSS=1460 SACK_PERM=1 Frame 2: 62 bytes on wire (496 bits), 62 bytes captured (496 bits) Ethernet II, Src: Vmware_b7:00:05 (00:50:56:b7:00:05), Dst: Cisco_31:5e:09 (00:26:0b:31:5e:09) Internet Protocol, Src: 1.2.6.133 (1.2.6.133), Dst: 1.2.5.127 (1.2.5.127) Transmission Control Protocol, Src Port: ms-sql-s (1433), Dst Port: desktop-dna (2763), Seq: 0, Ack: 1, Len: 0 No. Time Source Destination Protocol Info 3 0.000884 1.2.5.127 1.2.6.133 TCP desktop-dna > ms-sql-s [ACK] Seq=1 Ack=1 Win=65535 Len=0 And netstat TCP 1.2.6.133:1433 1.2.2.98:26895 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.2.98:26912 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.2.98:26918 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.2.98:26931 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.5.127:2736 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.5.127:2737 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.5.127:2738 TIME_WAIT 0 TCP 1.2.6.133:1433 1.2.5.127:2739 TIME_WAIT 0

    Read the article

  • HFS+ hard drive being mounted as read only

    - by DNA
    This is a recurring problem and occurs a few times a week. I have an external hard drive which is hfs+. Every couple of weeks, for no obviuous reason, when I mount it by pluggin it in to my Ubuntu 11.10, it is read only and I can't copy any files into it. I gksudo nautlius and change the ownership and it magically works in some time. But returns to the read only state soon in a few hours-days without any rhyme or reason. Right now my fstab doesn't have any entry for my hard drive. What gives? What in the world is going on with Linux/HFS+? This is frustrating. I can't reformat my hard drive because I have almost a terrabyte of data in it and no receptacle to hold it while I reformat it.

    Read the article

  • Crontab -e gives me error messages

    - by DNA
    I get a bunch of error messages when I run crontab -e Here are the error messages. And here is my crontab file under `/usr/bin/': # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) 30 * * * * root rsync /home/dnaneet/Downloads/*.pdf /home/dnaneet/Downloads/pdfs/ # I notice that the last task ('rsync') NEVER RUNS! Why is this happening? What did I do wrong? Running Ubuntu 11.10/Bash. I have read this... Am I missing a shebang? And I don't know if my anacron jobs run. Edit 1 In light of Masi's comment, I commented out lines 17 thru 25 of my crontab file with #. Now when I run sudo crontab -e, all I get is: /usr/bin/crontab: 11: 17: not found /usr/bin/crontab: 12: 25: not found (gedit:4301): Gtk-WARNING **: Attempting to store changes into `/root/.local/share/recently-used.xbel', but failed: Failed to create file '/root/.local/share/recently-used.xbel.GOHVBW': No such file or directory (gedit:4301): Gtk-WARNING **: Attempting to set the permissions of `/root/.local/share/recently-used.xbel', but failed: No such file or directory What in the world?

    Read the article

  • Strange sound issues with Ubuntu 11.10

    - by DNA
    I am having strange issues with sound and volume with Ubuntu 11.10 I've noticed very often, especially when I get my computer out of sleep, it lacks sound even though the volume slider is cranked all the way up. But when I plug my headphones in and then take them out, it seems to kick start my sound back! What gives? What daemon in /etc/int.d needs to be restared with the restart command to fix this? I have the following in my init.d folder /etc/init.d/alsa-restore and /etc/init.d/alsa-store Also, my start up ubuntu sound doesn't play either....

    Read the article

  • FFMPEG not extracting part of the video

    - by DNA
    I used FFMPEG to extract portion (5 seconds) of a video like this: ffmpeg -ss 00:30:00 -t 00:00:05 -i original.avi cut1.avi and also like this: ffmpeg -ss 1800 -t 5 -i original.avi cut1.avi But what FFMPEG did was create a file starting at 00:30:00 and included the rest of the file instead of just 5 seconds. So instead of having a 5 second video clip, I now have the whole file except the first 30 minutes. What went wrong? I tried this with mencoder as well -- same result. EDIT 1 Strangely, this worked on OS X....

    Read the article

  • Crontab file is garbled! HELP!

    - by DNA
    I accidentally deleted my .bashrc file in Ubuntu 11.10. I think I restored it but I have two major issues now: Everything that I type has a red squiggly line under it in this field and the suggestion is a german word. My crontab file is completely garbled and looks like this: \00\00\00\00\00\00\00\00\00\00\00\00\00\008\00\00\00\00\00\008@\00\00\00\00\008@\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00@\00\00\00\00\00\00\00@\00\00\00\00\00tw\00\00\00\00\00\00tw\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00(~\00\00\00\00\00\00(~\00\00\00\00\00(~\00\00\00\00\00\00\00\00\00\00\00H\00\00\00\00\00\00\00\00 \00\00\00\00\00\00\00\00\00\00\00P~\00\00\00\00\00\00P~\00\00\00\00\00P~\00\00\00\00\00\90\00\00\00\00\00\00\90\00\00\00\00\00\00\00\00\00\00 HELP!!!! I am new at Ubuntu and don't know what to do. Please don't tell me to reinstall because I don't know how to. I got this computer from system76 with Ubuntu installed in it.

    Read the article

  • How can I apply a PSSM efficiently?

    - by flies
    I am fitting for position specific scoring matrices (PSSM aka Position Specific Weight Matrices). The fit I'm using is like simulated annealing, where I the perturb the PSSM, compare the prediction to experiment and accept the change if it improves agreement. This means I apply the PSSM millions of times per fit; performance is critical. In my particular problem, I'm applying a PSSM for an object of length L (~8 bp) at every position of a DNA sequence of length M (~30 bp) (so there are M-L+1 valid positions). I need an efficient algorithm to apply a PSSM. Can anyone help improve performance? My best idea is to convert the DNA into some kind of a matrix so that applying the PSSM is matrix multiplication. There are efficient linear algebra libraries out there (e.g. BLAS), but I'm not sure how best to turn an M-length DNA sequence into a matrix M x 4 matrix and then apply the PSSM at each position. The solution needs to work for higher order/dinucleotide terms in the PSSM - presumably this means representing the sequence-matrix for mono-nucleotides and separately for dinucleotides. My current solution iterates over each position m, then over each letter in word from m to m+L-1, adding the corresponding term in the matrix. I'm storing the matrix as a multi-dimensional STL vector, and profiling has revealed that a lot of the computation time is just accessing the elements of the PSSM (with similar performance bottlenecks accessing the DNA sequence). If someone has an idea besides matrix multiplication, I'm all ears.

    Read the article

  • Generate a set of strings with maximum edit distance

    - by Kevin Jacobs
    Problem 1: I'd like to generate a set of n strings of fixed length m from alphabet s such that the minimum Levenshtein distance (edit distance) between any two strings is greater than some constant c. Obviously, I can use randomization methods (e.g., a genetic algorithm), but was hoping that this may be a well-studied problem in computer science or mathematics with some informative literature and an efficient algorithm or three. Problem 2: Same as above except that adjacent characters cannot repeat; the i'th character in each string may not be equal to the i+1'th character. E.g., 'CAT', 'AGA' and 'TAG' are allowed, 'GAA', 'AAT', and 'AAA' are not. Background: The basis for this problem is bioinformatic and involves designing unique DNA tags that can be attached to biologically derived DNA fragments and then sequenced using a fancy second generation sequencer. The goal is to be able to recognize each tag, allowing for random insertion, deletion, and substitution errors. The specific DNA sequencing technology has a relatively low error rate per base (~1%), but is less precise when a single base is repeated 2 or more times (motivating the additional constraints imposed in problem 2).

    Read the article

  • Latex - Apply an operation to every character in a string

    - by hroest
    Hi I am using LaTeX and I have a problem concerning string manipulation. I want to have an operation applied to every character of a string, specifically I want to replace every character "x" with "\discretionary{}{}{}x". I want to do this because I have a long string (DNA) which I want to be able to separate at any point without hyphenation. Thus I would like to have a command called "myDNA" that will do this for me instead of inserting manually \discretionary{}{}{} after every character. Is this possible? I have looked around the web and there wasnt much helpful information on this topic (at least not any I could understand) and I hoped that you could help. --edit To clarify: What I want to see in the finished document is something like this: the dna sequence is CTAAAGAAAACAGGACGATTAGATGAGCTTGAGAAAGCCATCACCACTCA AATACTAAATGTGTTACCATACCAAGCACTTGCTCTGAAATTTGGGGACTGAGTACACCAAATACGATAG ATCAGTGGGATACAACAGGCCTTTACAGCTTCTCTGAACAAACCAGGTCTCTTGATGGTCGTCTCCAGGT ATCCCATCGAAAAGGATTGCCACATGTTATATATTGCCGATTATGGCGCTGGCCTGATCTTCACAGTCAT CATGAACTCAAGGCAATTGAAAACTGCGAATATGCTTTTAATCTTAAAAAGGATGAAGTATGTGTAAACC CTTACCACTATCAGAGAGTTGAGACACCAGTTTTGCCTCCAGTATTAGTGCCCCGACACACCGAGATCCT AACAGAACTTCCGCCTCTGGATGACTATACTCACTCCATTCCAGAAAACACTAACTTCCCAGCAGGAATT just plain linebreaks, without any hyphens. The DNA sequence will be one long string without any spaces or anything but it can break at any point. This is why my idea was to inesert a "\discretionary{}{}{}" after every character, so that it can break at any point without inserting any hyphens.

    Read the article

  • How to code a time delay between plotting points in JFreeCharts?

    - by Javajava
    Is there a way to animate the plotting process of an xy-line chart using JFreeCharts? I want to be able to watch the program draw each line segment and connect them. For example, if I paste this into the TextArea, "gtgtaaacaatatatggcg," I want to watch it graph each line segment one by one. Thanks in advance! :) My code is below: import java.util.Scanner; import java.applet.Applet; import java.awt.; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import org.jfree.chart.; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.xy.*; public class RandomWalkComplete extends Applet implements ActionListener { Panel panel; TextArea textarea, outputArea; Button move,exit; String thetext; Scanner reader = new Scanner(System.in); String thetext2; Label instructions; int x,y; public void init() { setSize(500,250); //set size of applet instructions=new Label("Paste the gene sequences in the " + "text field and press the graph button."); add(instructions); panel = new Panel(); add(panel); setVisible(true); textarea= new TextArea(10,20); add(textarea); move=new Button("Graph"); move.addActionListener(this); add(move); exit=new Button("Exit"); exit.addActionListener(this); add(exit); } public void actionPerformed(ActionEvent e) { XYSeries series = new XYSeries("DNA Walk",false,true); x= 0; y = 0; series.add(x,y); if(e.getSource() == move) { thetext=textarea.getText(); //the text is the DNA bases pasted thetext=thetext.replaceAll(" ",""); //removes spaces thetext2 = ""; for(int i=0; i<thetext.length(); i++) { char a = thetext.charAt(i); switch (a) { case 'A': case 'a'://moves right x+=1; y+=0; series.add(x,y); break; case 'C': case 'c': //moves up x+=0; y+=1; series.add(x,y); break; case 'G': case 'g': //move left x-=1; y+=0; series.add(x,y); break; case 'T': case 't'://move down x+=0; y-=1; series.add(x,y); break; default: // series.add(0,0); break; } } XYDataset xyDataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createXYLineChart ("DNA Random Walk", "", "", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame1=new ChartFrame("DNA Random Walk",chart); frame1.setVisible(true); frame1.setSize(300,300); } if(e.getSource()==exit) {System.exit(0);} } public void stop(){} }

    Read the article

  • AWK :Extract columns from file: Rows have variable columns

    - by pulikot1
    I have a text file in the following format. Each row has variable number of columns. File: gi|269201691|ref|YP_003280960.1| chromosomal replication initiation protein gi|57651109|ref|YP_184912.1| chromosomal replication initiation protein % 1 0.0 2296 100.0 gi|269201692|ref|YP_003280961.1| DNA polymerase III subunit beta gi|57651110|ref|YP_184913.1| DNA polymerase III subunit beta % 1 0.0 1964 100.0 The resulting file should look like the following: gi|269201691|ref|YP_003280960.1| gi|57651109|ref|YP_184912.1| % 1 0.0 2296 100.0 gi|269201694|ref|YP_003280963.1| gi|57651112|ref|YP_184915.1| % 1 0.0 1767 100.0 The code below helps find columns in each row with the pattern 'ref'. awk '{for (i=1;i<=NF;i++) if ($i ~ /ref/) print $i }' Any ideas on how to do the same?

    Read the article

  • Convert Double to String without precision loss in javascript

    - by holger
    I would like to convert a floating point variable to a string without losing any precision. I.e. I would like the string to have the same information as my floating point variable contains, since I use the output for further processing (even if it means that the string will be very long and readable). To put this more clearly, I would like to have functions for cyclic conversion var dA = 323423.23423423e4; var sA = toString(dA); var dnA = toDouble(sA); and I would like dnA and dA to be equal Thanks PS: Sources on the internet usually talk about how to round strings but I have not found information on exact representation. Also I am not interested in Arbitrary Precision calculations, I just need double precision floating point arithmetic.

    Read the article

  • Why doesn't JFreeCharts correctly connect the points in my xy-line graph?

    - by Javajava
    /Each letter A,T,G,C represents a direction for the plot to graph. Specifically, “A” means move right, “T” is move down, “C” is move up, and “G” is move left. When the applet reads A,T,C, it plots the graph correctly. However, when I plot G, the graph is messed up. When I input "ACACACA," the graph is like a rising staircase. When I input "gtgtgt," the graph should look like a staircase, but it looks like a lightning bolt instead/ /This is all one code... i don't know why it's all split up like this:/ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.util.Scanner.*; import java.jfree.chart.*; import java.jfree.data.xy.*; import java.jfree.chart.plot.PlotOrientation; public class If_Graph extends Applet implements ActionListener{ Panel panel; TextArea textarea, outputArea; Button move; String thetext; Scanner reader = new Scanner(System.in); String thetext2; int size,p,q; int x,y; public void init(){ setSize(500,500); //set size of applet panel = new Panel(); add(panel); setVisible(true); textarea= new TextArea(10,20); add(textarea); move=new Button("Graph"); move.addActionListener(this); add(move); } public void actionPerformed(ActionEvent e) { XYSeries series = new XYSeries("DNA Walk"); x= 0; y = 0; series.add(x,y); if(e.getSource() == move) { thetext=textarea.getText(); //the text is the DNA bases pasted thetext=thetext.replaceAll(" ",""); //removes spaces thetext2 = ""; for(int i=0; i<thetext.length(); i++) { char a = thetext.charAt(i); switch (a) { case 'A': //moves right x+=1; y+=0; series.add(x,y); break; case 'a': x+=1;y+=0; series.add(x,y); break; case 'C': //moves up x+=0; y+=1; series.add(x,y); break; case 'c': x+=0; y+=1; System.out.println(x + "," + y); series.add(x,y); break; case 'G': //move left x-=1; y+=0; series.add(x,y); System.out.println("G is: "+ x +"," +y); break; case 'g': x-=1; y+=0; System.out.println("g is: " +x + "," + y); series.add(x,y); break; case 'T': //move down x+=0; y-=1; series.add(x,y); System.out.println("T is: "+ x +"," +y); break; case 't': x+=0; y-=1; series.add(x,y); System.out.println("t is: "+ x +"," +y); break; default: // series.add(0,0); break; } } XYDataset xyDataset = new XYSeriesCollection(series); JFreeChart chart = ChartFactory.createXYLineChart ("DNA Random Walk", "", "", xyDataset, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame1=new ChartFrame("DNA Random Walk",chart); frame1.setVisible(true); frame1.setSize(300,300); outputArea.setText(thetext2); } } }

    Read the article

  • What did I do wrong with this function?

    - by Felipe Galdino Campos
    I don't know what I did - it's wrong . Can someone help me? def insert_sequence(dna1, dna2, number): '''(str, str, int) -> str Return the DNA sequence obtained by inserting the second DNA sequence at the given index. (You can assume that the index is valid.) >>> insert_sequence('CCGG', 'AT', 2) 'CCATGG' >>> insert_sequence('TTGC', 'GG', 2) 'TTGGGC' ''' index = 0 result = ''; for string in dna1: if index == number: result = result + dna2 result = result + string index += 1 print(result)

    Read the article

1 2 3  | Next Page >