This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unittest | |
| import basic_questions | |
| class TestBasicQuestions(unittest.TestCase): | |
| def setUp(self): | |
| self.gff_dict = basic_questions.read_GFF_file("hsa.gff3") | |
| def test_question1(self): | |
| # Expected value of question1 | |
| expected = {"mature": 2711, "primary": 1749} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| /Applications/Karabiner.app/Contents/Library/bin/karabiner select_by_name HHKB # to HHKB mode | |
| sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext | |
| case $? in | |
| 3) exit 0;; | |
| *) exit $?;; | |
| esac |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import HTSeq | |
| def MIMAT_to_MI(mimat): | |
| # Convert MIMAT (mature) to MI ID (pre) of mirbase.org | |
| mat_gtf = "path_to_mature.gtf" | |
| pre_gtf = "path_to_pre.gtf" | |
| for mgtf in HTSeq.GFF_Reader(mat_gtf): | |
| if mimat == mgtf.attr["transcript_id"]: | |
| pre_query = mgtf.attr["Derives_from"] | |
| return filter(lambda pre: pre.attr["transcript_id"] == pre_query, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyfasta import Fasta | |
| f = Fasta("db/Human/Homo_sapiens/UCSC/hg19/Sequence/WholeGenomeFasta/genome.fa") | |
| mir_base = "GGCUGAGCCGCAGUAGUUCUUCAGUGGCAAGCUUUAUGUCCUGACCCAGCUAAAGCUGCCAGUUGAAGAACUGUUGCCCUCUGCC".replace("U", "T") | |
| mir_22 = {"chr": "chr17", "start":1617197 , "stop":1617281, "strand": "-"} | |
| seq = f.sequence(mir_22) | |
| if mir_base == seq: | |
| print mir_22 |
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chr11,.,exon,122017276,122017297,.,-,.,transcript_id "MIMAT0000062"; Alias "MIMAT0000062"; Name "hsa-let-7a-5p"; Derives_from "MI0000061"; | |
| chr22,.,exon,46508632,46508653,.,+,.,transcript_id "MIMAT0000062_1"; Alias "MIMAT0000062"; Name "hsa-let-7a-5p"; Derives_from "MI0000062"; | |
| chr9,.,exon,96938244,96938265,.,+,.,transcript_id "MIMAT0000062_2"; Alias "MIMAT0000062"; Name "hsa-let-7a-5p"; Derives_from "MI0000060"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot.wrap <- function(df, x, y, filename, ...) { | |
| g <- ggplot(df, aes_string(x=x, y=y)) + | |
| geom_point(colour="limegreen", size=3) + theme_light() + ... | |
| ggsave(plot=g, filename=filename) | |
| d <- data.frame(A=1:10, B=2:11, C=3:12) | |
| plot.wrap(d, "A", "B", filename="AB.pdf") # A-B plot | |
| plot.wrap(d, "A", "C", filename="AC.pdf") # A-C plot | |
| plot.wrap(d, "B", "C", filename="BC.pdf") # B-C plot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ##fileformat=VCFv4.0 | |
| ##fileDate=20141202 | |
| ##source=ClinVar and dbSNP | |
| ##dbSNP_BUILD_ID=142 | |
| ##reference=GRCh37.p13 | |
| ##phasing=partial | |
| ##variationPropertyDocumentationUrl=ftp://ftp.ncbi.nlm.nih.gov/snp/specs/dbSNP_BitField_latest.pdf | |
| ##INFO=<ID=RS,Number=1,Type=Integer,Description="dbSNP ID (i.e. rs number)"> | |
| ##INFO=<ID=RSPOS,Number=1,Type=Integer,Description="Chr position reported in dbSNP"> | |
| ##INFO=<ID=RV,Number=0,Type=Flag,Description="RS orientation is reversed"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Main { | |
| def complement(nuc: List[String]): List[String] = { | |
| nuc.map { nt => | |
| nt match { | |
| case "A" => "T" | |
| case "T" => "A" | |
| case "G" => "C" | |
| case "C" => "G" | |
| case _ => throw new IllegalArgumentException("Invalid seq") | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bowtie2 -x genome -p 12 -1 1.fq -2 2.fq | samtools view -bS -@4 - | samtools sort -@4 - bw_map.sorted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pn() { | |
| terminal-notifier -subtitle "Finished job" -message "Status: $?" | |
| } |