Training, Open Source computer languages

This is page http://www.wellho.net/forum/Perl-Programming/How-to-check-this.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
How to check this? :(

Posted by revtopo (revtopo), 21 June 2007
Hi there,

Am trying to write a code in bioperl to get the data from a database server corresponding to the ids.

Here is the snippet of my code:

$srs->get_records_with_accessions(
         -db => 'uniprot', #going to get records from this database
         -AccNumbers => \@array, # contains the list of ids
       -file => './topo_protein.dbi'# writes in this file.
  );

I have to get this records stored in the file ./topo_protein.dbi' and parse them to those am in need of. then have to  load those to the database using mysql. I have written a code to do all these in a single streatch.


~ this does the parsing and loading them in the database:

my $acc = $seq->accession_number;
  my $name = $seq->desc();
  my $sequence = $seq->seq;
  my $length = $seq->length();# parsing the recors to have these attributes in my database.
  my $query= $connect->prepare("insert into topo_interpro.PROTEIN_DBI(Accession_id,Protein_name,Sequence,Sequence_len) values(?,?,?,?)");#to insert rows into the database. in the table name PROTEIN_DBI.
  $query ->execute($acc,$name,$sequence,$length)#


what I actually I wish to do is  if I have the records already in the fiel that I have mentioned then it has to continue with  the rest of my program like parsing them for the stuufs I need and loading them to the database.

could any one help me out of this.

Posted by admin (Graham Ellis), 22 June 2007
Hi ... I'm afraid I don't fully undertstand the question; I think you're trying to insert only records which don't already exist into a database rather than putiing the whole lot of them in. Is that the case?   If so, you'll need to do a separate check with each record to see if it's there OR to do a replace if you don't mind the whole of the record being replaced.

If you can come back with a more specific descritpion, I might be able to offer further and more specific advise.

Posted by revtopo (revtopo), 22 June 2007
Hi Graham,

The file contains the complete records of the ids. These record are got from uniprot (a global database) using the ids. I will filter them into 4 attributes I need. What should be done is to read the file that I have and if they have records then it should say something like " you have got records in it" or else it has to proceed with writing in the file and continue with the further process. If it has records then it has to skip just the writing into file but should proceed with ohter steps like parsing and loading them in the database. There is no need to check with the database( that i produce) we have to check with the file only.
Am i clear in my point now?

My point in doing that:  

And what I think now is the ids I mention are unique which pulls out the records from the database(uniprot a global database). So will it make easy to do grep in file with ids. These ids are contained in another file. So we can use that file and check with the ids.

Posted by admin (Graham Ellis), 22 June 2007
It's seeming very much like a project specification than a simple question I can answer in a few limes, so I wonder if a forum is really the best medium to help sort you out.  I fear painfully frustrating progress for both of us as we take steps forward and I would encourage you to have a look at other alternatives such as our perl courses - or if it doesn't need all of that, perhaps pop over and stay at the hotel and I'll spend a few hours with you - no charge - in the evening?

Having said that, I note that you're also posted a related question on "grep" which I have just answered.   And your question there does confirm thaty you could really benefit from our training.




This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho