Sponsored Content
Operating Systems Linux help to print all the contents under chosen records in perl Post 302637487 by kaav06 on Wednesday 9th of May 2012 01:19:57 AM
Old 05-09-2012
help to print all the contents under chosen records in perl

Hi,
I have a file in which I have to separate genes from phenotype data. I have written a program as given below which prints just the gene records.
1. But I want to print all the data under each specified record to the output file. So the file has all the data like for every record. An example of a record with all the data is given below.
2.The program below gives me only the gene list but I want all the data as given below also in my output file. Every separate record starts with the line *RECORD*.

Code:
*RECORD*
*FIELD* NO
100050
*FIELD* TI
100050 AARSKOG SYNDROME, AUTOSOMAL DOMINANT
*FIELD* TX
Grier et al. (1983) reported father and 2 sons with typical Aarskog
syndrome, including short stature, hypertelorism, and shawl scrotum.
They tabulated the findings in 82 previous cases. X-linked recessive
inheritance has repeatedly been suggested (see 305400). The family
reported by Welch (1974) had affected males in 3 consecutive
generations. Thus, there is either genetic heterogeneity or this is an
autosomal dominant with strong sex-influence and possibly ascertainment
bias resulting from use of the shawl scrotum as a main criterion.
Stretchable skin was present in the cases of Grier et al. (1983).

Teebi et al. (1993) reported the case of an affected mother and 4 sons
(including a pair of monozygotic twins) by 2 different husbands. They
suggested that the manifestations were as severe in the mother as in the
sons and that this suggested autosomal dominant inheritance. Actually,
the mother seemed less severely affected, compatible with X-linked
inheritance.

*FIELD* RF
1. Grier, R. E.; Farrington, F. H.; Kendig, R.; Mamunes, P.: Autosomal
dominant inheritance of the Aarskog syndrome. Am. J. Med. Genet. 15:
39-46, 1983.

2. Teebi, A. S.; Rucquoi, J. K.; Meyn, M. S.: Aarskog syndrome: report
of a family with review and discussion of nosology. Am. J. Med. Genet. 46:
501-509, 1993.

3. Welch, J. P.: Elucidation of a 'new' pleiotropic connective tissue
disorder. Birth Defects Orig. Art. Ser. X(10): 138-146, 1974.

*FIELD* CS

Growth:
   Mild to moderate short stature

Head:
   Normocephaly

Hair:
   Widow's peak

Facies:
   Maxillary hypoplasia;
   Broad nasal bridge;
   Anteverted nostrils;
   Long philtrum;
   Broad upper lip;
   Curved linear dimple below the lower lip

Eyes:
   Hypertelorism;
   Ptosis;
   Down-slanted palpebral fissures;
   Ophthalmoplegia;
   Strabismus;
   Hyperopic astigmatism;
   Large cornea

Ears:
   Floppy ears;
   Lop-ears

Mouth:
   Cleft lip/palate

GU:
   Shawl scrotum;
   Saddle-bag scrotum;
   Cryptorchidism

Limbs:
   Brachydactyly;
   Digital contractures;
   Clinodactyly;
   Mild syndactyly;
   Transverse palmar crease;
   Lymphedema of the feet

Joints:
   Ligamentous laxity;
   Osteochondritis dissecans;
   Proximal finger joint hyperextensibility;
   Flexed distal finger joints;
   Genu recurvatum;
   Flat feet

Skin:
   Stretchable skin

Spine:
   Cervical spine hypermobility;
   Odontoid anomaly

Heme:
   Macrocytic anemia;
   Hemochromatosis

GI:
   Hepatomegaly;
   Portal cirrhosis;
   Imperforate anus;
   Rectoperineal fistula

Pulmonary:
   Interstitial pulmonary disease

Thorax:
   Sternal deformity

Inheritance:
   Sex-influenced autosomal dominant form;
   also X-linked form

*FIELD* CD
Victor A. McKusick: 6/4/1986

*FIELD* ED
carol: 02/16/2011
alopez: 6/3/1997
mimadm: 3/11/1994
carol: 7/7/1993
supermim: 3/16/1992
supermim: 3/20/1990
ddp: 10/26/1989
marie: 3/25/1988

[
Code:
#!/usr/bin/perl
open(DATA, 'omim.txt');
# or die("Could not open omim file.");
open(MYOUTPUT, ">omimgenes.txt");
# or die ("could not open omimgenes file.");
while(<DATA>)
{
if (/^\*FIELD\*\sTI$/)
{
my $gene_record=readline(DATA);
foreach ($gene_record =~m/^\*/)
{
print MYOUTPUT $gene_record;
}
}
}
close(MYOUTPUT);
close(DATA);

]

Last edited by Scrutinizer; 05-12-2012 at 02:05 PM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to print contents on the screen?

I have the following questions regrading Unix commands. 1. Could you provide the commands how to print the content of ".profile" and ".shrc" files on the screen using "more" and "piple" command? 2. How can i use the "head" and "tail" to display lines from 25 through 75... 3. How to search... (1 Reply)
Discussion started by: aadba
1 Replies

2. Shell Programming and Scripting

ls command to print fifo of contents (or perl)

Hello, What are the options to print the contents of a directory in FIFO fashion? I have searched the forum for something relative to this question and found no answers. If there is a way please advise, if it has already been answered, please provide a link to the post. Alternately if... (1 Reply)
Discussion started by: jerardfjay
1 Replies

3. Shell Programming and Scripting

Using first word and print their contents using awk

suppose u hava a file G1354R tGGC-CGC D1361N cGAC-AAC I1424T ATC-ACC R768W gCGG-TGG Q1382R CAG-CGG Q178E gCAG-GAG Y181C TAC-TGC .........cont. So the question is By searching for first word i.e.character say R output shud be R768W gCGG-TGG R182P CGG-CCG R189W ... (6 Replies)
Discussion started by: cdfd123
6 Replies

4. Shell Programming and Scripting

print contents of any file within some timeframe

Hi, Is there anyway to print contents of any file ( say log files that grow automatically) within some timeframe ( comparing with current time), say print contents of the added in: 1) last 2 hr 2) last 45 min 3) last 3 hrs 47 min (3 Replies)
Discussion started by: fed.linuxgossip
3 Replies

5. Shell Programming and Scripting

print records before and after the pattern

Hi All, I want to write a sh shell script to read input report and search for a specefic pattern in file and print 3 record above and 2 record below the line in which pattern found. My file contains different- different pattern repeatedly, same pattern set of records should go into one file... (9 Replies)
Discussion started by: singhald
9 Replies

6. Shell Programming and Scripting

Read contents of the file and print

AT ---------- 0 Elapsed: 00:00:00.02 SO ---------- 0 Elapsed: 00:00:00.01 SE ---------- 0 Elapsed: 00:00:00.01 CR ---------- (4 Replies)
Discussion started by: sandy1028
4 Replies

7. UNIX for Dummies Questions & Answers

print records where an ID appears more than once

Hi everyone! I have something like the following records in a file: ID: 1 Name: A Age: 23 ID: 2 Name: B ID: 1 Activity: Climbing ID: 3 Name: C ID: 3 Activity: Skating I want to capture the records where the field Age exists AND the records that have the same ID as the one... (4 Replies)
Discussion started by: Atrisa
4 Replies

8. Shell Programming and Scripting

Perl question - How do I print contents of an array on a single line?

I have the following code: print @testarray; which returns: 8 8 8 9 How do I return the array like this: The output is: 8, 8, 8, 9 (5 Replies)
Discussion started by: streetfighter2
5 Replies

9. Shell Programming and Scripting

Print other records along with condition too

Hi, I have a text file with more than 100000 records. I used the following command awk '{if ($3<$2) print $1"\t"$3"\t"$2"\t"$4"\t"$5}' input.txt > output.txt But, this one is printing which satisfies the condition, which are only 1000. I would like to get all the 100000 records in... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

10. Shell Programming and Scripting

search for a date and print the contents below the line

Hi, We have a script which takes the backup of some files and writes the output into a log file for each run on a daily basis. Following is the extract from the log file. Date:20120917 ********************************************************** * BACKUP ACTIVITY STARTED ... (5 Replies)
Discussion started by: svajhala
5 Replies
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy