Sponsored Content
Top Forums UNIX for Advanced & Expert Users Map snps into a ref gene file Post 302989928 by Don Cragun on Thursday 19th of January 2017 09:44:58 PM
Old 01-19-2017
One might think that something more like:
Code:
awk '
FNR==1 {next}
FNR == NR {
        POS[++k]=$1
        ID[k]=$2
        next
}
{       for(i = 1; i <= k; i++)
                if(POS[i]>=$5 && POS[i]<=$6)
                        print $1, ID[i], $3, POS[i], $5, $6
}' pre_snpinfo_tumor.txt  refFlat.txt

would work, but since absolutely none of the positions specified in your 1st sample input file are in any of the ranges specified by your 2nd sample input file, no output is produced. I guess that is to be expected because I asked you what output you wanted your script to produce from your sample input files and you didn't give an answer to that question.

If this doesn't work for your real data, you might consider giving us some sample input that you think should produce some output and actually show us what output you are trying to produce from those inputs.

If you want to try this on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk or nawk.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading a path (including ref to shell variable) from file

Hi! 1. I have a parameter file containing path to log files. For this example both paths are the same, one is stated directly and the second using env variables. /oracle/admin/orcl/bdump/:atlas:trc:N ${ORACLE_BASE}/admin/${ORACLE_SID}/bdump/:${ORACLE_SID}:trc:N 2. I try to parse the path... (1 Reply)
Discussion started by: lojzev
1 Replies

2. Shell Programming and Scripting

File merging using first column as the ref

I had two files 1.txt 2.txt. I want a 3rd file(o/p) 3.txt like below (using awk) 1.txt 11 a1 12 a2 13 a3 14 a4 15 a5 16 a6 17 a7 18 a8 19 a9 20 a10 2.txt 14 b1 15 b2 16 b3 (8 Replies)
Discussion started by: p_sai_ias
8 Replies

3. Shell Programming and Scripting

Append file from ref file AWK

FILE1 abc:xxx:abc:123:wer:AAA:12 csf:xxx:123:aeg:sar:BBB:13 asq:yer:321:wsa:qqq:CCC:14 FILE2 AAA:12:SET1:R1 AAA:12:SSS1:RR1 AAA:11:SET4:R3 BBB:13:SET2:R2 OUTPUT abc:xxx:abc:123:wer:AAA:12:SET1:R1:SSS1:RR1 csf:xxx:123:aeg:sar:BBB:13:SET2:R2::... (4 Replies)
Discussion started by: greycells
4 Replies

4. Shell Programming and Scripting

Script to search and extract the gene sub-location from gff file.

Hi, my problem is that I have two files. File no. 1 is a gff text file (say gi1) that has gene information like : ******************** gene 39389788..39395643 /gene="RPSA" /note="Derived by automated computational analysis using ... (2 Replies)
Discussion started by: reena2305
2 Replies

5. UNIX for Advanced & Expert Users

cannot find map file

Hi, all: My writed network device driver works fine when the transmitted file is under several MegaBytes, but above this size, especially dozens of or hundreds of MegaBytes, the kernel panic ocurres! I check the kern.log and find this error : 522 Nov 14 19:35:32 liklstar-server kerneNov 14... (2 Replies)
Discussion started by: liklstar
2 Replies

6. Shell Programming and Scripting

File merging using first column as the ref

I had two files 1.txt 2.txt. I want a 3rd file(o/p) 3.txt like below based on the common elements from the first coulmns of 1.txt and 2.txt. 1.txt 11 12 13 14 15 16 17 18 19 20 21 2.txt (6 Replies)
Discussion started by: p_sai_ias
6 Replies

7. UNIX for Dummies Questions & Answers

Breaking a fasta formatted file into multiple files containing each gene separately

Hey, I've been trying to break a massive fasta formatted file into files containing each gene separately. Could anyone help me? I've tried to use the following code but i've recieved errors every time: for i in *.rtf.out do awk '/^>/{f=++d".fasta"} {print > $i.out}' $i done (1 Reply)
Discussion started by: Ann Mc Cartney
1 Replies

8. Shell Programming and Scripting

Extract a string between 2 ref string from a file

Hi, May i ask if someone share some command for extracting a string between 2 ref string in a txt file My objective: i had a file with multiple lines and wants only to extract the string "watch?v=IbkAXOmEHpY" or "watch?v=<11 random character>", when i used "grep 'watch?=*' i got a results per... (4 Replies)
Discussion started by: jao_madn
4 Replies

9. Shell Programming and Scripting

awk to average target and gene

I am trying to modify the awk below to include the gene name ($5) for each target and can not seem to do so. Also, I'm not sure the calculation is right (average of all targets that are the same is $4 using the values in $7)? Thank you :). awk '{if((NR>1)&&($4!=last)){printf("%s\t%f\t%s\n",... (1 Reply)
Discussion started by: cmccabe
1 Replies

10. UNIX for Beginners Questions & Answers

Snps annotation

I have the following Snps data CHROM POS ID chr7 78599583 rs987435 chr15 33395779 rs987436 chr1 189807684 rs987437 chr20 33907909 rs987438 chr12 75664046 rs987439 and the following gene data genename name chrom strand txstart txend... (8 Replies)
Discussion started by: marwah
8 Replies
MCA(9)							   BSD Kernel Developer's Manual						    MCA(9)

NAME
MCA, mca_intr_establish, mca_intr_disestablish, mca_intr_evcnt, mca_conf_read, mca_conf_write -- MicroChannel Architecture bus SYNOPSIS
#include <sys/bus.h> #include <dev/mca/mcavar.h> #include <dev/mca/mcadevs.h> void * mca_intr_establish(mca_chipset_tag_t mc, mca_intr_handle_t hdl, int level, int (*handler)(void *), void *arg); void mca_intr_disestablish(mca_chipset_tag_t mc, mca_intr_handle_t hdl); const struct evcnt * mca_intr_evcnt(mca_chipset_tag_t mc, mca_intr_handle_t hdl); int mca_conf_read(mca_chipset_tag_t mc, int slot, int reg); void mca_conf_write(mca_chipset_tag_t mc, int slot, int reg, int data); DESCRIPTION
The MCA device provides support for IBM's MicroChannel Architecture bus found on IBM PS/2 systems and selected workstations. It was designed as a replacement bus for the ISA bus found on IBM's older machines. However, the bus specifications were only available under license, so MCA did not achieve widespread acceptance in the industry. Being a replacement for the ISA bus, the MCA bus does share some similar aspects with the ISA bus. Some MCA devices can be detected via the usual ISA-style probing. However, most device detection is done through the Programmable Option Select (POS) registers. These registers provide a window into a device to determine device-specific properties and configuration. The configuration of devices and their POS regis- ters is performed using IBM's system configuration software. The MCA bus uses level-triggered interrupts while the ISA bus uses edge-triggered interrupts. Level triggered interrupts have the advantage that they can be shared among multiple device. Therefore, most MCA-specific devices should be coded with shared interrupts in mind. DATA TYPES
Drivers for devices attached to the MCA bus will make use of the following data types: mca_chipset_tag_t Chipset tag for the MCA bus. mca_intr_handle_t The opaque handle describing an established interrupt handler. struct mca_attach_args A structure use to inform the driver of MCA bus properties. It contains the following members: bus_space_tag_t ma_iot; /* MCA I/O space tag */ bus_space_tag_t ma_memt; /* MCA mem space tag */ bus_dma_tag_t ma_dmat; /* MCA DMA tag */ int ma_slot; /* MCA slot number */ int ma_pos[8]; /* MCA POS values */ int ma_id; /* MCA device */ FUNCTIONS
mca_intr_establish(mc, hdl, level, handler, arg) Establish a MCA interrupt handler on the MCA bus specified by mc for the interrupt described completely by hdl. The priority of the interrupt is specified by level. When the interrupt occurs the function handler is called with argument arg. mca_intr_disestablish(mc, hdl) Dis-establish the interrupt handler on the MCA bus specified by mc for the interrupt described completely hdl. mca_intr_evcnt(mc, hdl) Do interrupt event counting on the MCA bus specified by mc for the event described completely by hdl. mca_conf_read(mc, slot, reg) Read the POS register reg for the device in slot slot on the MCA bus specified by mc. mca_conf_write(mc, slot, reg, data) Write data data to the POS register reg for the device in slot slot on the MCA bus specified by mc. AUTOCONFIGURATION
The MCA bus is a direct-connection bus. During autoconfiguration, the parent specifies the MCA device ID for the found device in the ma_id member of the mca_attach_args structure. Drivers should match on the device ID. Device capabilities and configuration information should be read from device POS registers using mca_conf_read(). Some important configuration information found in the POS registers include the I/O base address, memory base address and interrupt number. The location of these configurable options with the POS registers are device spe- cific. DMA SUPPORT
The MCA bus supports 32-bit, bidirectional DMA transfers. Currently, no machine-independent support for MCA DMA is available. CODE REFERENCES
The MCA subsystem itself is implemented within the file sys/dev/mca/mca_subr.c. Machine-dependent portions can be found in sys/arch/<arch>/mca/mca_machdep.c. The database of known devices exists within the file sys/dev/mca/mcadevs_data.h and is generated automat- ically from the file sys/dev/mca/mcadevs. New vendor and product identifiers should be added to this file. The database can be regenerated using the Makefile sys/dev/mca/Makefile.mcadevs. A good source of information about MCA devices is IBM's system configuration disk. The disk contains .adf files which describe the location of device configuration options in the POS registers. SEE ALSO
mca(4), autoconf(9), bus_dma(9), bus_space(9), driver(9), isa(9) BUGS
The machine-independent MCA driver does not currently support DMA. MCA devices which require DMA operation currently access the DMA capabil- ities directly. BSD
October 7, 2001 BSD
All times are GMT -4. The time now is 02:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy